diff options
Diffstat (limited to 'sys/ofed/include/linux/sched.h')
-rw-r--r-- | sys/ofed/include/linux/sched.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/ofed/include/linux/sched.h b/sys/ofed/include/linux/sched.h index 1228868..c2d66d7 100644 --- a/sys/ofed/include/linux/sched.h +++ b/sys/ofed/include/linux/sched.h @@ -64,9 +64,12 @@ struct task_struct { int should_stop; }; -#define current ((struct task_struct *)curthread->td_retval[1]) -#define task_struct_get(x) (struct task_struct *)(x)->td_retval[1] -#define task_struct_set(x, y) (x)->td_retval[1] = (register_t)(y) +#define current task_struct_get(curthread) +#define task_struct_get(x) ((struct task_struct *)(uintptr_t)(x)->td_retval[1]) +#define task_struct_set(x, y) (x)->td_retval[1] = (uintptr_t)(y) + +/* ensure the task_struct pointer fits into the td_retval[1] field */ +CTASSERT(sizeof(((struct thread *)0)->td_retval[1]) >= sizeof(uintptr_t)); #define set_current_state(x) \ atomic_store_rel_int((volatile int *)¤t->state, (x)) |