4.115
Last change
on this file since f1738ed was
f1738ed,
checked in by Sebastian Huber <sebastian.huber@…>, on 11/04/12 at 20:04:39
|
score: PR1607: Add and use CPU_SIZEOF_POINTER
Add and use new CPU port define CPU_SIZEOF_POINTER. It must be an
integer literal that can be used by the assembler. This value will be
used to calculate offsets of structure members. These offsets will be
used in assembler code.
The size of a pointer is part of the application binary interface (ABI)
and thus independent of the actual programming language. The compiler
will provide defines to determine the current ABI. We use these defines
to select the appropriate CPU_SIZEOF_POINTER value.
Static assertions in the new file "cpukit/score/src/percpuasm.c" will
ensure that the value of CPU_SIZEOF_POINTER is consistent with the
current compiler settings. Also the offset values used by assembler
code are verfied.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2012 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Obere Lagerstr. 30 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/score/cpu.h> |
---|
20 | |
---|
21 | #define _RTEMS_PERCPU_DEFINE_OFFSETS |
---|
22 | #include <rtems/score/percpu.h> |
---|
23 | |
---|
24 | RTEMS_STATIC_ASSERT( |
---|
25 | sizeof(void *) == CPU_SIZEOF_POINTER, |
---|
26 | CPU_SIZEOF_POINTER |
---|
27 | ); |
---|
28 | |
---|
29 | #ifdef __SIZEOF_POINTER__ |
---|
30 | RTEMS_STATIC_ASSERT( |
---|
31 | CPU_SIZEOF_POINTER == __SIZEOF_POINTER__, |
---|
32 | __SIZEOF_POINTER__ |
---|
33 | ); |
---|
34 | #endif |
---|
35 | |
---|
36 | RTEMS_STATIC_ASSERT( |
---|
37 | offsetof(Per_CPU_Control, isr_nest_level) == PER_CPU_ISR_NEST_LEVEL, |
---|
38 | PER_CPU_ISR_NEST_LEVEL |
---|
39 | ); |
---|
40 | |
---|
41 | RTEMS_STATIC_ASSERT( |
---|
42 | offsetof(Per_CPU_Control, dispatch_necessary) == PER_CPU_DISPATCH_NEEDED, |
---|
43 | PER_CPU_DISPATCH_NEEDED |
---|
44 | ); |
---|
45 | |
---|
46 | #if CPU_ALLOCATE_INTERRUPT_STACK == TRUE \ |
---|
47 | || CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE |
---|
48 | RTEMS_STATIC_ASSERT( |
---|
49 | offsetof(Per_CPU_Control, interrupt_stack_low) |
---|
50 | == PER_CPU_INTERRUPT_STACK_LOW, |
---|
51 | PER_CPU_INTERRUPT_STACK_LOW |
---|
52 | ); |
---|
53 | |
---|
54 | RTEMS_STATIC_ASSERT( |
---|
55 | offsetof(Per_CPU_Control, interrupt_stack_high) |
---|
56 | == PER_CPU_INTERRUPT_STACK_HIGH, |
---|
57 | PER_CPU_INTERRUPT_STACK_HIGH |
---|
58 | ); |
---|
59 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.