diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-09-03 08:01:12 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-12-06 22:20:27 -0500 |
| commit | 93e9d420554ed60cb3fa9fa47d3e97b33556b276 (patch) | |
| tree | 63c8a246f182ceff0c1b67f170835025a148aa8b | |
| parent | 3445e102f16ef5ef0ae0a1c78c16a98ce3d2e5b0 (diff) | |
Add control page offset checksstaging
Make sure the kernel and userspace compilers have the same idea of the
layout of the control page.
| -rw-r--r-- | include/internal.h | 2 | ||||
| -rw-r--r-- | src/kernel_iface.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/internal.h b/include/internal.h index 747f095..035440b 100644 --- a/include/internal.h +++ b/include/internal.h | |||
| @@ -23,6 +23,8 @@ int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, | |||
| 23 | #define likely(x) __builtin_expect((x), 1) | 23 | #define likely(x) __builtin_expect((x), 1) |
| 24 | #define unlikely(x) __builtin_expect((x), 0) | 24 | #define unlikely(x) __builtin_expect((x), 0) |
| 25 | 25 | ||
| 26 | #define offsetof(s, x) __builtin_offsetof(s, x) | ||
| 27 | |||
| 26 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | 28 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
| 27 | #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) | 29 | #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) |
| 28 | 30 | ||
diff --git a/src/kernel_iface.c b/src/kernel_iface.c index b9c8f59..4cc1af5 100644 --- a/src/kernel_iface.c +++ b/src/kernel_iface.c | |||
| @@ -82,7 +82,16 @@ int init_kernel_iface(void) | |||
| 82 | int err = 0; | 82 | int err = 0; |
| 83 | long page_size = sysconf(_SC_PAGESIZE); | 83 | long page_size = sysconf(_SC_PAGESIZE); |
| 84 | 84 | ||
| 85 | BUILD_BUG_ON(sizeof(union np_flag) != sizeof(uint32_t)); | 85 | BUILD_BUG_ON(sizeof(union np_flag) != sizeof(uint64_t)); |
| 86 | |||
| 87 | BUILD_BUG_ON(offsetof(struct control_page, sched.raw) | ||
| 88 | != LITMUS_CP_OFFSET_SCHED); | ||
| 89 | BUILD_BUG_ON(offsetof(struct control_page, irq_count) | ||
| 90 | != LITMUS_CP_OFFSET_IRQ_COUNT); | ||
| 91 | BUILD_BUG_ON(offsetof(struct control_page, ts_syscall_start) | ||
| 92 | != LITMUS_CP_OFFSET_TS_SC_START); | ||
| 93 | BUILD_BUG_ON(offsetof(struct control_page, irq_syscall_start) | ||
| 94 | != LITMUS_CP_OFFSET_IRQ_SC_START); | ||
| 86 | 95 | ||
| 87 | err = map_file(LITMUS_CTRL_DEVICE, (void**) &ctrl_page, CTRL_PAGES * page_size); | 96 | err = map_file(LITMUS_CTRL_DEVICE, (void**) &ctrl_page, CTRL_PAGES * page_size); |
| 88 | if (err) { | 97 | if (err) { |
