1 /* 2 * Copyright (C) 2007-2009 PetaLogix 3 * Copyright (C) 2006 Atmark Techno, Inc. 4 * 5 * This file is subject to the terms and conditions of the GNU General Public 6 * License. See the file "COPYING" in the main directory of this archive 7 * for more details. 8 */ 9 10 #include <linux/init.h> 11 #include <linux/stddef.h> 12 #include <linux/sched.h> 13 #include <linux/kernel_stat.h> 14 #include <linux/ptrace.h> 15 #include <linux/hardirq.h> 16 #include <linux/thread_info.h> 17 #include <linux/kbuild.h> 18 19 int main(int argc, char *argv[]) 20 { 21 /* struct pt_regs */ 22 DEFINE(PT_SIZE, sizeof(struct pt_regs)); 23 DEFINE(PT_MSR, offsetof(struct pt_regs, msr)); 24 DEFINE(PT_EAR, offsetof(struct pt_regs, ear)); 25 DEFINE(PT_ESR, offsetof(struct pt_regs, esr)); 26 DEFINE(PT_FSR, offsetof(struct pt_regs, fsr)); 27 DEFINE(PT_PC, offsetof(struct pt_regs, pc)); 28 DEFINE(PT_R0, offsetof(struct pt_regs, r0)); 29 DEFINE(PT_R1, offsetof(struct pt_regs, r1)); 30 DEFINE(PT_R2, offsetof(struct pt_regs, r2)); 31 DEFINE(PT_R3, offsetof(struct pt_regs, r3)); 32 DEFINE(PT_R4, offsetof(struct pt_regs, r4)); 33 DEFINE(PT_R5, offsetof(struct pt_regs, r5)); 34 DEFINE(PT_R6, offsetof(struct pt_regs, r6)); 35 DEFINE(PT_R7, offsetof(struct pt_regs, r7)); 36 DEFINE(PT_R8, offsetof(struct pt_regs, r8)); 37 DEFINE(PT_R9, offsetof(struct pt_regs, r9)); 38 DEFINE(PT_R10, offsetof(struct pt_regs, r10)); 39 DEFINE(PT_R11, offsetof(struct pt_regs, r11)); 40 DEFINE(PT_R12, offsetof(struct pt_regs, r12)); 41 DEFINE(PT_R13, offsetof(struct pt_regs, r13)); 42 DEFINE(PT_R14, offsetof(struct pt_regs, r14)); 43 DEFINE(PT_R15, offsetof(struct pt_regs, r15)); 44 DEFINE(PT_R16, offsetof(struct pt_regs, r16)); 45 DEFINE(PT_R17, offsetof(struct pt_regs, r17)); 46 DEFINE(PT_R18, offsetof(struct pt_regs, r18)); 47 DEFINE(PT_R19, offsetof(struct pt_regs, r19)); 48 DEFINE(PT_R20, offsetof(struct pt_regs, r20)); 49 DEFINE(PT_R21, offsetof(struct pt_regs, r21)); 50 DEFINE(PT_R22, offsetof(struct pt_regs, r22)); 51 DEFINE(PT_R23, offsetof(struct pt_regs, r23)); 52 DEFINE(PT_R24, offsetof(struct pt_regs, r24)); 53 DEFINE(PT_R25, offsetof(struct pt_regs, r25)); 54 DEFINE(PT_R26, offsetof(struct pt_regs, r26)); 55 DEFINE(PT_R27, offsetof(struct pt_regs, r27)); 56 DEFINE(PT_R28, offsetof(struct pt_regs, r28)); 57 DEFINE(PT_R29, offsetof(struct pt_regs, r29)); 58 DEFINE(PT_R30, offsetof(struct pt_regs, r30)); 59 DEFINE(PT_R31, offsetof(struct pt_regs, r31)); 60 DEFINE(PT_MODE, offsetof(struct pt_regs, pt_mode)); 61 BLANK(); 62 63 /* Magic offsets for PTRACE PEEK/POKE etc */ 64 DEFINE(PT_TEXT_ADDR, sizeof(struct pt_regs) + 1); 65 DEFINE(PT_TEXT_LEN, sizeof(struct pt_regs) + 2); 66 DEFINE(PT_DATA_ADDR, sizeof(struct pt_regs) + 3); 67 BLANK(); 68 69 /* struct task_struct */ 70 DEFINE(TS_THREAD_INFO, offsetof(struct task_struct, stack)); 71 72 /* struct thread_info */ 73 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 74 DEFINE(TI_EXEC_DOMAIN, offsetof(struct thread_info, exec_domain)); 75 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 76 DEFINE(TI_STATUS, offsetof(struct thread_info, status)); 77 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 78 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 79 DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); 80 DEFINE(TI_RESTART_BLOCK, offsetof(struct thread_info, restart_block)); 81 DEFINE(TI_CPU_CONTEXT, offsetof(struct thread_info, cpu_context)); 82 BLANK(); 83 84 /* struct cpu_context */ 85 DEFINE(CC_R1, offsetof(struct cpu_context, r1)); /* r1 */ 86 DEFINE(CC_R2, offsetof(struct cpu_context, r2)); 87 /* dedicated registers */ 88 DEFINE(CC_R13, offsetof(struct cpu_context, r13)); 89 DEFINE(CC_R14, offsetof(struct cpu_context, r14)); 90 DEFINE(CC_R15, offsetof(struct cpu_context, r15)); 91 DEFINE(CC_R16, offsetof(struct cpu_context, r16)); 92 DEFINE(CC_R17, offsetof(struct cpu_context, r17)); 93 DEFINE(CC_R18, offsetof(struct cpu_context, r18)); 94 /* non-volatile registers */ 95 DEFINE(CC_R19, offsetof(struct cpu_context, r19)); 96 DEFINE(CC_R20, offsetof(struct cpu_context, r20)); 97 DEFINE(CC_R21, offsetof(struct cpu_context, r21)); 98 DEFINE(CC_R22, offsetof(struct cpu_context, r22)); 99 DEFINE(CC_R23, offsetof(struct cpu_context, r23)); 100 DEFINE(CC_R24, offsetof(struct cpu_context, r24)); 101 DEFINE(CC_R25, offsetof(struct cpu_context, r25)); 102 DEFINE(CC_R26, offsetof(struct cpu_context, r26)); 103 DEFINE(CC_R27, offsetof(struct cpu_context, r27)); 104 DEFINE(CC_R28, offsetof(struct cpu_context, r28)); 105 DEFINE(CC_R29, offsetof(struct cpu_context, r29)); 106 DEFINE(CC_R30, offsetof(struct cpu_context, r30)); 107 /* special purpose registers */ 108 DEFINE(CC_MSR, offsetof(struct cpu_context, msr)); 109 DEFINE(CC_EAR, offsetof(struct cpu_context, ear)); 110 DEFINE(CC_ESR, offsetof(struct cpu_context, esr)); 111 DEFINE(CC_FSR, offsetof(struct cpu_context, fsr)); 112 BLANK(); 113 114 return 0; 115 } 116