linux/arch/x86/kernel/asm-offsets_32.c
<<
>>
Prefs
   1/*
   2 * Generate definitions needed by assembly language modules.
   3 * This code generates raw asm output which is post-processed
   4 * to extract and format the required data.
   5 */
   6
   7#include <linux/crypto.h>
   8#include <linux/sched.h>
   9#include <linux/signal.h>
  10#include <linux/personality.h>
  11#include <linux/suspend.h>
  12#include <linux/kbuild.h>
  13#include <asm/ucontext.h>
  14#include "sigframe.h"
  15#include <asm/pgtable.h>
  16#include <asm/fixmap.h>
  17#include <asm/processor.h>
  18#include <asm/thread_info.h>
  19#include <asm/bootparam.h>
  20#include <asm/elf.h>
  21
  22#include <xen/interface/xen.h>
  23
  24#include <linux/lguest.h>
  25#include "../../../drivers/lguest/lg.h"
  26
  27/* workaround for a warning with -Wmissing-prototypes */
  28void foo(void);
  29
  30void foo(void)
  31{
  32        OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
  33        OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
  34        OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
  35        OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
  36        OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
  37        OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
  38        OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
  39        OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
  40        OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
  41        BLANK();
  42
  43        OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  44        OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  45        OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  46        OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
  47        OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
  48        OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  49        OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  50        OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  51        BLANK();
  52
  53        OFFSET(TI_task, thread_info, task);
  54        OFFSET(TI_exec_domain, thread_info, exec_domain);
  55        OFFSET(TI_flags, thread_info, flags);
  56        OFFSET(TI_status, thread_info, status);
  57        OFFSET(TI_preempt_count, thread_info, preempt_count);
  58        OFFSET(TI_addr_limit, thread_info, addr_limit);
  59        OFFSET(TI_restart_block, thread_info, restart_block);
  60        OFFSET(TI_sysenter_return, thread_info, sysenter_return);
  61        OFFSET(TI_cpu, thread_info, cpu);
  62        BLANK();
  63
  64        OFFSET(GDS_size, desc_ptr, size);
  65        OFFSET(GDS_address, desc_ptr, address);
  66        BLANK();
  67
  68        OFFSET(PT_EBX, pt_regs, bx);
  69        OFFSET(PT_ECX, pt_regs, cx);
  70        OFFSET(PT_EDX, pt_regs, dx);
  71        OFFSET(PT_ESI, pt_regs, si);
  72        OFFSET(PT_EDI, pt_regs, di);
  73        OFFSET(PT_EBP, pt_regs, bp);
  74        OFFSET(PT_EAX, pt_regs, ax);
  75        OFFSET(PT_DS,  pt_regs, ds);
  76        OFFSET(PT_ES,  pt_regs, es);
  77        OFFSET(PT_FS,  pt_regs, fs);
  78        OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  79        OFFSET(PT_EIP, pt_regs, ip);
  80        OFFSET(PT_CS,  pt_regs, cs);
  81        OFFSET(PT_EFLAGS, pt_regs, flags);
  82        OFFSET(PT_OLDESP, pt_regs, sp);
  83        OFFSET(PT_OLDSS,  pt_regs, ss);
  84        BLANK();
  85
  86        OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
  87        OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
  88        BLANK();
  89
  90        OFFSET(pbe_address, pbe, address);
  91        OFFSET(pbe_orig_address, pbe, orig_address);
  92        OFFSET(pbe_next, pbe, next);
  93
  94        /* Offset from the sysenter stack to tss.sp0 */
  95        DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
  96                 sizeof(struct tss_struct));
  97
  98        DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
  99        DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
 100        DEFINE(PTRS_PER_PTE, PTRS_PER_PTE);
 101        DEFINE(PTRS_PER_PMD, PTRS_PER_PMD);
 102        DEFINE(PTRS_PER_PGD, PTRS_PER_PGD);
 103
 104        OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
 105
 106#ifdef CONFIG_PARAVIRT
 107        BLANK();
 108        OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
 109        OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
 110        OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
 111        OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
 112        OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
 113        OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
 114        OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
 115        OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
 116#endif
 117
 118#ifdef CONFIG_XEN
 119        BLANK();
 120        OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
 121        OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
 122#endif
 123
 124#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
 125        BLANK();
 126        OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
 127        OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
 128
 129        BLANK();
 130        OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
 131        OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
 132        OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
 133        OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
 134        OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
 135        OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
 136        OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
 137        OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
 138        OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
 139        OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
 140#endif
 141
 142        BLANK();
 143        OFFSET(BP_scratch, boot_params, scratch);
 144        OFFSET(BP_loadflags, boot_params, hdr.loadflags);
 145        OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
 146        OFFSET(BP_version, boot_params, hdr.version);
 147}
 148
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.