Back to home page

LXR

 
 

    


0001 /*
0002  * Copyright (C) 1995-2003 Russell King
0003  *               2001-2002 Keith Owens
0004  *     
0005  * Generate definitions needed by assembly language modules.
0006  * This code generates raw asm output which is post-processed to extract
0007  * and format the required data.
0008  *
0009  * This program is free software; you can redistribute it and/or modify
0010  * it under the terms of the GNU General Public License version 2 as
0011  * published by the Free Software Foundation.
0012  */
0013 #include <linux/compiler.h>
0014 #include <linux/sched.h>
0015 #include <linux/mm.h>
0016 #include <linux/dma-mapping.h>
0017 #ifdef CONFIG_KVM_ARM_HOST
0018 #include <linux/kvm_host.h>
0019 #endif
0020 #include <asm/cacheflush.h>
0021 #include <asm/glue-df.h>
0022 #include <asm/glue-pf.h>
0023 #include <asm/mach/arch.h>
0024 #include <asm/thread_info.h>
0025 #include <asm/memory.h>
0026 #include <asm/procinfo.h>
0027 #include <asm/suspend.h>
0028 #include <asm/vdso_datapage.h>
0029 #include <asm/hardware/cache-l2x0.h>
0030 #include <linux/kbuild.h>
0031 
0032 /*
0033  * Make sure that the compiler and target are compatible.
0034  */
0035 #if defined(__APCS_26__)
0036 #error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
0037 #endif
0038 /*
0039  * GCC 3.0, 3.1: general bad code generation.
0040  * GCC 3.2.0: incorrect function argument offset calculation.
0041  * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c
0042  *            (http://gcc.gnu.org/PR8896) and incorrect structure
0043  *        initialisation in fs/jffs2/erase.c
0044  * GCC 4.8.0-4.8.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
0045  *        miscompiles find_get_entry(), and can result in EXT3 and EXT4
0046  *        filesystem corruption (possibly other FS too).
0047  */
0048 #ifdef __GNUC__
0049 #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
0050 #error Your compiler is too buggy; it is known to miscompile kernels.
0051 #error    Known good compilers: 3.3, 4.x
0052 #endif
0053 #if GCC_VERSION >= 40800 && GCC_VERSION < 40803
0054 #error Your compiler is too buggy; it is known to miscompile kernels
0055 #error and result in filesystem corruption and oopses.
0056 #endif
0057 #endif
0058 
0059 int main(void)
0060 {
0061   DEFINE(TSK_ACTIVE_MM,     offsetof(struct task_struct, active_mm));
0062 #ifdef CONFIG_CC_STACKPROTECTOR
0063   DEFINE(TSK_STACK_CANARY,  offsetof(struct task_struct, stack_canary));
0064 #endif
0065   BLANK();
0066   DEFINE(TI_FLAGS,      offsetof(struct thread_info, flags));
0067   DEFINE(TI_PREEMPT,        offsetof(struct thread_info, preempt_count));
0068   DEFINE(TI_ADDR_LIMIT,     offsetof(struct thread_info, addr_limit));
0069   DEFINE(TI_TASK,       offsetof(struct thread_info, task));
0070   DEFINE(TI_CPU,        offsetof(struct thread_info, cpu));
0071   DEFINE(TI_CPU_DOMAIN,     offsetof(struct thread_info, cpu_domain));
0072   DEFINE(TI_CPU_SAVE,       offsetof(struct thread_info, cpu_context));
0073   DEFINE(TI_USED_CP,        offsetof(struct thread_info, used_cp));
0074   DEFINE(TI_TP_VALUE,       offsetof(struct thread_info, tp_value));
0075   DEFINE(TI_FPSTATE,        offsetof(struct thread_info, fpstate));
0076 #ifdef CONFIG_VFP
0077   DEFINE(TI_VFPSTATE,       offsetof(struct thread_info, vfpstate));
0078 #ifdef CONFIG_SMP
0079   DEFINE(VFP_CPU,       offsetof(union vfp_state, hard.cpu));
0080 #endif
0081 #endif
0082 #ifdef CONFIG_ARM_THUMBEE
0083   DEFINE(TI_THUMBEE_STATE,  offsetof(struct thread_info, thumbee_state));
0084 #endif
0085 #ifdef CONFIG_IWMMXT
0086   DEFINE(TI_IWMMXT_STATE,   offsetof(struct thread_info, fpstate.iwmmxt));
0087 #endif
0088 #ifdef CONFIG_CRUNCH
0089   DEFINE(TI_CRUNCH_STATE,   offsetof(struct thread_info, crunchstate));
0090 #endif
0091   BLANK();
0092   DEFINE(S_R0,          offsetof(struct pt_regs, ARM_r0));
0093   DEFINE(S_R1,          offsetof(struct pt_regs, ARM_r1));
0094   DEFINE(S_R2,          offsetof(struct pt_regs, ARM_r2));
0095   DEFINE(S_R3,          offsetof(struct pt_regs, ARM_r3));
0096   DEFINE(S_R4,          offsetof(struct pt_regs, ARM_r4));
0097   DEFINE(S_R5,          offsetof(struct pt_regs, ARM_r5));
0098   DEFINE(S_R6,          offsetof(struct pt_regs, ARM_r6));
0099   DEFINE(S_R7,          offsetof(struct pt_regs, ARM_r7));
0100   DEFINE(S_R8,          offsetof(struct pt_regs, ARM_r8));
0101   DEFINE(S_R9,          offsetof(struct pt_regs, ARM_r9));
0102   DEFINE(S_R10,         offsetof(struct pt_regs, ARM_r10));
0103   DEFINE(S_FP,          offsetof(struct pt_regs, ARM_fp));
0104   DEFINE(S_IP,          offsetof(struct pt_regs, ARM_ip));
0105   DEFINE(S_SP,          offsetof(struct pt_regs, ARM_sp));
0106   DEFINE(S_LR,          offsetof(struct pt_regs, ARM_lr));
0107   DEFINE(S_PC,          offsetof(struct pt_regs, ARM_pc));
0108   DEFINE(S_PSR,         offsetof(struct pt_regs, ARM_cpsr));
0109   DEFINE(S_OLD_R0,      offsetof(struct pt_regs, ARM_ORIG_r0));
0110   DEFINE(PT_REGS_SIZE,      sizeof(struct pt_regs));
0111   DEFINE(SVC_DACR,      offsetof(struct svc_pt_regs, dacr));
0112   DEFINE(SVC_ADDR_LIMIT,    offsetof(struct svc_pt_regs, addr_limit));
0113   DEFINE(SVC_REGS_SIZE,     sizeof(struct svc_pt_regs));
0114   BLANK();
0115 #ifdef CONFIG_CACHE_L2X0
0116   DEFINE(L2X0_R_PHY_BASE,   offsetof(struct l2x0_regs, phy_base));
0117   DEFINE(L2X0_R_AUX_CTRL,   offsetof(struct l2x0_regs, aux_ctrl));
0118   DEFINE(L2X0_R_TAG_LATENCY,    offsetof(struct l2x0_regs, tag_latency));
0119   DEFINE(L2X0_R_DATA_LATENCY,   offsetof(struct l2x0_regs, data_latency));
0120   DEFINE(L2X0_R_FILTER_START,   offsetof(struct l2x0_regs, filter_start));
0121   DEFINE(L2X0_R_FILTER_END, offsetof(struct l2x0_regs, filter_end));
0122   DEFINE(L2X0_R_PREFETCH_CTRL,  offsetof(struct l2x0_regs, prefetch_ctrl));
0123   DEFINE(L2X0_R_PWR_CTRL,   offsetof(struct l2x0_regs, pwr_ctrl));
0124   BLANK();
0125 #endif
0126 #ifdef CONFIG_CPU_HAS_ASID
0127   DEFINE(MM_CONTEXT_ID,     offsetof(struct mm_struct, context.id.counter));
0128   BLANK();
0129 #endif
0130   DEFINE(VMA_VM_MM,     offsetof(struct vm_area_struct, vm_mm));
0131   DEFINE(VMA_VM_FLAGS,      offsetof(struct vm_area_struct, vm_flags));
0132   BLANK();
0133   DEFINE(VM_EXEC,           VM_EXEC);
0134   BLANK();
0135   DEFINE(PAGE_SZ,           PAGE_SIZE);
0136   BLANK();
0137   DEFINE(SYS_ERROR0,        0x9f0000);
0138   BLANK();
0139   DEFINE(SIZEOF_MACHINE_DESC,   sizeof(struct machine_desc));
0140   DEFINE(MACHINFO_TYPE,     offsetof(struct machine_desc, nr));
0141   DEFINE(MACHINFO_NAME,     offsetof(struct machine_desc, name));
0142   BLANK();
0143   DEFINE(PROC_INFO_SZ,      sizeof(struct proc_info_list));
0144   DEFINE(PROCINFO_INITFUNC, offsetof(struct proc_info_list, __cpu_flush));
0145   DEFINE(PROCINFO_MM_MMUFLAGS,  offsetof(struct proc_info_list, __cpu_mm_mmu_flags));
0146   DEFINE(PROCINFO_IO_MMUFLAGS,  offsetof(struct proc_info_list, __cpu_io_mmu_flags));
0147   BLANK();
0148 #ifdef MULTI_DABORT
0149   DEFINE(PROCESSOR_DABT_FUNC,   offsetof(struct processor, _data_abort));
0150 #endif
0151 #ifdef MULTI_PABORT
0152   DEFINE(PROCESSOR_PABT_FUNC,   offsetof(struct processor, _prefetch_abort));
0153 #endif
0154 #ifdef MULTI_CPU
0155   DEFINE(CPU_SLEEP_SIZE,    offsetof(struct processor, suspend_size));
0156   DEFINE(CPU_DO_SUSPEND,    offsetof(struct processor, do_suspend));
0157   DEFINE(CPU_DO_RESUME,     offsetof(struct processor, do_resume));
0158 #endif
0159 #ifdef MULTI_CACHE
0160   DEFINE(CACHE_FLUSH_KERN_ALL,  offsetof(struct cpu_cache_fns, flush_kern_all));
0161 #endif
0162 #ifdef CONFIG_ARM_CPU_SUSPEND
0163   DEFINE(SLEEP_SAVE_SP_SZ,  sizeof(struct sleep_save_sp));
0164   DEFINE(SLEEP_SAVE_SP_PHYS,    offsetof(struct sleep_save_sp, save_ptr_stash_phys));
0165   DEFINE(SLEEP_SAVE_SP_VIRT,    offsetof(struct sleep_save_sp, save_ptr_stash));
0166 #endif
0167   BLANK();
0168   DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
0169   DEFINE(DMA_TO_DEVICE,     DMA_TO_DEVICE);
0170   DEFINE(DMA_FROM_DEVICE,   DMA_FROM_DEVICE);
0171   BLANK();
0172   DEFINE(CACHE_WRITEBACK_ORDER, __CACHE_WRITEBACK_ORDER);
0173   DEFINE(CACHE_WRITEBACK_GRANULE, __CACHE_WRITEBACK_GRANULE);
0174   BLANK();
0175 #ifdef CONFIG_KVM_ARM_HOST
0176   DEFINE(VCPU_GUEST_CTXT,   offsetof(struct kvm_vcpu, arch.ctxt));
0177   DEFINE(VCPU_HOST_CTXT,    offsetof(struct kvm_vcpu, arch.host_cpu_context));
0178   DEFINE(CPU_CTXT_VFP,      offsetof(struct kvm_cpu_context, vfp));
0179   DEFINE(CPU_CTXT_GP_REGS,  offsetof(struct kvm_cpu_context, gp_regs));
0180   DEFINE(GP_REGS_USR,       offsetof(struct kvm_regs, usr_regs));
0181 #endif
0182   BLANK();
0183 #ifdef CONFIG_VDSO
0184   DEFINE(VDSO_DATA_SIZE,    sizeof(union vdso_data_store));
0185 #endif
0186   return 0; 
0187 }