summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-06-29 11:10:41 +0000
committerjhb <jhb@FreeBSD.org>2001-06-29 11:10:41 +0000
commitd82893e6762433665a192f6ffe2dad2a1a6c0678 (patch)
treecb74fd6ffd13686b7602fd19e3756d344a7b64e2
parent11807e464b0264daf76c2429a84420f80a6605d1 (diff)
downloadFreeBSD-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)
-rw-r--r--sys/alpha/alpha/fp_emulate.c2
-rw-r--r--sys/alpha/alpha/machdep.c40
-rw-r--r--sys/alpha/alpha/mp_machdep.c2
-rw-r--r--sys/alpha/alpha/trap.c22
-rw-r--r--sys/alpha/alpha/vm_machdep.c7
-rw-r--r--sys/alpha/include/proc.h1
-rw-r--r--sys/alpha/osf1/osf1_signal.c8
-rw-r--r--sys/amd64/amd64/machdep.c26
-rw-r--r--sys/amd64/amd64/mem.c4
-rw-r--r--sys/amd64/amd64/trap.c6
-rw-r--r--sys/amd64/amd64/vm_machdep.c16
-rw-r--r--sys/amd64/include/cpu.h4
-rw-r--r--sys/amd64/include/proc.h1
-rw-r--r--sys/dev/syscons/syscons.c4
-rw-r--r--sys/i386/i386/machdep.c26
-rw-r--r--sys/i386/i386/math_emulate.c2
-rw-r--r--sys/i386/i386/mem.c4
-rw-r--r--sys/i386/i386/trap.c6
-rw-r--r--sys/i386/i386/vm_machdep.c16
-rw-r--r--sys/i386/ibcs2/ibcs2_isc.c2
-rw-r--r--sys/i386/ibcs2/ibcs2_misc.c2
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.c2
-rw-r--r--sys/i386/include/cpu.h4
-rw-r--r--sys/i386/include/proc.h1
-rw-r--r--sys/i386/isa/pcvt/pcvt_ext.c4
-rw-r--r--sys/i386/isa/spigot.c4
-rw-r--r--sys/i386/linux/linux_machdep.c4
-rw-r--r--sys/i386/linux/linux_sysvec.c8
-rw-r--r--sys/i386/svr4/svr4_machdep.c6
-rw-r--r--sys/ia64/ia64/machdep.c24
-rw-r--r--sys/ia64/ia64/trap.c8
-rw-r--r--sys/ia64/ia64/vm_machdep.c14
-rw-r--r--sys/ia64/include/cpu.h2
-rw-r--r--sys/ia64/include/proc.h1
-rw-r--r--sys/kern/subr_trap.c6
-rw-r--r--sys/pc98/i386/machdep.c26
-rw-r--r--sys/pc98/pc98/machdep.c26
-rw-r--r--sys/pc98/pc98/syscons.c4
-rw-r--r--sys/powerpc/include/cpu.h2
-rw-r--r--sys/powerpc/include/proc.h1
-rw-r--r--sys/sys/proc.h5
41 files changed, 172 insertions, 181 deletions
diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c
index cc49bc2..20f64d6 100644
--- a/sys/alpha/alpha/fp_emulate.c
+++ b/sys/alpha/alpha/fp_emulate.c
@@ -325,7 +325,7 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p)
*/
int fp_software_completion(u_int64_t regmask, struct proc *p)
{
- struct trapframe *frame = p->p_md.md_tf;
+ struct trapframe *frame = p->p_frame;
u_int64_t pc = frame->tf_regs[FRAME_PC];
int error;
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 85271cd..16e31cc 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -982,7 +982,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
*/
proc0paddr->u_pcb.pcb_hw.apcb_ksp =
(u_int64_t)proc0paddr + USPACE - sizeof(struct trapframe);
- proc0.p_md.md_tf =
+ proc0.p_frame =
(struct trapframe *)proc0paddr->u_pcb.pcb_hw.apcb_ksp;
/*
@@ -1232,7 +1232,7 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
struct sigacts *psp;
int oonstack, fsize, rndfsize;
- frame = p->p_md.md_tf;
+ frame = p->p_frame;
oonstack = sigonstack(alpha_pal_rdusp());
fsize = sizeof ksi;
rndfsize = ((fsize + 15) / 16) * 16;
@@ -1344,7 +1344,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
return;
}
- frame = p->p_md.md_tf;
+ frame = p->p_frame;
oonstack = sigonstack(alpha_pal_rdusp());
rndfsize = ((sizeof(sf) + 15) / 16) * 16;
@@ -1522,10 +1522,10 @@ osigreturn(struct proc *p,
PROC_UNLOCK(p);
set_regs(p, (struct reg *)ksc.sc_regs);
- p->p_md.md_tf->tf_regs[FRAME_PC] = ksc.sc_pc;
- p->p_md.md_tf->tf_regs[FRAME_PS] =
+ p->p_frame->tf_regs[FRAME_PC] = ksc.sc_pc;
+ p->p_frame->tf_regs[FRAME_PS] =
(ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR;
- p->p_md.md_tf->tf_regs[FRAME_FLAGS] = 0; /* full restore */
+ p->p_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp(ksc.sc_regs[R_SP]);
@@ -1570,9 +1570,9 @@ sigreturn(struct proc *p,
set_regs(p, (struct reg *)uc.uc_mcontext.mc_regs);
val = (uc.uc_mcontext.mc_regs[R_PS] | ALPHA_PSL_USERSET) &
~ALPHA_PSL_USERCLR;
- p->p_md.md_tf->tf_regs[FRAME_PS] = val;
- p->p_md.md_tf->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC];
- p->p_md.md_tf->tf_regs[FRAME_FLAGS] = 0; /* full restore */
+ p->p_frame->tf_regs[FRAME_PS] = val;
+ p->p_frame->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC];
+ p->p_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp(uc.uc_mcontext.mc_regs[R_SP]);
PROC_LOCK(p);
@@ -1627,7 +1627,7 @@ cpu_halt(void)
void
setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
{
- struct trapframe *tfp = p->p_md.md_tf;
+ struct trapframe *tfp = p->p_frame;
bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]);
bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp);
@@ -1655,7 +1655,7 @@ setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
int
ptrace_set_pc(struct proc *p, unsigned long addr)
{
- struct trapframe *tp = p->p_md.md_tf;
+ struct trapframe *tp = p->p_frame;
tp->tf_regs[FRAME_PC] = addr;
return 0;
}
@@ -1738,7 +1738,7 @@ ptrace_read_register(struct proc *p, int regno)
if (regno == R_ZERO)
return 0;
- return p->p_md.md_tf->tf_regs[reg_to_frame[regno]];
+ return p->p_frame->tf_regs[reg_to_frame[regno]];
}
@@ -1777,7 +1777,7 @@ int
ptrace_single_step(struct proc *p)
{
int error;
- vm_offset_t pc = p->p_md.md_tf->tf_regs[FRAME_PC];
+ vm_offset_t pc = p->p_frame->tf_regs[FRAME_PC];
alpha_instruction ins;
vm_offset_t addr[2]; /* places to set breakpoints */
int count = 0; /* count of breakpoints */
@@ -1854,7 +1854,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_tf - (char *) p->p_addr;
+ gap = (char *) p->p_frame - (char *) p->p_addr;
if ((vm_offset_t) addr < gap)
return EPERM;
@@ -1877,10 +1877,10 @@ ptrace_write_u(struct proc *p, vm_offset_t off, long 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_tf - (char *)p->p_addr;
+ min = (char *)p->p_frame - (char *)p->p_addr;
if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) {
#if 0
- tp = p->p_md.md_tf;
+ tp = p->p_frame;
frame_copy = *tp;
*(int *)((char *)&frame_copy + (off - min)) = data;
if (!EFLAGS_SECURE(frame_copy.tf_eflags, tp->tf_eflags) ||
@@ -1922,9 +1922,9 @@ fill_regs(p, regs)
struct reg *regs;
{
struct pcb *pcb = &p->p_addr->u_pcb;
- struct trapframe *tp = p->p_md.md_tf;
+ struct trapframe *tp = p->p_frame;
- tp = p->p_md.md_tf;
+ tp = p->p_frame;
#define C(r) regs->r_regs[R_ ## r] = tp->tf_regs[FRAME_ ## r]
@@ -1949,9 +1949,9 @@ set_regs(p, regs)
struct reg *regs;
{
struct pcb *pcb = &p->p_addr->u_pcb;
- struct trapframe *tp = p->p_md.md_tf;
+ struct trapframe *tp = p->p_frame;
- tp = p->p_md.md_tf;
+ tp = p->p_frame;
#define C(r) tp->tf_regs[FRAME_ ## r] = regs->r_regs[R_ ## r]
diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c
index a89a2cf..414a1bc 100644
--- a/sys/alpha/alpha/mp_machdep.c
+++ b/sys/alpha/alpha/mp_machdep.c
@@ -173,7 +173,7 @@ smp_init_secondary(void)
* and make idleproc's trapframe pointer point to its
* stack pointer for sanity.
*/
- curproc->p_md.md_tf =
+ curproc->p_frame =
(struct trapframe *)globalp->gd_idlepcb.apcb_ksp;
mtx_lock_spin(&ap_boot_mtx);
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c
index 3e958ef..90fdce9 100644
--- a/sys/alpha/alpha/trap.c
+++ b/sys/alpha/alpha/trap.c
@@ -340,7 +340,7 @@ trap(a0, a1, a2, entry, framep)
mtx_lock_spin(&sched_lock);
sticks = p->p_sticks;
mtx_unlock_spin(&sched_lock);
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
} else {
sticks = 0; /* XXX bogus -Wuninitialized warning */
}
@@ -445,7 +445,7 @@ trap(a0, a1, a2, entry, framep)
if (p->p_md.md_flags & (MDP_STEP1|MDP_STEP2)) {
mtx_lock(&Giant);
ptrace_clear_single_step(p);
- p->p_md.md_tf->tf_regs[FRAME_PC] -= 4;
+ p->p_frame->tf_regs[FRAME_PC] -= 4;
mtx_unlock(&Giant);
}
ucode = a0; /* trap type */
@@ -743,7 +743,7 @@ syscall(code, framep)
#endif
cnt.v_syscall++;
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
opc = framep->tf_regs[FRAME_PC] - 4;
mtx_lock_spin(&sched_lock);
sticks = p->p_sticks;
@@ -904,7 +904,7 @@ ast(framep)
}
sticks = p->p_sticks;
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
astoff(p);
cnt.v_soft++;
@@ -957,7 +957,7 @@ const static int reg_to_framereg[32] = {
#define irp(p, reg) \
((reg_to_framereg[(reg)] == -1) ? NULL : \
- &(p)->p_md.md_tf->tf_regs[reg_to_framereg[(reg)]])
+ &(p)->p_frame->tf_regs[reg_to_framereg[(reg)]])
#define frp(p, reg) \
(&(p)->p_addr->u_pcb.pcb_fp.fpr_regs[(reg)])
@@ -1187,8 +1187,8 @@ unaligned_fixup(va, opcode, reg, p)
if (doprint) {
uprintf(
"pid %d (%s): unaligned access: va=0x%lx pc=0x%lx ra=0x%lx op=",
- p->p_pid, p->p_comm, va, p->p_md.md_tf->tf_regs[FRAME_PC],
- p->p_md.md_tf->tf_regs[FRAME_RA]);
+ p->p_pid, p->p_comm, va, p->p_frame->tf_regs[FRAME_PC],
+ p->p_frame->tf_regs[FRAME_RA]);
uprintf(type,opcode);
uprintf("\n");
}
@@ -1305,9 +1305,9 @@ handle_opdec(p, ucodep)
* This keeps us from having to check for it in lots of places
* later.
*/
- p->p_md.md_tf->tf_regs[FRAME_SP] = alpha_pal_rdusp();
+ p->p_frame->tf_regs[FRAME_SP] = alpha_pal_rdusp();
- inst_pc = memaddr = p->p_md.md_tf->tf_regs[FRAME_PC] - 4;
+ inst_pc = memaddr = p->p_frame->tf_regs[FRAME_PC] - 4;
if (copyin((caddr_t)inst_pc, &inst, sizeof (inst)) != 0) {
/*
* really, this should never happen, but in case it
@@ -1424,7 +1424,7 @@ handle_opdec(p, ucodep)
* nothing will have been successfully modified so we don't
* have to write it out.
*/
- alpha_pal_wrusp(p->p_md.md_tf->tf_regs[FRAME_SP]);
+ alpha_pal_wrusp(p->p_frame->tf_regs[FRAME_SP]);
return (0);
@@ -1434,7 +1434,7 @@ sigill:
sigsegv:
sig = SIGSEGV;
- p->p_md.md_tf->tf_regs[FRAME_PC] = inst_pc; /* re-run instr. */
+ p->p_frame->tf_regs[FRAME_PC] = inst_pc; /* re-run instr. */
unaligned_fixup_sig:
*ucodep = memaddr; /* faulting address */
return (sig);
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index 79209e5..862e25b 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -125,7 +125,7 @@ cpu_fork(p1, p2, flags)
if ((flags & RFPROC) == 0)
return;
- p2->p_md.md_tf = p1->p_md.md_tf;
+ p2->p_frame = p1->p_frame;
p2->p_md.md_flags = p1->p_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
/*
@@ -181,10 +181,9 @@ cpu_fork(p1, p2, flags)
* copy trapframe from parent so return to user mode
* will be to right address, with correct registers.
*/
- p2tf = p2->p_md.md_tf = (struct trapframe *)
+ p2tf = p2->p_frame = (struct trapframe *)
((char *)p2->p_addr + USPACE - sizeof(struct trapframe));
- bcopy(p1->p_md.md_tf, p2->p_md.md_tf,
- sizeof(struct trapframe));
+ bcopy(p1->p_frame, p2->p_frame, sizeof(struct trapframe));
/*
* Set up return-value registers as fork() libc stub expects.
diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h
index 3a83c39..b3f98f6 100644
--- a/sys/alpha/include/proc.h
+++ b/sys/alpha/include/proc.h
@@ -45,7 +45,6 @@ struct mdbpt {
struct mdproc {
u_long md_flags;
- struct trapframe *md_tf; /* trap/syscall registers */
struct pcb *md_pcbpaddr; /* phys addr of the pcb */
struct mdbpt md_sstep[2]; /* two single step breakpoints */
u_int64_t md_hae; /* user HAE register value */
diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c
index 4152521..66aa3a9 100644
--- a/sys/alpha/osf1/osf1_signal.c
+++ b/sys/alpha/osf1/osf1_signal.c
@@ -588,7 +588,7 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
PROC_LOCK(p);
psp = p->p_sigacts;
- frame = p->p_md.md_tf;
+ frame = p->p_frame;
oonstack = sigonstack(alpha_pal_rdusp());
fsize = sizeof ksi;
rndfsize = ((fsize + 15) / 16) * 16;
@@ -724,10 +724,10 @@ osf1_sigreturn(struct proc *p,
PROC_UNLOCK(p);
set_regs(p, (struct reg *)ksc.sc_regs);
- p->p_md.md_tf->tf_regs[FRAME_PC] = ksc.sc_pc;
- p->p_md.md_tf->tf_regs[FRAME_PS] =
+ p->p_frame->tf_regs[FRAME_PC] = ksc.sc_pc;
+ p->p_frame->tf_regs[FRAME_PS] =
(ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR;
- p->p_md.md_tf->tf_regs[FRAME_FLAGS] = 0; /* full restore */
+ p->p_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp(ksc.sc_regs[R_SP]);
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_ */
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 1ea90f3..8a4a226 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -1017,13 +1017,13 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (securelevel > 0)
return EPERM;
#ifdef __i386__
- p->p_md.md_regs->tf_eflags |= PSL_IOPL;
+ p->p_frame->tf_eflags |= PSL_IOPL;
#endif
return 0;
case KDDISABIO: /* disallow io operations (default) */
#ifdef __i386__
- p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
+ p->p_frame->tf_eflags &= ~PSL_IOPL;
#endif
return 0;
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 90ab77c..ed4ebb5 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/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/i386/i386/math_emulate.c b/sys/i386/i386/math_emulate.c
index eae1fcc..94f32b1 100644
--- a/sys/i386/i386/math_emulate.c
+++ b/sys/i386/i386/math_emulate.c
@@ -604,7 +604,7 @@ static int __regoffset[] = {
tEAX, tECX, tEDX, tEBX, tESP, tEBP, tESI, tEDI
};
-#define REG(x) (((int *)curproc->p_md.md_regs)[__regoffset[(x)]])
+#define REG(x) (((int *)curproc->p_frame)[__regoffset[(x)]])
static char *
sib(struct trapframe * info, int mod)
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 13023b8..dfb034e 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/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/i386/i386/trap.c b/sys/i386/i386/trap.c
index 09cc034..f6a9e0c 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/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/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 89762bc..40ae8cd 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/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/i386/ibcs2/ibcs2_isc.c b/sys/i386/ibcs2/ibcs2_isc.c
index bc268b6..f978c2d 100644
--- a/sys/i386/ibcs2/ibcs2_isc.c
+++ b/sys/i386/ibcs2/ibcs2_isc.c
@@ -46,7 +46,7 @@ extern struct sysent isc_sysent[];
int
ibcs2_isc(struct proc *p, struct ibcs2_isc_args *uap)
{
- struct trapframe *tf = p->p_md.md_regs;
+ struct trapframe *tf = p->p_frame;
struct sysent *callp;
u_int code;
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c
index 6f8d7e7..c2e28b9 100644
--- a/sys/i386/ibcs2/ibcs2_misc.c
+++ b/sys/i386/ibcs2/ibcs2_misc.c
@@ -143,7 +143,7 @@ ibcs2_wait(p, uap)
{
int error, status;
struct wait_args w4;
- struct trapframe *tf = p->p_md.md_regs;
+ struct trapframe *tf = p->p_frame;
SCARG(&w4, rusage) = NULL;
if ((tf->tf_eflags & (PSL_Z|PSL_PF|PSL_N|PSL_V))
diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c
index 0cab2fb..b11275c2 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.c
+++ b/sys/i386/ibcs2/ibcs2_xenix.c
@@ -55,7 +55,7 @@ extern struct sysent xenix_sysent[];
int
ibcs2_xenix(struct proc *p, struct ibcs2_xenix_args *uap)
{
- struct trapframe *tf = p->p_md.md_regs;
+ struct trapframe *tf = p->p_frame;
struct sysent *callp;
u_int code;
diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h
index 29b34ee..90643aa 100644
--- a/sys/i386/include/cpu.h
+++ b/sys/i386/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/i386/include/proc.h b/sys/i386/include/proc.h
index bc2679e..4217c4f 100644
--- a/sys/i386/include/proc.h
+++ b/sys/i386/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_ */
diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c
index 15686f4..967c928 100644
--- a/sys/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/i386/isa/pcvt/pcvt_ext.c
@@ -2613,7 +2613,7 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
/* grant the process IO access; only allowed if euid == 0 */
/* and insecure */
{
- struct trapframe *fp = p->p_md.md_regs;
+ struct trapframe *fp = p->p_frame;
error = suser(p);
if (error != 0)
@@ -2629,7 +2629,7 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
case KDDISABIO:
/* abandon IO access permission */
{
- struct trapframe *fp = p->p_md.md_regs;
+ struct trapframe *fp = p->p_frame;
fp->tf_eflags &= ~PSL_IOPL;
return 0;
}
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index 39e9e33..db4a926 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -241,10 +241,10 @@ struct spigot_info *info;
if (securelevel > 0)
return EPERM;
#endif
- p->p_md.md_regs->tf_eflags |= PSL_IOPL;
+ p->p_frame->tf_eflags |= PSL_IOPL;
break;
case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */
- p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
+ p->p_frame->tf_eflags &= ~PSL_IOPL;
break;
case SPIGOT_GET_INFO:
info = (struct spigot_info *)data;
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index fe43527..ce8d52b 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -262,7 +262,7 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
PROC_LOCK(p2);
p2->p_sigparent = exit_signal;
PROC_UNLOCK(p2);
- p2->p_md.md_regs->tf_esp = (unsigned int)args->stack;
+ p2->p_frame->tf_esp = (unsigned int)args->stack;
#ifdef DEBUG
if (ldebug(clone))
@@ -474,7 +474,7 @@ linux_iopl(struct proc *p, struct linux_iopl_args *args)
return (error);
if (securelevel > 0)
return (EPERM);
- p->p_md.md_regs->tf_eflags = (p->p_md.md_regs->tf_eflags & ~PSL_IOPL) |
+ p->p_frame->tf_eflags = (p->p_frame->tf_eflags & ~PSL_IOPL) |
(args->level * (PSL_IOPL / 3));
return (0);
}
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 4dd664b..c37a03f 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -213,7 +213,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
struct linux_rt_sigframe *fp, frame;
int oonstack;
- regs = p->p_md.md_regs;
+ regs = p->p_frame;
oonstack = sigonstack(regs->tf_esp);
#ifdef DEBUG
@@ -370,7 +370,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
return;
}
- regs = p->p_md.md_regs;
+ regs = p->p_frame;
oonstack = sigonstack(regs->tf_esp);
#ifdef DEBUG
@@ -496,7 +496,7 @@ linux_sigreturn(p, args)
linux_sigset_t lmask;
int eflags, i;
- regs = p->p_md.md_regs;
+ regs = p->p_frame;
#ifdef DEBUG
if (ldebug(sigreturn))
@@ -595,7 +595,7 @@ linux_rt_sigreturn(p, args)
int eflags;
caddr_t sg = stackgap_init();
- regs = p->p_md.md_regs;
+ regs = p->p_frame;
#ifdef DEBUG
if (ldebug(rt_sigreturn))
diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c
index 7346f07..18d50d5 100644
--- a/sys/i386/svr4/svr4_machdep.c
+++ b/sys/i386/svr4/svr4_machdep.c
@@ -96,7 +96,7 @@ svr4_getcontext(p, uc, mask, oonstack)
sigset_t *mask;
int oonstack;
{
- struct trapframe *tf = p->p_md.md_regs;
+ struct trapframe *tf = p->p_frame;
svr4_greg_t *r = uc->uc_mcontext.greg;
struct svr4_sigaltstack *s = &uc->uc_stack;
#if defined(DONE_MORE_SIGALTSTACK_WORK)
@@ -219,7 +219,7 @@ svr4_setcontext(p, uc)
DPRINTF(("svr4_setcontext(%d)\n", p->p_pid));
- tf = p->p_md.md_regs;
+ tf = p->p_frame;
/*
* Restore register context.
@@ -421,7 +421,7 @@ svr4_sendsig(catcher, sig, mask, code)
PROC_LOCK(p);
psp = p->p_sigacts;
- tf = p->p_md.md_regs;
+ tf = p->p_frame;
oonstack = sigonstack(tf->tf_esp);
/*
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 22a23ea..c44e7cd 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -562,7 +562,7 @@ ia64_init()
proc0.p_addr->u_pcb.pcb_sp =
(u_int64_t)proc0.p_addr + USPACE - sizeof(struct trapframe) - 16;
proc0.p_addr->u_pcb.pcb_bspstore = (u_int64_t) (proc0.p_addr + 1);
- proc0.p_md.md_tf =
+ proc0.p_frame =
(struct trapframe *)(proc0.p_addr->u_pcb.pcb_sp + 16);
/* Setup curproc so that mutexes work */
@@ -738,7 +738,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
PROC_LOCK(p);
psp = p->p_sigacts;
- frame = p->p_md.md_tf;
+ frame = p->p_frame;
oonstack = sigonstack(frame->tf_r[FRAME_SP]);
rndfsize = ((sizeof(sf) + 15) / 16) * 16;
@@ -924,7 +924,7 @@ sigreturn(struct proc *p,
{
ucontext_t uc, *ucp;
struct pcb *pcb;
- struct trapframe *frame = p->p_md.md_tf;
+ struct trapframe *frame = p->p_frame;
struct __mcontext *mcp;
ucp = uap->sigcntxp;
@@ -1033,7 +1033,7 @@ setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
{
struct trapframe *frame;
- frame = p->p_md.md_tf;
+ frame = p->p_frame;
/*
* Make sure that we restore the entire trapframe after an
@@ -1092,7 +1092,7 @@ int ptrace_read_u_check(struct proc *p, vm_offset_t addr, size_t len)
if ((vm_offset_t) (addr + len) <= sizeof(struct user))
return 0;
- gap = (char *) p->p_md.md_tf - (char *) p->p_addr;
+ gap = (char *) p->p_frame - (char *) p->p_addr;
if ((vm_offset_t) addr < gap)
return EPERM;
@@ -1115,10 +1115,10 @@ ptrace_write_u(struct proc *p, vm_offset_t off, long 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_tf - (char *)p->p_addr;
+ min = (char *)p->p_frame - (char *)p->p_addr;
if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) {
#if 0
- tp = p->p_md.md_tf;
+ tp = p->p_frame;
frame_copy = *tp;
*(int *)((char *)&frame_copy + (off - min)) = data;
if (!EFLAGS_SECURE(frame_copy.tf_eflags, tp->tf_eflags) ||
@@ -1281,7 +1281,7 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
void
ia64_fpstate_check(struct proc *p)
{
- if ((p->p_md.md_tf->tf_cr_ipsr & IA64_PSR_DFH) == 0)
+ if ((p->p_frame->tf_cr_ipsr & IA64_PSR_DFH) == 0)
if (p != PCPU_GET(fpcurproc))
panic("ia64_check_fpcurproc: bogus");
}
@@ -1303,7 +1303,7 @@ ia64_fpstate_save(struct proc *p, int write)
savehighfp(p->p_addr->u_pcb.pcb_highfp);
if (write) {
- p->p_md.md_tf->tf_cr_ipsr |= IA64_PSR_DFH;
+ p->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
PCPU_SET(fpcurproc, NULL);
}
}
@@ -1318,7 +1318,7 @@ void
ia64_fpstate_drop(struct proc *p)
{
if (p == PCPU_GET(fpcurproc)) {
- p->p_md.md_tf->tf_cr_ipsr |= IA64_PSR_DFH;
+ p->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
PCPU_SET(fpcurproc, NULL);
}
}
@@ -1335,7 +1335,7 @@ ia64_fpstate_switch(struct proc *p)
* Dump the old fp state if its valid.
*/
savehighfp(PCPU_GET(fpcurproc)->p_addr->u_pcb.pcb_highfp);
- PCPU_GET(fpcurproc)->p_md.md_tf->tf_cr_ipsr |= IA64_PSR_DFH;
+ PCPU_GET(fpcurproc)->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
}
/*
@@ -1343,7 +1343,7 @@ ia64_fpstate_switch(struct proc *p)
*/
PCPU_SET(fpcurproc, p);
restorehighfp(p->p_addr->u_pcb.pcb_highfp);
- p->p_md.md_tf->tf_cr_ipsr &= ~IA64_PSR_DFH;
+ p->p_frame->tf_cr_ipsr &= ~IA64_PSR_DFH;
p->p_md.md_flags |= MDP_FPUSED;
}
diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c
index b49c0b6..416b3cd 100644
--- a/sys/ia64/ia64/trap.c
+++ b/sys/ia64/ia64/trap.c
@@ -242,7 +242,7 @@ trap(int vector, int imm, struct trapframe *framep)
mtx_lock_spin(&sched_lock);
sticks = p->p_sticks;
mtx_unlock_spin(&sched_lock);
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
} else {
sticks = 0; /* XXX bogus -Wuninitialized warning */
}
@@ -498,7 +498,7 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
cnt.v_syscall++;
p = curproc;
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
mtx_lock_spin(&sched_lock);
sticks = p->p_sticks;
mtx_unlock_spin(&sched_lock);
@@ -634,7 +634,7 @@ ast(framep)
}
sticks = p->p_sticks;
- p->p_md.md_tf = framep;
+ p->p_frame = framep;
astoff(p);
cnt.v_soft++;
@@ -709,7 +709,7 @@ unaligned_fixup(struct trapframe *framep, struct proc *p)
*/
if (doprint) {
uprintf("pid %d (%s): unaligned access: va=0x%lx pc=0x%lx\n",
- p->p_pid, p->p_comm, va, p->p_md.md_tf->tf_cr_iip);
+ p->p_pid, p->p_comm, va, p->p_frame->tf_cr_iip);
}
/*
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index f4bd000..2ca0292 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -131,7 +131,7 @@ cpu_fork(p1, p2, flags)
if ((flags & RFPROC) == 0)
return;
- p2->p_md.md_tf = p1->p_md.md_tf;
+ p2->p_frame = p1->p_frame;
p2->p_md.md_flags = p1->p_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
/*
@@ -184,10 +184,9 @@ cpu_fork(p1, p2, flags)
* copy trapframe from parent so return to user mode
* will be to right address, with correct registers.
*/
- p2tf = p2->p_md.md_tf = (struct trapframe *)
+ p2tf = p2->p_frame = (struct trapframe *)
((char *)p2->p_addr + USPACE - sizeof(struct trapframe));
- bcopy(p1->p_md.md_tf, p2->p_md.md_tf,
- sizeof(struct trapframe));
+ bcopy(p1->p_frame, p2->p_frame, sizeof(struct trapframe));
/*
* Set up return-value registers as fork() libc stub expects.
@@ -217,8 +216,7 @@ cpu_fork(p1, p2, flags)
* Copy enough of p1's backing store to include all
* the user's stacked regs.
*/
- bcopy(p1bs, p2bs, p1->p_md.md_tf->tf_ndirty);
-
+ bcopy(p1bs, p2bs, p1->p_frame->tf_ndirty);
/*
* To calculate the ar.rnat for p2, we need to decide
* if p1's ar.bspstore has advanced past the place
@@ -227,7 +225,7 @@ cpu_fork(p1, p2, flags)
* that one from memory, otherwise we take p1's
* current ar.rnat.
*/
- rnatloc = (u_int64_t)p1bs + p1->p_md.md_tf->tf_ndirty;
+ rnatloc = (u_int64_t)p1bs + p1->p_frame->tf_ndirty;
rnatloc |= 0x1f8;
if (bspstore > rnatloc)
rnat = *(u_int64_t *) rnatloc;
@@ -246,7 +244,7 @@ cpu_fork(p1, p2, flags)
* straight into exception_restore.
*/
up->u_pcb.pcb_bspstore =
- (u_int64_t)p2bs + p1->p_md.md_tf->tf_ndirty;
+ (u_int64_t)p2bs + p1->p_frame->tf_ndirty;
up->u_pcb.pcb_rnat = rnat;
up->u_pcb.pcb_pfs = 0;
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
index 61766d2..39872e5 100644
--- a/sys/ia64/include/cpu.h
+++ b/sys/ia64/include/cpu.h
@@ -52,7 +52,7 @@
#include <machine/frame.h>
-#define cpu_getstack(p) ((p)->p_md.md_tf->tf_r[FRAME_SP])
+#define cpu_getstack(p) ((p)->p_frame->tf_r[FRAME_SP])
/*
* Arguments to hardclock and gatherstats encapsulate the previous
diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h
index eff85c2..9d900f0 100644
--- a/sys/ia64/include/proc.h
+++ b/sys/ia64/include/proc.h
@@ -39,7 +39,6 @@ struct mdproc {
u_long md_flags;
struct user *md_uservirt; /* virtual address of p_addr */
vm_offset_t md_bspstore; /* initial ar.bspstore */
- struct trapframe *md_tf; /* trap/syscall registers */
};
#define MDP_FPUSED 0x0001 /* Process used the FPU */
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 09cc034..f6a9e0c 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_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/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index d12ef72..a0768b1 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -480,7 +480,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. */
@@ -630,7 +630,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. */
@@ -777,7 +777,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);
@@ -902,7 +902,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;
@@ -1048,7 +1048,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)
@@ -2098,7 +2098,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)
@@ -2145,7 +2145,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);
}
@@ -2153,7 +2153,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);
}
@@ -2169,7 +2169,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;
@@ -2192,9 +2192,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) ||
@@ -2219,7 +2219,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;
@@ -2248,7 +2248,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/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index d12ef72..a0768b1 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -480,7 +480,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. */
@@ -630,7 +630,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. */
@@ -777,7 +777,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);
@@ -902,7 +902,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;
@@ -1048,7 +1048,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)
@@ -2098,7 +2098,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)
@@ -2145,7 +2145,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);
}
@@ -2153,7 +2153,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);
}
@@ -2169,7 +2169,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;
@@ -2192,9 +2192,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) ||
@@ -2219,7 +2219,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;
@@ -2248,7 +2248,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/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c
index 385d508..184be71 100644
--- a/sys/pc98/pc98/syscons.c
+++ b/sys/pc98/pc98/syscons.c
@@ -1019,13 +1019,13 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (securelevel > 0)
return EPERM;
#ifdef __i386__
- p->p_md.md_regs->tf_eflags |= PSL_IOPL;
+ p->p_frame->tf_eflags |= PSL_IOPL;
#endif
return 0;
case KDDISABIO: /* disallow io operations (default) */
#ifdef __i386__
- p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
+ p->p_frame->tf_eflags &= ~PSL_IOPL;
#endif
return 0;
diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h
index 3050b59..cabcbec 100644
--- a/sys/powerpc/include/cpu.h
+++ b/sys/powerpc/include/cpu.h
@@ -91,7 +91,7 @@ get_cyclecount(void)
return (time);
}
-#define cpu_getstack(p) ((p)->p_md.md_regs[1])
+#define cpu_getstack(p) ((p)->p_frame->fixreg[1])
void savectx __P((struct pcb *));
diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h
index 370a9b2..21b9b32 100644
--- a/sys/powerpc/include/proc.h
+++ b/sys/powerpc/include/proc.h
@@ -38,5 +38,4 @@
* Machine-dependent part of the proc structure
*/
struct mdproc {
- int md_regs[32];
};
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 268925a..c8ce169 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -149,6 +149,7 @@ struct pargs {
*/
struct ithd;
struct nlminfo;
+struct trapframe;
struct proc {
TAILQ_ENTRY(proc) p_procq; /* (j) Run/mutex queue. */
@@ -275,6 +276,7 @@ struct proc {
struct proc *p_leader; /* (c) */
struct pasleep p_asleep; /* (k) Used by asleep()/await(). */
void *p_emuldata; /* (c) Emulator state data. */
+ struct trapframe *p_frame; /* (k) */
};
#define p_session p_pgrp->pg_session
@@ -500,9 +502,6 @@ extern int lastpid;
#define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level). */
#define NICE_WEIGHT 1 /* Priorities per nice level. */
-struct mtx;
-struct trapframe;
-
struct proc *pfind __P((pid_t)); /* Find process by id. */
struct pgrp *pgfind __P((pid_t)); /* Find process group by id. */
struct proc *zpfind __P((pid_t)); /* Find zombie process by id. */
OpenPOWER on IntegriCloud