1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linu !! 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* !! 2 #ifndef _UAPI_ASMAXP_PTRACE_H 3 * Author: Hanlu Li <lihanlu@loongson.cn> !! 3 #define _UAPI_ASMAXP_PTRACE_H 4 * Huacai Chen <chenhuacai@loongson.cn << 5 * << 6 * Copyright (C) 2020-2022 Loongson Technology << 7 */ << 8 #ifndef _UAPI_ASM_PTRACE_H << 9 #define _UAPI_ASM_PTRACE_H << 10 4 11 #include <linux/types.h> << 12 << 13 #ifndef __KERNEL__ << 14 #include <stdint.h> << 15 #endif << 16 5 17 /* 6 /* 18 * For PTRACE_{POKE,PEEK}USR. 0 - 31 are GPRs, !! 7 * This struct defines the way the registers are stored on the 19 * 32 is syscall's original ARG0, 33 is PC, 34 !! 8 * kernel stack during a system call or other kernel entry >> 9 * >> 10 * NOTE! I want to minimize the overhead of system calls, so this >> 11 * struct has as little information as possible. It does not have >> 12 * >> 13 * - floating point regs: the kernel doesn't change those >> 14 * - r9-15: saved by the C compiler >> 15 * >> 16 * This makes "fork()" and "exec()" a bit more complex, but should >> 17 * give us low system call latency. 20 */ 18 */ 21 #define GPR_BASE 0 << 22 #define GPR_NUM 32 << 23 #define GPR_END (GPR_BASE + GPR_NUM - << 24 #define ARG0 (GPR_END + 1) << 25 #define PC (GPR_END + 2) << 26 #define BADVADDR (GPR_END + 3) << 27 << 28 #define NUM_FPU_REGS 32 << 29 << 30 struct user_pt_regs { << 31 /* Main processor registers. */ << 32 unsigned long regs[32]; << 33 << 34 /* Original syscall arg0. */ << 35 unsigned long orig_a0; << 36 << 37 /* Special CSR registers. */ << 38 unsigned long csr_era; << 39 unsigned long csr_badv; << 40 unsigned long reserved[10]; << 41 } __attribute__((aligned(8))); << 42 << 43 struct user_fp_state { << 44 uint64_t fpr[32]; << 45 uint64_t fcc; << 46 uint32_t fcsr; << 47 }; << 48 << 49 struct user_lsx_state { << 50 /* 32 registers, 128 bits width per re << 51 uint64_t vregs[32*2]; << 52 }; << 53 << 54 struct user_lasx_state { << 55 /* 32 registers, 256 bits width per re << 56 uint64_t vregs[32*4]; << 57 }; << 58 19 59 struct user_lbt_state { !! 20 struct pt_regs { 60 uint64_t scr[4]; !! 21 unsigned long r0; 61 uint32_t eflags; !! 22 unsigned long r1; 62 uint32_t ftop; !! 23 unsigned long r2; >> 24 unsigned long r3; >> 25 unsigned long r4; >> 26 unsigned long r5; >> 27 unsigned long r6; >> 28 unsigned long r7; >> 29 unsigned long r8; >> 30 unsigned long r19; >> 31 unsigned long r20; >> 32 unsigned long r21; >> 33 unsigned long r22; >> 34 unsigned long r23; >> 35 unsigned long r24; >> 36 unsigned long r25; >> 37 unsigned long r26; >> 38 unsigned long r27; >> 39 unsigned long r28; >> 40 unsigned long hae; >> 41 /* JRP - These are the values provided to a0-a2 by PALcode */ >> 42 unsigned long trap_a0; >> 43 unsigned long trap_a1; >> 44 unsigned long trap_a2; >> 45 /* These are saved by PAL-code: */ >> 46 unsigned long ps; >> 47 unsigned long pc; >> 48 unsigned long gp; >> 49 unsigned long r16; >> 50 unsigned long r17; >> 51 unsigned long r18; 63 }; 52 }; 64 53 65 struct user_watch_state { !! 54 /* 66 uint64_t dbg_info; !! 55 * This is the extended stack used by signal handlers and the context 67 struct { !! 56 * switcher: it's pushed after the normal "struct pt_regs". 68 uint64_t addr; !! 57 */ 69 uint64_t mask; !! 58 struct switch_stack { 70 uint32_t ctrl; !! 59 unsigned long r9; 71 uint32_t pad; !! 60 unsigned long r10; 72 } dbg_regs[8]; !! 61 unsigned long r11; >> 62 unsigned long r12; >> 63 unsigned long r13; >> 64 unsigned long r14; >> 65 unsigned long r15; >> 66 unsigned long r26; >> 67 #ifndef __KERNEL__ >> 68 unsigned long fp[32]; /* fp[31] is fpcr */ >> 69 #endif 73 }; 70 }; 74 71 75 #define PTRACE_SYSEMU 0x1f << 76 #define PTRACE_SYSEMU_SINGLESTEP 0x20 << 77 72 78 #endif /* _UAPI_ASM_PTRACE_H */ !! 73 #endif /* _UAPI_ASMAXP_PTRACE_H */ 79 74
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.