blob: ff9ae82fd13ae2b2f4008cd359c3a6a6982327aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/* $NetBSD: netbsd32_machdep.h,v 1.25 2019/11/27 09:16:58 rin Exp $ */
#ifndef _MACHINE_NETBSD32_H_
#define _MACHINE_NETBSD32_H_
#include <sys/ucontext.h>
#include <compat/sys/ucontext.h>
#include <compat/sys/siginfo.h>
#include <x86/fpu.h>
/*
* i386 ptrace constants
* Please keep in sync with sys/arch/i386/include/ptrace.h.
*/
#define PT32_STEP (PT_FIRSTMACH + 0)
#define PT32_GETREGS (PT_FIRSTMACH + 1)
#define PT32_SETREGS (PT_FIRSTMACH + 2)
#define PT32_GETFPREGS (PT_FIRSTMACH + 3)
#define PT32_SETFPREGS (PT_FIRSTMACH + 4)
#define PT32_GETXMMREGS (PT_FIRSTMACH + 5)
#define PT32_SETXMMREGS (PT_FIRSTMACH + 6)
#define PT32_GETDBREGS (PT_FIRSTMACH + 7)
#define PT32_SETDBREGS (PT_FIRSTMACH + 8)
#define PT32_SETSTEP (PT_FIRSTMACH + 9)
#define PT32_CLEARSTEP (PT_FIRSTMACH + 10)
#define PT32_GETXSTATE (PT_FIRSTMACH + 11)
#define PT32_SETXSTATE (PT_FIRSTMACH + 12)
#define NETBSD32_POINTER_TYPE uint32_t
typedef struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
/* i386 has 32bit aligned 64bit integers */
#define NETBSD32_INT64_ALIGN __attribute__((__aligned__(4)))
typedef netbsd32_pointer_t netbsd32_sigcontextp_t;
struct netbsd32_sigcontext13 {
uint32_t sc_gs;
uint32_t sc_fs;
uint32_t sc_es;
uint32_t sc_ds;
uint32_t sc_edi;
uint32_t sc_esi;
uint32_t sc_ebp;
uint32_t sc_ebx;
uint32_t sc_edx;
uint32_t sc_ecx;
uint32_t sc_eax;
/* XXX */
uint32_t sc_eip;
uint32_t sc_cs;
uint32_t sc_eflags;
uint32_t sc_esp;
uint32_t sc_ss;
uint32_t sc_onstack; /* sigstack state to restore */
uint32_t sc_mask; /* signal mask to restore (old style) */
uint32_t sc_trapno; /* XXX should be above */
uint32_t sc_err;
};
struct netbsd32_sigcontext {
uint32_t sc_gs;
uint32_t sc_fs;
uint32_t sc_es;
uint32_t sc_ds;
uint32_t sc_edi;
uint32_t sc_esi;
uint32_t sc_ebp;
uint32_t sc_ebx;
uint32_t sc_edx;
uint32_t sc_ecx;
uint32_t sc_eax;
/* XXX */
uint32_t sc_eip;
uint32_t sc_cs;
uint32_t sc_eflags;
uint32_t sc_esp;
uint32_t sc_ss;
uint32_t sc_onstack; /* sigstack state to restore */
uint32_t __sc_mask13; /* signal mask to restore (old style) */
uint32_t sc_trapno; /* XXX should be above */
uint32_t sc_err;
sigset_t sc_mask; /* signal mask to restore (new style) */
};
#define sc_sp sc_esp
#define sc_fp sc_ebp
#define sc_pc sc_eip
#define sc_ps sc_eflags
struct netbsd32_sigframe_sigcontext {
uint32_t sf_ra;
int32_t sf_signum;
int32_t sf_code;
uint32_t sf_scp;
struct netbsd32_sigcontext sf_sc;
};
struct netbsd32_sigframe_siginfo {
uint32_t sf_ra;
int32_t sf_signum;
uint32_t sf_sip;
uint32_t sf_ucp;
siginfo32_t sf_si;
ucontext32_t sf_uc;
};
struct reg32 {
int r_eax;
int r_ecx;
int r_edx;
int r_ebx;
int r_esp;
int r_ebp;
int r_esi;
int r_edi;
int r_eip;
int r_eflags;
int r_cs;
int r_ss;
int r_ds;
int r_es;
int r_fs;
int r_gs;
};
struct fpreg32 {
char __data[108];
};
struct dbreg32 {
int dr[8];
};
struct xmmregs32 {
struct fxsave fxstate;
};
__CTASSERT(sizeof(struct xmmregs32) == 512);
struct x86_get_ldt_args32 {
int32_t start;
uint32_t desc;
int32_t num;
};
struct x86_set_ldt_args32 {
int32_t start;
uint32_t desc;
int32_t num;
};
struct mtrr32 {
uint64_t base;
uint64_t len;
uint8_t type;
uint8_t __pad0[3];
int flags;
uint32_t owner;
} __packed;
struct x86_64_get_mtrr_args32 {
uint32_t mtrrp;
uint32_t n;
};
struct x86_64_set_mtrr_args32 {
uint32_t mtrrp;
uint32_t n;
};
#define NETBSD32_MID_MACHINE MID_I386
/* Translate ptrace() PT_* request from 32-bit userland to kernel. */
int netbsd32_ptrace_translate_request(int);
int netbsd32_process_read_regs(struct lwp *, struct reg32 *);
int netbsd32_process_read_fpregs(struct lwp *, struct fpreg32 *, size_t *);
int netbsd32_process_read_dbregs(struct lwp *, struct dbreg32 *, size_t *);
int netbsd32_process_write_regs(struct lwp *, const struct reg32 *);
int netbsd32_process_write_fpregs(struct lwp *, const struct fpreg32 *, size_t);
int netbsd32_process_write_dbregs(struct lwp *, const struct dbreg32 *, size_t);
#endif /* _MACHINE_NETBSD32_H_ */
|