^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/kernel_stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/kbuild.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <abi/regdef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) int main(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* offsets into the task struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) DEFINE(TASK_STATE, offsetof(struct task_struct, state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) DEFINE(TASK_MM, offsetof(struct task_struct, mm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* offsets into the thread struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) DEFINE(THREAD_KSP, offsetof(struct thread_struct, sp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) DEFINE(THREAD_FESR, offsetof(struct thread_struct, user_fp.fesr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) DEFINE(THREAD_FCR, offsetof(struct thread_struct, user_fp.fcr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) DEFINE(THREAD_FPREG, offsetof(struct thread_struct, user_fp.vr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* offsets into the thread_info struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) DEFINE(TINFO_ADDR_LIMIT, offsetof(struct thread_info, addr_limit));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) DEFINE(TINFO_TP_VALUE, offsetof(struct thread_info, tp_value));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) DEFINE(TINFO_TASK, offsetof(struct thread_info, task));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* offsets into the pt_regs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) DEFINE(PT_PC, offsetof(struct pt_regs, pc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) DEFINE(PT_ORIG_AO, offsetof(struct pt_regs, orig_a0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) DEFINE(PT_SR, offsetof(struct pt_regs, sr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) DEFINE(PT_A0, offsetof(struct pt_regs, a0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) DEFINE(PT_A1, offsetof(struct pt_regs, a1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) DEFINE(PT_A2, offsetof(struct pt_regs, a2));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) DEFINE(PT_A3, offsetof(struct pt_regs, a3));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) DEFINE(PT_REGS0, offsetof(struct pt_regs, regs[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) DEFINE(PT_REGS1, offsetof(struct pt_regs, regs[1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) DEFINE(PT_REGS2, offsetof(struct pt_regs, regs[2]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) DEFINE(PT_REGS3, offsetof(struct pt_regs, regs[3]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) DEFINE(PT_REGS4, offsetof(struct pt_regs, regs[4]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) DEFINE(PT_REGS5, offsetof(struct pt_regs, regs[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) DEFINE(PT_REGS6, offsetof(struct pt_regs, regs[6]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DEFINE(PT_REGS7, offsetof(struct pt_regs, regs[7]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) DEFINE(PT_REGS8, offsetof(struct pt_regs, regs[8]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DEFINE(PT_REGS9, offsetof(struct pt_regs, regs[9]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) DEFINE(PT_R15, offsetof(struct pt_regs, lr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #if defined(__CSKYABIV2__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DEFINE(PT_R16, offsetof(struct pt_regs, exregs[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DEFINE(PT_R17, offsetof(struct pt_regs, exregs[1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DEFINE(PT_R18, offsetof(struct pt_regs, exregs[2]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) DEFINE(PT_R19, offsetof(struct pt_regs, exregs[3]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) DEFINE(PT_R20, offsetof(struct pt_regs, exregs[4]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) DEFINE(PT_R21, offsetof(struct pt_regs, exregs[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) DEFINE(PT_R22, offsetof(struct pt_regs, exregs[6]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) DEFINE(PT_R23, offsetof(struct pt_regs, exregs[7]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) DEFINE(PT_R24, offsetof(struct pt_regs, exregs[8]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) DEFINE(PT_R25, offsetof(struct pt_regs, exregs[9]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) DEFINE(PT_R26, offsetof(struct pt_regs, exregs[10]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) DEFINE(PT_R27, offsetof(struct pt_regs, exregs[11]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) DEFINE(PT_R28, offsetof(struct pt_regs, exregs[12]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) DEFINE(PT_R29, offsetof(struct pt_regs, exregs[13]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) DEFINE(PT_R30, offsetof(struct pt_regs, exregs[14]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) DEFINE(PT_R31, offsetof(struct pt_regs, exregs[15]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) DEFINE(PT_RHI, offsetof(struct pt_regs, rhi));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) DEFINE(PT_RLO, offsetof(struct pt_regs, rlo));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) DEFINE(PT_USP, offsetof(struct pt_regs, usp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) DEFINE(PT_FRAME_SIZE, sizeof(struct pt_regs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* offsets into the irq_cpustat_t struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __softirq_pending));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* signal defines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) DEFINE(SIGSEGV, SIGSEGV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) DEFINE(SIGTRAP, SIGTRAP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }