1735ee005SGuo Ren // SPDX-License-Identifier: GPL-2.0 2735ee005SGuo Ren // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3735ee005SGuo Ren 4735ee005SGuo Ren #include <linux/sched.h> 5735ee005SGuo Ren #include <linux/kernel_stat.h> 6735ee005SGuo Ren #include <linux/kbuild.h> 7735ee005SGuo Ren #include <abi/regdef.h> 8735ee005SGuo Ren 9735ee005SGuo Ren int main(void) 10735ee005SGuo Ren { 11735ee005SGuo Ren /* offsets into the task struct */ 12735ee005SGuo Ren DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack)); 13735ee005SGuo Ren DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags)); 14735ee005SGuo Ren DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); 15735ee005SGuo Ren DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 16735ee005SGuo Ren DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 17735ee005SGuo Ren DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); 18735ee005SGuo Ren 19735ee005SGuo Ren /* offsets into the thread struct */ 20*67002814SGuo Ren DEFINE(THREAD_KSP, offsetof(struct thread_struct, sp)); 21735ee005SGuo Ren DEFINE(THREAD_FESR, offsetof(struct thread_struct, user_fp.fesr)); 22735ee005SGuo Ren DEFINE(THREAD_FCR, offsetof(struct thread_struct, user_fp.fcr)); 23735ee005SGuo Ren DEFINE(THREAD_FPREG, offsetof(struct thread_struct, user_fp.vr)); 24735ee005SGuo Ren 25735ee005SGuo Ren /* offsets into the thread_info struct */ 26735ee005SGuo Ren DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags)); 27735ee005SGuo Ren DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count)); 28735ee005SGuo Ren DEFINE(TINFO_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); 29735ee005SGuo Ren DEFINE(TINFO_TP_VALUE, offsetof(struct thread_info, tp_value)); 30735ee005SGuo Ren DEFINE(TINFO_TASK, offsetof(struct thread_info, task)); 31735ee005SGuo Ren 32735ee005SGuo Ren /* offsets into the pt_regs */ 33735ee005SGuo Ren DEFINE(PT_PC, offsetof(struct pt_regs, pc)); 34735ee005SGuo Ren DEFINE(PT_ORIG_AO, offsetof(struct pt_regs, orig_a0)); 35735ee005SGuo Ren DEFINE(PT_SR, offsetof(struct pt_regs, sr)); 36735ee005SGuo Ren 37735ee005SGuo Ren DEFINE(PT_A0, offsetof(struct pt_regs, a0)); 38735ee005SGuo Ren DEFINE(PT_A1, offsetof(struct pt_regs, a1)); 39735ee005SGuo Ren DEFINE(PT_A2, offsetof(struct pt_regs, a2)); 40735ee005SGuo Ren DEFINE(PT_A3, offsetof(struct pt_regs, a3)); 41735ee005SGuo Ren DEFINE(PT_REGS0, offsetof(struct pt_regs, regs[0])); 42735ee005SGuo Ren DEFINE(PT_REGS1, offsetof(struct pt_regs, regs[1])); 43735ee005SGuo Ren DEFINE(PT_REGS2, offsetof(struct pt_regs, regs[2])); 44735ee005SGuo Ren DEFINE(PT_REGS3, offsetof(struct pt_regs, regs[3])); 45735ee005SGuo Ren DEFINE(PT_REGS4, offsetof(struct pt_regs, regs[4])); 46735ee005SGuo Ren DEFINE(PT_REGS5, offsetof(struct pt_regs, regs[5])); 47735ee005SGuo Ren DEFINE(PT_REGS6, offsetof(struct pt_regs, regs[6])); 48735ee005SGuo Ren DEFINE(PT_REGS7, offsetof(struct pt_regs, regs[7])); 49735ee005SGuo Ren DEFINE(PT_REGS8, offsetof(struct pt_regs, regs[8])); 50735ee005SGuo Ren DEFINE(PT_REGS9, offsetof(struct pt_regs, regs[9])); 51735ee005SGuo Ren DEFINE(PT_R15, offsetof(struct pt_regs, lr)); 52735ee005SGuo Ren #if defined(__CSKYABIV2__) 53735ee005SGuo Ren DEFINE(PT_R16, offsetof(struct pt_regs, exregs[0])); 54735ee005SGuo Ren DEFINE(PT_R17, offsetof(struct pt_regs, exregs[1])); 55735ee005SGuo Ren DEFINE(PT_R18, offsetof(struct pt_regs, exregs[2])); 56735ee005SGuo Ren DEFINE(PT_R19, offsetof(struct pt_regs, exregs[3])); 57735ee005SGuo Ren DEFINE(PT_R20, offsetof(struct pt_regs, exregs[4])); 58735ee005SGuo Ren DEFINE(PT_R21, offsetof(struct pt_regs, exregs[5])); 59735ee005SGuo Ren DEFINE(PT_R22, offsetof(struct pt_regs, exregs[6])); 60735ee005SGuo Ren DEFINE(PT_R23, offsetof(struct pt_regs, exregs[7])); 61735ee005SGuo Ren DEFINE(PT_R24, offsetof(struct pt_regs, exregs[8])); 62735ee005SGuo Ren DEFINE(PT_R25, offsetof(struct pt_regs, exregs[9])); 63735ee005SGuo Ren DEFINE(PT_R26, offsetof(struct pt_regs, exregs[10])); 64735ee005SGuo Ren DEFINE(PT_R27, offsetof(struct pt_regs, exregs[11])); 65735ee005SGuo Ren DEFINE(PT_R28, offsetof(struct pt_regs, exregs[12])); 66735ee005SGuo Ren DEFINE(PT_R29, offsetof(struct pt_regs, exregs[13])); 67735ee005SGuo Ren DEFINE(PT_R30, offsetof(struct pt_regs, exregs[14])); 68735ee005SGuo Ren DEFINE(PT_R31, offsetof(struct pt_regs, exregs[15])); 69735ee005SGuo Ren DEFINE(PT_RHI, offsetof(struct pt_regs, rhi)); 70735ee005SGuo Ren DEFINE(PT_RLO, offsetof(struct pt_regs, rlo)); 71735ee005SGuo Ren #endif 72735ee005SGuo Ren DEFINE(PT_USP, offsetof(struct pt_regs, usp)); 7389a3927aSGuo Ren DEFINE(PT_FRAME_SIZE, sizeof(struct pt_regs)); 74735ee005SGuo Ren 75735ee005SGuo Ren /* offsets into the irq_cpustat_t struct */ 76735ee005SGuo Ren DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, 77735ee005SGuo Ren __softirq_pending)); 78735ee005SGuo Ren 79735ee005SGuo Ren /* signal defines */ 80735ee005SGuo Ren DEFINE(SIGSEGV, SIGSEGV); 81735ee005SGuo Ren DEFINE(SIGTRAP, SIGTRAP); 82735ee005SGuo Ren 83735ee005SGuo Ren return 0; 84735ee005SGuo Ren } 85