18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <linux/sched.h> 58c2ecf20Sopenharmony_ci#include <linux/kernel_stat.h> 68c2ecf20Sopenharmony_ci#include <linux/kbuild.h> 78c2ecf20Sopenharmony_ci#include <abi/regdef.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciint main(void) 108c2ecf20Sopenharmony_ci{ 118c2ecf20Sopenharmony_ci /* offsets into the task struct */ 128c2ecf20Sopenharmony_ci DEFINE(TASK_STATE, offsetof(struct task_struct, state)); 138c2ecf20Sopenharmony_ci DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack)); 148c2ecf20Sopenharmony_ci DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags)); 158c2ecf20Sopenharmony_ci DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); 168c2ecf20Sopenharmony_ci DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 178c2ecf20Sopenharmony_ci DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 188c2ecf20Sopenharmony_ci DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci /* offsets into the thread struct */ 218c2ecf20Sopenharmony_ci DEFINE(THREAD_KSP, offsetof(struct thread_struct, sp)); 228c2ecf20Sopenharmony_ci DEFINE(THREAD_FESR, offsetof(struct thread_struct, user_fp.fesr)); 238c2ecf20Sopenharmony_ci DEFINE(THREAD_FCR, offsetof(struct thread_struct, user_fp.fcr)); 248c2ecf20Sopenharmony_ci DEFINE(THREAD_FPREG, offsetof(struct thread_struct, user_fp.vr)); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci /* offsets into the thread_info struct */ 278c2ecf20Sopenharmony_ci DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags)); 288c2ecf20Sopenharmony_ci DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count)); 298c2ecf20Sopenharmony_ci DEFINE(TINFO_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); 308c2ecf20Sopenharmony_ci DEFINE(TINFO_TP_VALUE, offsetof(struct thread_info, tp_value)); 318c2ecf20Sopenharmony_ci DEFINE(TINFO_TASK, offsetof(struct thread_info, task)); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci /* offsets into the pt_regs */ 348c2ecf20Sopenharmony_ci DEFINE(PT_PC, offsetof(struct pt_regs, pc)); 358c2ecf20Sopenharmony_ci DEFINE(PT_ORIG_AO, offsetof(struct pt_regs, orig_a0)); 368c2ecf20Sopenharmony_ci DEFINE(PT_SR, offsetof(struct pt_regs, sr)); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci DEFINE(PT_A0, offsetof(struct pt_regs, a0)); 398c2ecf20Sopenharmony_ci DEFINE(PT_A1, offsetof(struct pt_regs, a1)); 408c2ecf20Sopenharmony_ci DEFINE(PT_A2, offsetof(struct pt_regs, a2)); 418c2ecf20Sopenharmony_ci DEFINE(PT_A3, offsetof(struct pt_regs, a3)); 428c2ecf20Sopenharmony_ci DEFINE(PT_REGS0, offsetof(struct pt_regs, regs[0])); 438c2ecf20Sopenharmony_ci DEFINE(PT_REGS1, offsetof(struct pt_regs, regs[1])); 448c2ecf20Sopenharmony_ci DEFINE(PT_REGS2, offsetof(struct pt_regs, regs[2])); 458c2ecf20Sopenharmony_ci DEFINE(PT_REGS3, offsetof(struct pt_regs, regs[3])); 468c2ecf20Sopenharmony_ci DEFINE(PT_REGS4, offsetof(struct pt_regs, regs[4])); 478c2ecf20Sopenharmony_ci DEFINE(PT_REGS5, offsetof(struct pt_regs, regs[5])); 488c2ecf20Sopenharmony_ci DEFINE(PT_REGS6, offsetof(struct pt_regs, regs[6])); 498c2ecf20Sopenharmony_ci DEFINE(PT_REGS7, offsetof(struct pt_regs, regs[7])); 508c2ecf20Sopenharmony_ci DEFINE(PT_REGS8, offsetof(struct pt_regs, regs[8])); 518c2ecf20Sopenharmony_ci DEFINE(PT_REGS9, offsetof(struct pt_regs, regs[9])); 528c2ecf20Sopenharmony_ci DEFINE(PT_R15, offsetof(struct pt_regs, lr)); 538c2ecf20Sopenharmony_ci#if defined(__CSKYABIV2__) 548c2ecf20Sopenharmony_ci DEFINE(PT_R16, offsetof(struct pt_regs, exregs[0])); 558c2ecf20Sopenharmony_ci DEFINE(PT_R17, offsetof(struct pt_regs, exregs[1])); 568c2ecf20Sopenharmony_ci DEFINE(PT_R18, offsetof(struct pt_regs, exregs[2])); 578c2ecf20Sopenharmony_ci DEFINE(PT_R19, offsetof(struct pt_regs, exregs[3])); 588c2ecf20Sopenharmony_ci DEFINE(PT_R20, offsetof(struct pt_regs, exregs[4])); 598c2ecf20Sopenharmony_ci DEFINE(PT_R21, offsetof(struct pt_regs, exregs[5])); 608c2ecf20Sopenharmony_ci DEFINE(PT_R22, offsetof(struct pt_regs, exregs[6])); 618c2ecf20Sopenharmony_ci DEFINE(PT_R23, offsetof(struct pt_regs, exregs[7])); 628c2ecf20Sopenharmony_ci DEFINE(PT_R24, offsetof(struct pt_regs, exregs[8])); 638c2ecf20Sopenharmony_ci DEFINE(PT_R25, offsetof(struct pt_regs, exregs[9])); 648c2ecf20Sopenharmony_ci DEFINE(PT_R26, offsetof(struct pt_regs, exregs[10])); 658c2ecf20Sopenharmony_ci DEFINE(PT_R27, offsetof(struct pt_regs, exregs[11])); 668c2ecf20Sopenharmony_ci DEFINE(PT_R28, offsetof(struct pt_regs, exregs[12])); 678c2ecf20Sopenharmony_ci DEFINE(PT_R29, offsetof(struct pt_regs, exregs[13])); 688c2ecf20Sopenharmony_ci DEFINE(PT_R30, offsetof(struct pt_regs, exregs[14])); 698c2ecf20Sopenharmony_ci DEFINE(PT_R31, offsetof(struct pt_regs, exregs[15])); 708c2ecf20Sopenharmony_ci DEFINE(PT_RHI, offsetof(struct pt_regs, rhi)); 718c2ecf20Sopenharmony_ci DEFINE(PT_RLO, offsetof(struct pt_regs, rlo)); 728c2ecf20Sopenharmony_ci#endif 738c2ecf20Sopenharmony_ci DEFINE(PT_USP, offsetof(struct pt_regs, usp)); 748c2ecf20Sopenharmony_ci DEFINE(PT_FRAME_SIZE, sizeof(struct pt_regs)); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* offsets into the irq_cpustat_t struct */ 778c2ecf20Sopenharmony_ci DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, 788c2ecf20Sopenharmony_ci __softirq_pending)); 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci /* signal defines */ 818c2ecf20Sopenharmony_ci DEFINE(SIGSEGV, SIGSEGV); 828c2ecf20Sopenharmony_ci DEFINE(SIGTRAP, SIGTRAP); 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci return 0; 858c2ecf20Sopenharmony_ci} 86