162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/stddef.h> 762306a36Sopenharmony_ci#include <linux/sched.h> 862306a36Sopenharmony_ci#include <linux/kernel_stat.h> 962306a36Sopenharmony_ci#include <linux/ptrace.h> 1062306a36Sopenharmony_ci#include <linux/hardirq.h> 1162306a36Sopenharmony_ci#include <linux/thread_info.h> 1262306a36Sopenharmony_ci#include <linux/kbuild.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciint main(void) 1562306a36Sopenharmony_ci{ 1662306a36Sopenharmony_ci /* struct task_struct */ 1762306a36Sopenharmony_ci OFFSET(TASK_THREAD, task_struct, thread); 1862306a36Sopenharmony_ci BLANK(); 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci /* struct thread_struct */ 2162306a36Sopenharmony_ci OFFSET(THREAD_KSP, thread_struct, ksp); 2262306a36Sopenharmony_ci OFFSET(THREAD_KPSR, thread_struct, kpsr); 2362306a36Sopenharmony_ci BLANK(); 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci /* struct pt_regs */ 2662306a36Sopenharmony_ci OFFSET(PT_ORIG_R2, pt_regs, orig_r2); 2762306a36Sopenharmony_ci OFFSET(PT_ORIG_R7, pt_regs, orig_r7); 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci OFFSET(PT_R1, pt_regs, r1); 3062306a36Sopenharmony_ci OFFSET(PT_R2, pt_regs, r2); 3162306a36Sopenharmony_ci OFFSET(PT_R3, pt_regs, r3); 3262306a36Sopenharmony_ci OFFSET(PT_R4, pt_regs, r4); 3362306a36Sopenharmony_ci OFFSET(PT_R5, pt_regs, r5); 3462306a36Sopenharmony_ci OFFSET(PT_R6, pt_regs, r6); 3562306a36Sopenharmony_ci OFFSET(PT_R7, pt_regs, r7); 3662306a36Sopenharmony_ci OFFSET(PT_R8, pt_regs, r8); 3762306a36Sopenharmony_ci OFFSET(PT_R9, pt_regs, r9); 3862306a36Sopenharmony_ci OFFSET(PT_R10, pt_regs, r10); 3962306a36Sopenharmony_ci OFFSET(PT_R11, pt_regs, r11); 4062306a36Sopenharmony_ci OFFSET(PT_R12, pt_regs, r12); 4162306a36Sopenharmony_ci OFFSET(PT_R13, pt_regs, r13); 4262306a36Sopenharmony_ci OFFSET(PT_R14, pt_regs, r14); 4362306a36Sopenharmony_ci OFFSET(PT_R15, pt_regs, r15); 4462306a36Sopenharmony_ci OFFSET(PT_EA, pt_regs, ea); 4562306a36Sopenharmony_ci OFFSET(PT_RA, pt_regs, ra); 4662306a36Sopenharmony_ci OFFSET(PT_FP, pt_regs, fp); 4762306a36Sopenharmony_ci OFFSET(PT_SP, pt_regs, sp); 4862306a36Sopenharmony_ci OFFSET(PT_GP, pt_regs, gp); 4962306a36Sopenharmony_ci OFFSET(PT_ESTATUS, pt_regs, estatus); 5062306a36Sopenharmony_ci DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs)); 5162306a36Sopenharmony_ci BLANK(); 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci /* struct switch_stack */ 5462306a36Sopenharmony_ci OFFSET(SW_R16, switch_stack, r16); 5562306a36Sopenharmony_ci OFFSET(SW_R17, switch_stack, r17); 5662306a36Sopenharmony_ci OFFSET(SW_R18, switch_stack, r18); 5762306a36Sopenharmony_ci OFFSET(SW_R19, switch_stack, r19); 5862306a36Sopenharmony_ci OFFSET(SW_R20, switch_stack, r20); 5962306a36Sopenharmony_ci OFFSET(SW_R21, switch_stack, r21); 6062306a36Sopenharmony_ci OFFSET(SW_R22, switch_stack, r22); 6162306a36Sopenharmony_ci OFFSET(SW_R23, switch_stack, r23); 6262306a36Sopenharmony_ci OFFSET(SW_FP, switch_stack, fp); 6362306a36Sopenharmony_ci OFFSET(SW_GP, switch_stack, gp); 6462306a36Sopenharmony_ci OFFSET(SW_RA, switch_stack, ra); 6562306a36Sopenharmony_ci DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack)); 6662306a36Sopenharmony_ci BLANK(); 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci /* struct thread_info */ 6962306a36Sopenharmony_ci OFFSET(TI_FLAGS, thread_info, flags); 7062306a36Sopenharmony_ci OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count); 7162306a36Sopenharmony_ci BLANK(); 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci return 0; 7462306a36Sopenharmony_ci} 75