blob: b77dd188dec4c730c45d99b8c25d879e3c043d02 [file] [log] [blame]
Michal Simekc47f10b2009-03-27 14:25:25 +01001/*
Michal Simek627cef42009-05-26 16:30:19 +02002 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
Michal Simekc47f10b2009-03-27 14:25:25 +01003 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/stddef.h>
13#include <linux/sched.h>
14#include <linux/kernel_stat.h>
15#include <linux/ptrace.h>
16#include <linux/hardirq.h>
17#include <linux/thread_info.h>
18#include <linux/kbuild.h>
Michal Simek43f2a6e2010-04-22 07:28:48 +020019#include <asm/cpuinfo.h>
Michal Simekc47f10b2009-03-27 14:25:25 +010020
21int main(int argc, char *argv[])
22{
23 /* struct pt_regs */
24 DEFINE(PT_SIZE, sizeof(struct pt_regs));
25 DEFINE(PT_MSR, offsetof(struct pt_regs, msr));
26 DEFINE(PT_EAR, offsetof(struct pt_regs, ear));
27 DEFINE(PT_ESR, offsetof(struct pt_regs, esr));
28 DEFINE(PT_FSR, offsetof(struct pt_regs, fsr));
29 DEFINE(PT_PC, offsetof(struct pt_regs, pc));
30 DEFINE(PT_R0, offsetof(struct pt_regs, r0));
31 DEFINE(PT_R1, offsetof(struct pt_regs, r1));
32 DEFINE(PT_R2, offsetof(struct pt_regs, r2));
33 DEFINE(PT_R3, offsetof(struct pt_regs, r3));
34 DEFINE(PT_R4, offsetof(struct pt_regs, r4));
35 DEFINE(PT_R5, offsetof(struct pt_regs, r5));
36 DEFINE(PT_R6, offsetof(struct pt_regs, r6));
37 DEFINE(PT_R7, offsetof(struct pt_regs, r7));
38 DEFINE(PT_R8, offsetof(struct pt_regs, r8));
39 DEFINE(PT_R9, offsetof(struct pt_regs, r9));
40 DEFINE(PT_R10, offsetof(struct pt_regs, r10));
41 DEFINE(PT_R11, offsetof(struct pt_regs, r11));
42 DEFINE(PT_R12, offsetof(struct pt_regs, r12));
43 DEFINE(PT_R13, offsetof(struct pt_regs, r13));
44 DEFINE(PT_R14, offsetof(struct pt_regs, r14));
45 DEFINE(PT_R15, offsetof(struct pt_regs, r15));
46 DEFINE(PT_R16, offsetof(struct pt_regs, r16));
47 DEFINE(PT_R17, offsetof(struct pt_regs, r17));
48 DEFINE(PT_R18, offsetof(struct pt_regs, r18));
49 DEFINE(PT_R19, offsetof(struct pt_regs, r19));
50 DEFINE(PT_R20, offsetof(struct pt_regs, r20));
51 DEFINE(PT_R21, offsetof(struct pt_regs, r21));
52 DEFINE(PT_R22, offsetof(struct pt_regs, r22));
53 DEFINE(PT_R23, offsetof(struct pt_regs, r23));
54 DEFINE(PT_R24, offsetof(struct pt_regs, r24));
55 DEFINE(PT_R25, offsetof(struct pt_regs, r25));
56 DEFINE(PT_R26, offsetof(struct pt_regs, r26));
57 DEFINE(PT_R27, offsetof(struct pt_regs, r27));
58 DEFINE(PT_R28, offsetof(struct pt_regs, r28));
59 DEFINE(PT_R29, offsetof(struct pt_regs, r29));
60 DEFINE(PT_R30, offsetof(struct pt_regs, r30));
61 DEFINE(PT_R31, offsetof(struct pt_regs, r31));
Michal Simekac3efab2009-04-16 10:58:47 +020062 DEFINE(PT_MODE, offsetof(struct pt_regs, pt_mode));
Michal Simekc47f10b2009-03-27 14:25:25 +010063 BLANK();
64
65 /* Magic offsets for PTRACE PEEK/POKE etc */
66 DEFINE(PT_TEXT_ADDR, sizeof(struct pt_regs) + 1);
67 DEFINE(PT_TEXT_LEN, sizeof(struct pt_regs) + 2);
68 DEFINE(PT_DATA_ADDR, sizeof(struct pt_regs) + 3);
69 BLANK();
70
71 /* struct task_struct */
72 DEFINE(TS_THREAD_INFO, offsetof(struct task_struct, stack));
Michal Simek627cef42009-05-26 16:30:19 +020073 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
74 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
75 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
76 DEFINE(TASK_MM, offsetof(struct task_struct, mm));
77 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
78 DEFINE(TASK_PID, offsetof(struct task_struct, pid));
79 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
80 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
81 BLANK();
82
83 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
84 BLANK();
Michal Simekc47f10b2009-03-27 14:25:25 +010085
86 /* struct thread_info */
87 DEFINE(TI_TASK, offsetof(struct thread_info, task));
Michal Simekc47f10b2009-03-27 14:25:25 +010088 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
Michal Simekc47f10b2009-03-27 14:25:25 +010089 DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit));
Michal Simekc47f10b2009-03-27 14:25:25 +010090 DEFINE(TI_CPU_CONTEXT, offsetof(struct thread_info, cpu_context));
Michal Simek77753792010-01-12 09:55:10 +010091 DEFINE(TI_PREEMPT_COUNT, offsetof(struct thread_info, preempt_count));
Michal Simekc47f10b2009-03-27 14:25:25 +010092 BLANK();
93
94 /* struct cpu_context */
95 DEFINE(CC_R1, offsetof(struct cpu_context, r1)); /* r1 */
96 DEFINE(CC_R2, offsetof(struct cpu_context, r2));
97 /* dedicated registers */
98 DEFINE(CC_R13, offsetof(struct cpu_context, r13));
99 DEFINE(CC_R14, offsetof(struct cpu_context, r14));
100 DEFINE(CC_R15, offsetof(struct cpu_context, r15));
101 DEFINE(CC_R16, offsetof(struct cpu_context, r16));
102 DEFINE(CC_R17, offsetof(struct cpu_context, r17));
103 DEFINE(CC_R18, offsetof(struct cpu_context, r18));
104 /* non-volatile registers */
105 DEFINE(CC_R19, offsetof(struct cpu_context, r19));
106 DEFINE(CC_R20, offsetof(struct cpu_context, r20));
107 DEFINE(CC_R21, offsetof(struct cpu_context, r21));
108 DEFINE(CC_R22, offsetof(struct cpu_context, r22));
109 DEFINE(CC_R23, offsetof(struct cpu_context, r23));
110 DEFINE(CC_R24, offsetof(struct cpu_context, r24));
111 DEFINE(CC_R25, offsetof(struct cpu_context, r25));
112 DEFINE(CC_R26, offsetof(struct cpu_context, r26));
113 DEFINE(CC_R27, offsetof(struct cpu_context, r27));
114 DEFINE(CC_R28, offsetof(struct cpu_context, r28));
115 DEFINE(CC_R29, offsetof(struct cpu_context, r29));
116 DEFINE(CC_R30, offsetof(struct cpu_context, r30));
117 /* special purpose registers */
118 DEFINE(CC_MSR, offsetof(struct cpu_context, msr));
119 DEFINE(CC_EAR, offsetof(struct cpu_context, ear));
120 DEFINE(CC_ESR, offsetof(struct cpu_context, esr));
121 DEFINE(CC_FSR, offsetof(struct cpu_context, fsr));
122 BLANK();
123
124 return 0;
125}