diff options
author | jhb <jhb@FreeBSD.org> | 2001-06-29 11:10:41 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-06-29 11:10:41 +0000 |
commit | d82893e6762433665a192f6ffe2dad2a1a6c0678 (patch) | |
tree | cb74fd6ffd13686b7602fd19e3756d344a7b64e2 /sys/amd64 | |
parent | 11807e464b0264daf76c2429a84420f80a6605d1 (diff) | |
download | FreeBSD-src-d82893e6762433665a192f6ffe2dad2a1a6c0678.zip FreeBSD-src-d82893e6762433665a192f6ffe2dad2a1a6c0678.tar.gz |
Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.
Reviewed by: jake (in principle)
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 26 | ||||
-rw-r--r-- | sys/amd64/amd64/mem.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 16 | ||||
-rw-r--r-- | sys/amd64/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/amd64/include/proc.h | 1 |
6 files changed, 28 insertions, 29 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 90ab77c..ed4ebb5 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -467,7 +467,7 @@ osendsig(catcher, sig, mask, code) p = curproc; PROC_LOCK(p); psp = p->p_sigacts; - regs = p->p_md.md_regs; + regs = p->p_frame; oonstack = sigonstack(regs->tf_esp); /* Allocate and validate space for the signal handler context. */ @@ -617,7 +617,7 @@ sendsig(catcher, sig, mask, code) osendsig(catcher, sig, mask, code); return; } - regs = p->p_md.md_regs; + regs = p->p_frame; oonstack = sigonstack(regs->tf_esp); /* Save user context. */ @@ -764,7 +764,7 @@ osigreturn(p, uap) struct osigcontext *scp; int eflags; - regs = p->p_md.md_regs; + regs = p->p_frame; scp = uap->sigcntxp; if (!useracc((caddr_t)scp, sizeof(*scp), VM_PROT_READ)) return (EFAULT); @@ -889,7 +889,7 @@ sigreturn(p, uap) if (!useracc((caddr_t)ucp, sizeof(*ucp), VM_PROT_READ)) return (EFAULT); - regs = p->p_md.md_regs; + regs = p->p_frame; eflags = ucp->uc_mcontext.mc_eflags; if (eflags & PSL_VM) { struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; @@ -1035,7 +1035,7 @@ setregs(p, entry, stack, ps_strings) u_long stack; u_long ps_strings; { - struct trapframe *regs = p->p_md.md_regs; + struct trapframe *regs = p->p_frame; struct pcb *pcb = &p->p_addr->u_pcb; if (pcb->pcb_ldt) @@ -2034,7 +2034,7 @@ init386(first) proc0.p_addr->u_pcb.pcb_flags = 0; proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; proc0.p_addr->u_pcb.pcb_ext = 0; - proc0.p_md.md_regs = &proc0_tf; + proc0.p_frame = &proc0_tf; } #if defined(I586_CPU) && !defined(NO_F00F_HACK) @@ -2081,7 +2081,7 @@ ptrace_set_pc(p, addr) struct proc *p; unsigned long addr; { - p->p_md.md_regs->tf_eip = addr; + p->p_frame->tf_eip = addr; return (0); } @@ -2089,7 +2089,7 @@ int ptrace_single_step(p) struct proc *p; { - p->p_md.md_regs->tf_eflags |= PSL_T; + p->p_frame->tf_eflags |= PSL_T; return (0); } @@ -2105,7 +2105,7 @@ int ptrace_read_u_check(p, addr, len) if ((vm_offset_t) (addr + len) <= sizeof(struct user)) return 0; - gap = (char *) p->p_md.md_regs - (char *) p->p_addr; + gap = (char *) p->p_frame - (char *) p->p_addr; if ((vm_offset_t) addr < gap) return EPERM; @@ -2128,9 +2128,9 @@ int ptrace_write_u(p, off, data) * Privileged kernel state is scattered all over the user area. * Only allow write access to parts of regs and to fpregs. */ - min = (char *)p->p_md.md_regs - (char *)p->p_addr; + min = (char *)p->p_frame - (char *)p->p_addr; if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) { - tp = p->p_md.md_regs; + tp = p->p_frame; frame_copy = *tp; *(int *)((char *)&frame_copy + (off - min)) = data; if (!EFL_SECURE(frame_copy.tf_eflags, tp->tf_eflags) || @@ -2155,7 +2155,7 @@ fill_regs(p, regs) struct pcb *pcb; struct trapframe *tp; - tp = p->p_md.md_regs; + tp = p->p_frame; regs->r_fs = tp->tf_fs; regs->r_es = tp->tf_es; regs->r_ds = tp->tf_ds; @@ -2184,7 +2184,7 @@ set_regs(p, regs) struct pcb *pcb; struct trapframe *tp; - tp = p->p_md.md_regs; + tp = p->p_frame; if (!EFL_SECURE(regs->r_eflags, tp->tf_eflags) || !CS_SECURE(regs->r_cs)) return (EINVAL); diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 13023b8..dfb034e 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -102,7 +102,7 @@ mmclose(dev_t dev, int flags, int fmt, struct proc *p) { switch (minor(dev)) { case 14: - p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; + p->p_frame->tf_eflags &= ~PSL_IOPL; } return (0); } @@ -124,7 +124,7 @@ mmopen(dev_t dev, int flags, int fmt, struct proc *p) return (error); if (securelevel > 0) return (EPERM); - p->p_md.md_regs->tf_eflags |= PSL_IOPL; + p->p_frame->tf_eflags |= PSL_IOPL; break; } return (0); diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 09cc034..f6a9e0c 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -277,7 +277,7 @@ restart: mtx_lock_spin(&sched_lock); sticks = p->p_sticks; mtx_unlock_spin(&sched_lock); - p->p_md.md_regs = &frame; + p->p_frame = &frame; switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ @@ -1095,7 +1095,7 @@ syscall(frame) sticks = p->p_sticks; mtx_unlock_spin(&sched_lock); - p->p_md.md_regs = &frame; + p->p_frame = &frame; params = (caddr_t)frame.tf_esp + sizeof(int); code = frame.tf_eax; @@ -1279,7 +1279,7 @@ ast(framep) } sticks = p->p_sticks; - p->p_md.md_regs = framep; + p->p_frame = framep; astoff(p); cnt.v_soft++; diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 89762bc..40ae8cd 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -161,13 +161,13 @@ cpu_fork(p1, p2, flags) * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - p2->p_md.md_regs = (struct trapframe *) + p2->p_frame = (struct trapframe *) ((int)p2->p_addr + UPAGES * PAGE_SIZE - 16) - 1; - bcopy(p1->p_md.md_regs, p2->p_md.md_regs, sizeof(*p2->p_md.md_regs)); + bcopy(p1->p_frame, p2->p_frame, sizeof(struct trapframe)); - p2->p_md.md_regs->tf_eax = 0; /* Child returns zero */ - p2->p_md.md_regs->tf_eflags &= ~PSL_C; /* success */ - p2->p_md.md_regs->tf_edx = 1; + p2->p_frame->tf_eax = 0; /* Child returns zero */ + p2->p_frame->tf_eflags &= ~PSL_C; /* success */ + p2->p_frame->tf_edx = 1; /* * Set registers for trampoline to user mode. Leave space for the @@ -177,7 +177,7 @@ cpu_fork(p1, p2, flags) pcb2->pcb_edi = 0; pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)p2->p_md.md_regs - sizeof(void *); + pcb2->pcb_esp = (int)p2->p_frame - sizeof(void *); pcb2->pcb_ebx = (int)p2; /* fork_trampoline argument */ pcb2->pcb_eip = (int)fork_trampoline; /*- @@ -319,8 +319,8 @@ cpu_coredump(p, vp, cred) return EINVAL; bcopy(p->p_addr, tempuser, sizeof(struct user)); - bcopy(p->p_md.md_regs, - tempuser + ((caddr_t) p->p_md.md_regs - (caddr_t) p->p_addr), + bcopy(p->p_frame, + tempuser + ((caddr_t) p->p_frame - (caddr_t) p->p_addr), sizeof(struct trapframe)); error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 29b34ee..90643aa 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -56,8 +56,8 @@ #define cpu_exec(p) /* nothing */ #define cpu_swapin(p) /* nothing */ -#define cpu_getstack(p) ((p)->p_md.md_regs->tf_esp) -#define cpu_setstack(p, ap) ((p)->p_md.md_regs->tf_esp = (ap)) +#define cpu_getstack(p) ((p)->p_frame->tf_esp) +#define cpu_setstack(p, ap) ((p)->p_frame->tf_esp = (ap)) #define TRAPF_USERMODE(framep) \ ((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM)) diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index bc2679e..4217c4f 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -43,7 +43,6 @@ * Machine-dependent part of the proc structure for i386. */ struct mdproc { - struct trapframe *md_regs; /* registers on current frame */ }; #endif /* !_MACHINE_PROC_H_ */ |