1 /* 2 * Generate definitions needed by assembly language modules. 3 * This code generates raw asm output which is post-processed to extract 4 * and format the required data. 5 */ 6 7 #include <linux/crypto.h> 8 #include <linux/sched.h> 9 #include <linux/stddef.h> 10 #include <linux/errno.h> 11 #include <linux/hardirq.h> 12 #include <linux/suspend.h> 13 #include <asm/pda.h> 14 #include <asm/processor.h> 15 #include <asm/segment.h> 16 #include <asm/thread_info.h> 17 #include <asm/ia32.h> 18 #include <asm/bootparam.h> 19 20 #define DEFINE(sym, val) \ 21 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 22 23 #define BLANK() asm volatile("\n->" : : ) 24 25 #define OFFSET(sym, str, mem) \ 26 DEFINE(sym, offsetof(struct str, mem)) 27 28 #define __NO_STUBS 1 29 #undef __SYSCALL 30 #undef _ASM_X86_64_UNISTD_H_ 31 #define __SYSCALL(nr, sym) [nr] = 1, 32 static char syscalls[] = { 33 #include <asm/unistd.h> 34 }; 35 36 int main(void) 37 { 38 #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry)) 39 ENTRY(state); 40 ENTRY(flags); 41 ENTRY(thread); 42 ENTRY(pid); 43 BLANK(); 44 #undef ENTRY 45 #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry)) 46 ENTRY(flags); 47 ENTRY(addr_limit); 48 ENTRY(preempt_count); 49 ENTRY(status); 50 BLANK(); 51 #undef ENTRY 52 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) 53 ENTRY(kernelstack); 54 ENTRY(oldrsp); 55 ENTRY(pcurrent); 56 ENTRY(irqcount); 57 ENTRY(cpunumber); 58 ENTRY(irqstackptr); 59 ENTRY(data_offset); 60 BLANK(); 61 #undef ENTRY 62 #ifdef CONFIG_IA32_EMULATION 63 #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry)) 64 ENTRY(eax); 65 ENTRY(ebx); 66 ENTRY(ecx); 67 ENTRY(edx); 68 ENTRY(esi); 69 ENTRY(edi); 70 ENTRY(ebp); 71 ENTRY(esp); 72 ENTRY(eip); 73 BLANK(); 74 #undef ENTRY 75 DEFINE(IA32_RT_SIGFRAME_sigcontext, 76 offsetof (struct rt_sigframe32, uc.uc_mcontext)); 77 BLANK(); 78 #endif 79 DEFINE(pbe_address, offsetof(struct pbe, address)); 80 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); 81 DEFINE(pbe_next, offsetof(struct pbe, next)); 82 BLANK(); 83 #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry)) 84 ENTRY(rbx); 85 ENTRY(rbx); 86 ENTRY(rcx); 87 ENTRY(rdx); 88 ENTRY(rsp); 89 ENTRY(rbp); 90 ENTRY(rsi); 91 ENTRY(rdi); 92 ENTRY(r8); 93 ENTRY(r9); 94 ENTRY(r10); 95 ENTRY(r11); 96 ENTRY(r12); 97 ENTRY(r13); 98 ENTRY(r14); 99 ENTRY(r15); 100 ENTRY(eflags); 101 BLANK(); 102 #undef ENTRY 103 #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry)) 104 ENTRY(cr0); 105 ENTRY(cr2); 106 ENTRY(cr3); 107 ENTRY(cr4); 108 ENTRY(cr8); 109 BLANK(); 110 #undef ENTRY 111 DEFINE(TSS_ist, offsetof(struct tss_struct, ist)); 112 BLANK(); 113 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); 114 BLANK(); 115 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1); 116 117 BLANK(); 118 OFFSET(BP_scratch, boot_params, scratch); 119 OFFSET(BP_loadflags, boot_params, hdr.loadflags); 120 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch); 121 OFFSET(BP_version, boot_params, hdr.version); 122 return 0; 123 } 124