/* * Generate definitions needed by assembly language modules. * This code generates raw asm output which is post-processed to extract * and format the required data. */ #if 0 #include #include #include #include #include #include #include #include #include #endif #include #include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) #define BLANK() asm volatile("\n->" : : ) /** * This is used to automatically count the number of system calls. * A table is generated with one entry for each system call defined in * arch/unistd.h, which contains the list of system calls. */ #define __NO_STUBS 1 #undef __SYSCALL #undef _ARCH_X86_64_UNISTD_H #define __SYSCALL(nr, sym) [nr] = 1, static char syscalls[] = { #include }; int main(void) { #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry)) #if 0 ENTRY(state); ENTRY(flags); ENTRY(thread); #endif ENTRY(id); BLANK(); #undef ENTRY #define ENTRY(entry) DEFINE(tsk_arch_ ## entry, offsetof(struct task_struct, arch) + offsetof(struct arch_task, entry)) ENTRY(flags); ENTRY(addr_limit); BLANK(); #undef ENTRY #define ENTRY(entry) DEFINE(tsk_arch_ ## entry, offsetof(struct task_struct, arch) + offsetof(struct arch_task, thread) + offsetof(struct thread_struct, entry)) ENTRY(rsp); BLANK(); #undef ENTRY #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) ENTRY(kernelstack); ENTRY(oldrsp); ENTRY(pcurrent); ENTRY(irqcount); ENTRY(cpunumber); ENTRY(irqstackptr); ENTRY(data_offset); BLANK(); #undef ENTRY #if 0 DEFINE(pbe_address, offsetof(struct pbe, address)); DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); DEFINE(pbe_next, offsetof(struct pbe, next)); BLANK(); DEFINE(TSS_ist, offsetof(struct tss_struct, ist)); #endif BLANK(); DEFINE(__NR_syscall_max, sizeof(syscalls) - 1); return 0; }