master
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3 * Author: Hanlu Li <lihanlu@loongson.cn>
4 * Huacai Chen <chenhuacai@loongson.cn>
5 *
6 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
7 */
8#ifndef _ASM_PTRACE_H
9#define _ASM_PTRACE_H
10
11#include <linux/types.h>
12
13#include <stdint.h>
14
15/*
16 * For PTRACE_{POKE,PEEK}USR. 0 - 31 are GPRs,
17 * 32 is syscall's original ARG0, 33 is PC, 34 is BADVADDR.
18 */
19#define GPR_BASE 0
20#define GPR_NUM 32
21#define GPR_END (GPR_BASE + GPR_NUM - 1)
22#define ARG0 (GPR_END + 1)
23#define PC (GPR_END + 2)
24#define BADVADDR (GPR_END + 3)
25
26#define NUM_FPU_REGS 32
27
28struct user_pt_regs {
29 /* Main processor registers. */
30 unsigned long regs[32];
31
32 /* Original syscall arg0. */
33 unsigned long orig_a0;
34
35 /* Special CSR registers. */
36 unsigned long csr_era;
37 unsigned long csr_badv;
38 unsigned long reserved[10];
39} __attribute__((aligned(8)));
40
41struct user_fp_state {
42 uint64_t fpr[32];
43 uint64_t fcc;
44 uint32_t fcsr;
45};
46
47struct user_lsx_state {
48 /* 32 registers, 128 bits width per register. */
49 uint64_t vregs[32*2];
50};
51
52struct user_lasx_state {
53 /* 32 registers, 256 bits width per register. */
54 uint64_t vregs[32*4];
55};
56
57struct user_lbt_state {
58 uint64_t scr[4];
59 uint32_t eflags;
60 uint32_t ftop;
61};
62
63struct user_watch_state {
64 uint64_t dbg_info;
65 struct {
66 uint64_t addr;
67 uint64_t mask;
68 uint32_t ctrl;
69 uint32_t pad;
70 } dbg_regs[8];
71};
72
73struct user_watch_state_v2 {
74 uint64_t dbg_info;
75 struct {
76 uint64_t addr;
77 uint64_t mask;
78 uint32_t ctrl;
79 uint32_t pad;
80 } dbg_regs[14];
81};
82
83#define PTRACE_SYSEMU 0x1f
84#define PTRACE_SYSEMU_SINGLESTEP 0x20
85
86#endif /* _ASM_PTRACE_H */