diff options
Diffstat (limited to 'arch/um/include')
-rw-r--r-- | arch/um/include/sysdep-i386/kernel-offsets.h | 23 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/kernel-offsets.h | 25 |
2 files changed, 48 insertions, 0 deletions
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h new file mode 100644 index 00000000000..82f96c57414 --- /dev/null +++ b/arch/um/include/sysdep-i386/kernel-offsets.h @@ -0,0 +1,23 @@ +#include <linux/stddef.h> +#include <linux/sched.h> +#include <linux/elf.h> + +#define DEFINE(sym, val) \ + asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + +#define STR(x) #x +#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) + +#define BLANK() asm volatile("\n->" : : ) + +#define OFFSET(sym, str, mem) \ + DEFINE(sym, offsetof(struct str, mem)); + +void foo(void) +{ + OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); +#ifdef CONFIG_MODE_TT + OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); +#endif +#include <common-offsets.h> +} diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h new file mode 100644 index 00000000000..5ce93abd0b5 --- /dev/null +++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h @@ -0,0 +1,25 @@ +#include <linux/config.h> +#include <linux/stddef.h> +#include <linux/sched.h> +#include <linux/time.h> +#include <linux/elf.h> +#include <asm/page.h> + +#define DEFINE(sym, val) \ + asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + +#define DEFINE_STR1(x) #x +#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : ) + +#define BLANK() asm volatile("\n->" : : ) + +#define OFFSET(sym, str, mem) \ + DEFINE(sym, offsetof(struct str, mem)); + +void foo(void) +{ +#ifdef CONFIG_MODE_TT + OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); +#endif +#include <common-offsets.h> +} |