1 #ifndef __LINUX_KBUILD_H 2 # error "Please do not build this file directly, build asm-offsets.c instead" 3 #endif 4 5 #include <asm/ia32.h> 6 7 #define __SYSCALL_64(nr, sym, compat) [nr] = 1, 8 #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1, 9 #ifdef CONFIG_X86_X32_ABI 10 # define __SYSCALL_X32(nr, sym, compat) [nr] = 1, 11 #else 12 # define __SYSCALL_X32(nr, sym, compat) /* nothing */ 13 #endif 14 static char syscalls_64[] = { 15 #include <asm/syscalls_64.h> 16 }; 17 #define __SYSCALL_I386(nr, sym, compat) [nr] = 1, 18 static char syscalls_ia32[] = { 19 #include <asm/syscalls_32.h> 20 }; 21 22 int main(void) 23 { 24 #ifdef CONFIG_PARAVIRT 25 OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame); 26 OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64); 27 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs); 28 BLANK(); 29 #endif 30 31 #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry) 32 ENTRY(bx); 33 ENTRY(cx); 34 ENTRY(dx); 35 ENTRY(sp); 36 ENTRY(bp); 37 ENTRY(si); 38 ENTRY(di); 39 ENTRY(r8); 40 ENTRY(r9); 41 ENTRY(r10); 42 ENTRY(r11); 43 ENTRY(r12); 44 ENTRY(r13); 45 ENTRY(r14); 46 ENTRY(r15); 47 ENTRY(flags); 48 BLANK(); 49 #undef ENTRY 50 51 #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry) 52 ENTRY(cr0); 53 ENTRY(cr2); 54 ENTRY(cr3); 55 ENTRY(cr4); 56 ENTRY(cr8); 57 ENTRY(gdt_desc); 58 BLANK(); 59 #undef ENTRY 60 61 OFFSET(TSS_ist, tss_struct, x86_tss.ist); 62 OFFSET(TSS_sp0, tss_struct, x86_tss.sp0); 63 BLANK(); 64 65 DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1); 66 DEFINE(NR_syscalls, sizeof(syscalls_64)); 67 68 DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1); 69 DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32)); 70 71 return 0; 72 } 73