Lines Matching +full:reg +full:- +full:addr
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
116 map_regs_to_linux(struct reg *bsd_r, struct linux_pt_reg *linux_r)
118 linux_r->ebx = bsd_r->r_ebx;
119 linux_r->ecx = bsd_r->r_ecx;
120 linux_r->edx = bsd_r->r_edx;
121 linux_r->esi = bsd_r->r_esi;
122 linux_r->edi = bsd_r->r_edi;
123 linux_r->ebp = bsd_r->r_ebp;
124 linux_r->eax = bsd_r->r_eax;
125 linux_r->xds = bsd_r->r_ds;
126 linux_r->xes = bsd_r->r_es;
127 linux_r->xfs = bsd_r->r_fs;
128 linux_r->xgs = bsd_r->r_gs;
129 linux_r->orig_eax = bsd_r->r_eax;
130 linux_r->eip = bsd_r->r_eip;
131 linux_r->xcs = bsd_r->r_cs;
132 linux_r->eflags = bsd_r->r_eflags;
133 linux_r->esp = bsd_r->r_esp;
134 linux_r->xss = bsd_r->r_ss;
138 map_regs_from_linux(struct reg *bsd_r, struct linux_pt_reg *linux_r)
140 bsd_r->r_ebx = linux_r->ebx;
141 bsd_r->r_ecx = linux_r->ecx;
142 bsd_r->r_edx = linux_r->edx;
143 bsd_r->r_esi = linux_r->esi;
144 bsd_r->r_edi = linux_r->edi;
145 bsd_r->r_ebp = linux_r->ebp;
146 bsd_r->r_eax = linux_r->eax;
147 bsd_r->r_ds = linux_r->xds;
148 bsd_r->r_es = linux_r->xes;
149 bsd_r->r_fs = linux_r->xfs;
150 bsd_r->r_gs = linux_r->xgs;
151 bsd_r->r_eip = linux_r->eip;
152 bsd_r->r_cs = linux_r->xcs;
153 bsd_r->r_eflags = linux_r->eflags;
154 bsd_r->r_esp = linux_r->esp;
155 bsd_r->r_ss = linux_r->xss;
172 linux_r->cwd = bsd_r->fpr_env[0];
173 linux_r->swd = bsd_r->fpr_env[1];
174 linux_r->twd = bsd_r->fpr_env[2];
175 linux_r->fip = bsd_r->fpr_env[3];
176 linux_r->fcs = bsd_r->fpr_env[4];
177 linux_r->foo = bsd_r->fpr_env[5];
178 linux_r->fos = bsd_r->fpr_env[6];
179 bcopy(bsd_r->fpr_acc, linux_r->st_space, sizeof(linux_r->st_space));
185 bsd_r->fpr_env[0] = linux_r->cwd;
186 bsd_r->fpr_env[1] = linux_r->swd;
187 bsd_r->fpr_env[2] = linux_r->twd;
188 bsd_r->fpr_env[3] = linux_r->fip;
189 bsd_r->fpr_env[4] = linux_r->fcs;
190 bsd_r->fpr_env[5] = linux_r->foo;
191 bsd_r->fpr_env[6] = linux_r->fos;
192 bcopy(bsd_r->fpr_acc, linux_r->st_space, sizeof(bsd_r->fpr_acc));
215 PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
218 bcopy(&get_pcb_user_save_td(td)->sv_xmm, fpxregs, sizeof(*fpxregs));
226 PROC_LOCK_ASSERT(td->td_proc, MA_OWNED);
229 bcopy(fpxregs, &get_pcb_user_save_td(td)->sv_xmm, sizeof(*fpxregs));
237 struct linux_pt_reg reg;
242 struct reg bsd_reg;
246 void *addr;
253 req = uap->req;
254 pid = (pid_t)uap->pid;
255 addr = (void *)uap->addr;
262 error = kern_ptrace(td, req, pid, addr, uap->data);
267 int rval = td->td_retval[0];
268 error = kern_ptrace(td, req, pid, addr, 0);
270 error = copyout(td->td_retval, (void *)uap->data,
272 td->td_retval[0] = rval;
277 map_signum(uap->data));
282 map_signum(uap->data));
285 error = kern_ptrace(td, PT_ATTACH, pid, addr, uap->data);
288 /* Linux is using data where FreeBSD is using addr */
291 map_regs_to_linux(&u.bsd_reg, &r.reg);
292 error = copyout(&r.reg, (void *)uap->data,
293 sizeof(r.reg));
297 /* Linux is using data where FreeBSD is using addr */
298 error = copyin((void *)uap->data, &r.reg, sizeof(r.reg));
300 map_regs_from_linux(&u.bsd_reg, &r.reg);
305 /* Linux is using data where FreeBSD is using addr */
309 error = copyout(&r.fpreg, (void *)uap->data,
314 /* Linux is using data where FreeBSD is using addr */
315 error = copyin((void *)uap->data, &r.fpreg, sizeof(r.fpreg));
323 error = copyin((void *)uap->data, &r.fpxreg, sizeof(r.fpxreg));
341 if ((p = pfind(uap->pid)) == NULL) {
347 if ((p->p_flag & P_WEXIT) != 0) {
356 if ((p->p_flag & P_SYSTEM) != 0) {
362 if ((p->p_flag & P_TRACED) == 0) {
368 if (p->p_pptr != td->td_proc) {
374 if (!P_SHOULDSTOP(p) || (p->p_flag & P_WAITED) == 0) {
386 error = copyout(&r.fpxreg, (void *)uap->data,
407 /* check addr for alignment */
408 if (uap->addr < 0 || uap->addr & (sizeof(l_int) - 1))
415 if (uap->addr < sizeof(struct linux_pt_reg)) {
420 map_regs_to_linux(&u.bsd_reg, &r.reg);
422 error = copyout((char *)&r.reg + uap->addr,
423 (void *)uap->data, sizeof(l_int));
427 *(l_int *)((char *)&r.reg + uap->addr) =
428 (l_int)uap->data;
430 map_regs_from_linux(&u.bsd_reg, &r.reg);
437 if (uap->addr >= LINUX_DBREG_OFFSET &&
438 uap->addr <= LINUX_DBREG_OFFSET + LINUX_DBREG_SIZE) {
444 uap->addr -= LINUX_DBREG_OFFSET;
447 uap->addr, (void *)uap->data,
452 *(l_int *)((char *)&u.bsd_dbreg + uap->addr) =
453 uap->data;
464 (unsigned int)uap->req);