1*1ccea77eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
239b505cbSLey Foon Tan /*
339b505cbSLey Foon Tan * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
439b505cbSLey Foon Tan */
539b505cbSLey Foon Tan
639b505cbSLey Foon Tan #include <linux/stddef.h>
739b505cbSLey Foon Tan #include <linux/sched.h>
839b505cbSLey Foon Tan #include <linux/kernel_stat.h>
939b505cbSLey Foon Tan #include <linux/ptrace.h>
1039b505cbSLey Foon Tan #include <linux/hardirq.h>
1139b505cbSLey Foon Tan #include <linux/thread_info.h>
1239b505cbSLey Foon Tan #include <linux/kbuild.h>
1339b505cbSLey Foon Tan
main(void)1439b505cbSLey Foon Tan int main(void)
1539b505cbSLey Foon Tan {
1639b505cbSLey Foon Tan /* struct task_struct */
1739b505cbSLey Foon Tan OFFSET(TASK_THREAD, task_struct, thread);
1839b505cbSLey Foon Tan BLANK();
1939b505cbSLey Foon Tan
2039b505cbSLey Foon Tan /* struct thread_struct */
2139b505cbSLey Foon Tan OFFSET(THREAD_KSP, thread_struct, ksp);
2239b505cbSLey Foon Tan OFFSET(THREAD_KPSR, thread_struct, kpsr);
2339b505cbSLey Foon Tan BLANK();
2439b505cbSLey Foon Tan
2539b505cbSLey Foon Tan /* struct pt_regs */
2639b505cbSLey Foon Tan OFFSET(PT_ORIG_R2, pt_regs, orig_r2);
2739b505cbSLey Foon Tan OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
2839b505cbSLey Foon Tan
2939b505cbSLey Foon Tan OFFSET(PT_R1, pt_regs, r1);
3039b505cbSLey Foon Tan OFFSET(PT_R2, pt_regs, r2);
3139b505cbSLey Foon Tan OFFSET(PT_R3, pt_regs, r3);
3239b505cbSLey Foon Tan OFFSET(PT_R4, pt_regs, r4);
3339b505cbSLey Foon Tan OFFSET(PT_R5, pt_regs, r5);
3439b505cbSLey Foon Tan OFFSET(PT_R6, pt_regs, r6);
3539b505cbSLey Foon Tan OFFSET(PT_R7, pt_regs, r7);
3639b505cbSLey Foon Tan OFFSET(PT_R8, pt_regs, r8);
3739b505cbSLey Foon Tan OFFSET(PT_R9, pt_regs, r9);
3839b505cbSLey Foon Tan OFFSET(PT_R10, pt_regs, r10);
3939b505cbSLey Foon Tan OFFSET(PT_R11, pt_regs, r11);
4039b505cbSLey Foon Tan OFFSET(PT_R12, pt_regs, r12);
4139b505cbSLey Foon Tan OFFSET(PT_R13, pt_regs, r13);
4239b505cbSLey Foon Tan OFFSET(PT_R14, pt_regs, r14);
4339b505cbSLey Foon Tan OFFSET(PT_R15, pt_regs, r15);
4439b505cbSLey Foon Tan OFFSET(PT_EA, pt_regs, ea);
4539b505cbSLey Foon Tan OFFSET(PT_RA, pt_regs, ra);
4639b505cbSLey Foon Tan OFFSET(PT_FP, pt_regs, fp);
4739b505cbSLey Foon Tan OFFSET(PT_SP, pt_regs, sp);
4839b505cbSLey Foon Tan OFFSET(PT_GP, pt_regs, gp);
4939b505cbSLey Foon Tan OFFSET(PT_ESTATUS, pt_regs, estatus);
5039b505cbSLey Foon Tan DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
5139b505cbSLey Foon Tan BLANK();
5239b505cbSLey Foon Tan
5339b505cbSLey Foon Tan /* struct switch_stack */
5439b505cbSLey Foon Tan OFFSET(SW_R16, switch_stack, r16);
5539b505cbSLey Foon Tan OFFSET(SW_R17, switch_stack, r17);
5639b505cbSLey Foon Tan OFFSET(SW_R18, switch_stack, r18);
5739b505cbSLey Foon Tan OFFSET(SW_R19, switch_stack, r19);
5839b505cbSLey Foon Tan OFFSET(SW_R20, switch_stack, r20);
5939b505cbSLey Foon Tan OFFSET(SW_R21, switch_stack, r21);
6039b505cbSLey Foon Tan OFFSET(SW_R22, switch_stack, r22);
6139b505cbSLey Foon Tan OFFSET(SW_R23, switch_stack, r23);
6239b505cbSLey Foon Tan OFFSET(SW_FP, switch_stack, fp);
6339b505cbSLey Foon Tan OFFSET(SW_GP, switch_stack, gp);
6439b505cbSLey Foon Tan OFFSET(SW_RA, switch_stack, ra);
6539b505cbSLey Foon Tan DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
6639b505cbSLey Foon Tan BLANK();
6739b505cbSLey Foon Tan
6839b505cbSLey Foon Tan /* struct thread_info */
6939b505cbSLey Foon Tan OFFSET(TI_FLAGS, thread_info, flags);
7039b505cbSLey Foon Tan OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
7139b505cbSLey Foon Tan BLANK();
7239b505cbSLey Foon Tan
7339b505cbSLey Foon Tan return 0;
7439b505cbSLey Foon Tan }
75