s/framep/tf/g -- this normalizes on the use of tf to point to the

trapframe and improves grep-ability.
This commit is contained in:
Marcel Moolenaar 2004-01-20 02:35:46 +00:00
parent 9bbee25931
commit dd45fd9791
2 changed files with 89 additions and 89 deletions

View File

@ -78,7 +78,7 @@ extern int mp_ipi_test;
volatile int mc_expected, mc_received;
static void
dummy_perf(unsigned long vector, struct trapframe *framep)
dummy_perf(unsigned long vector, struct trapframe *tf)
{
printf("performance interrupt!\n");
}
@ -124,7 +124,7 @@ SYSCTL_INT(_debug, OID_AUTO, clock_adjust_ticks, CTLFLAG_RW,
&adjust_ticks, 0, "Total number of ITC interrupts with adjustment");
int
interrupt(u_int64_t vector, struct trapframe *framep)
interrupt(u_int64_t vector, struct trapframe *tf)
{
struct thread *td;
volatile struct ia64_interrupt_block *ib = IA64_INTERRUPT_BLOCK;
@ -166,12 +166,12 @@ interrupt(u_int64_t vector, struct trapframe *framep)
while (delta >= ia64_clock_reload) {
/* Only the BSP runs the real clock */
if (PCPU_GET(cpuid) == 0)
hardclock((struct clockframe *)framep);
hardclock((struct clockframe *)tf);
else
hardclock_process((struct clockframe *)framep);
hardclock_process((struct clockframe *)tf);
if (profprocs != 0)
profclock((struct clockframe *)framep);
statclock((struct clockframe *)framep);
profclock((struct clockframe *)tf);
statclock((struct clockframe *)tf);
delta -= ia64_clock_reload;
clk += ia64_clock_reload;
if (adj != 0)
@ -231,11 +231,11 @@ interrupt(u_int64_t vector, struct trapframe *framep)
#endif
} else {
ints[PCPU_GET(cpuid)]++;
ia64_dispatch_intr(framep, vector);
ia64_dispatch_intr(tf, vector);
}
atomic_subtract_int(&td->td_intr_nesting_level, 1);
return (TRAPF_USERMODE(framep));
return (TRAPF_USERMODE(tf));
}
/*

View File

@ -84,7 +84,7 @@ SYSCTL_INT(_machdep, OID_AUTO, print_usertrap,
CTLFLAG_RW, &print_usertrap, 0, "");
static void break_syscall(struct trapframe *tf);
static void ia32_syscall(struct trapframe *framep);
static void ia32_syscall(struct trapframe *tf);
/*
* EFI-Provided FPSWA interface (Floating Point SoftWare Assist)
@ -283,7 +283,7 @@ static void printisr(u_int64_t isr)
}
static void
printtrap(int vector, struct trapframe *framep, int isfatal, int user)
printtrap(int vector, struct trapframe *tf, int isfatal, int user)
{
printf("\n");
printf("%s %s trap (cpu %d):\n", isfatal? "fatal" : "handled",
@ -291,15 +291,15 @@ printtrap(int vector, struct trapframe *framep, int isfatal, int user)
printf("\n");
printf(" trap vector = 0x%x (%s)\n",
vector, ia64_vector_names[vector]);
printf(" cr.iip = 0x%lx\n", framep->tf_special.iip);
printf(" cr.ipsr = 0x%lx (", framep->tf_special.psr);
printpsr(framep->tf_special.psr);
printf(" cr.iip = 0x%lx\n", tf->tf_special.iip);
printf(" cr.ipsr = 0x%lx (", tf->tf_special.psr);
printpsr(tf->tf_special.psr);
printf(")\n");
printf(" cr.isr = 0x%lx (", framep->tf_special.isr);
printisr(framep->tf_special.isr);
printf(" cr.isr = 0x%lx (", tf->tf_special.isr);
printisr(tf->tf_special.isr);
printf(")\n");
printf(" cr.ifa = 0x%lx\n", framep->tf_special.ifa);
if (framep->tf_special.psr & IA64_PSR_IS) {
printf(" cr.ifa = 0x%lx\n", tf->tf_special.ifa);
if (tf->tf_special.psr & IA64_PSR_IS) {
printf(" ar.cflg = 0x%lx\n", ia64_get_cflg());
printf(" ar.csd = 0x%lx\n", ia64_get_csd());
printf(" ar.ssd = 0x%lx\n", ia64_get_ssd());
@ -348,7 +348,7 @@ do_ast(struct trapframe *tf)
*/
/*ARGSUSED*/
void
trap(int vector, struct trapframe *framep)
trap(int vector, struct trapframe *tf)
{
struct proc *p;
struct thread *td;
@ -356,7 +356,7 @@ trap(int vector, struct trapframe *framep)
int error, sig, user;
u_int sticks;
user = TRAPF_USERMODE(framep) ? 1 : 0;
user = TRAPF_USERMODE(tf) ? 1 : 0;
/* Sanitize the FP state in case the user has trashed it. */
ia64_set_fpsr(IA64_FPSR_DEFAULT);
@ -369,7 +369,7 @@ trap(int vector, struct trapframe *framep)
if (user) {
sticks = td->td_sticks;
td->td_frame = framep;
td->td_frame = tf;
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
} else {
@ -386,14 +386,14 @@ trap(int vector, struct trapframe *framep)
* don't at this time. I think we're mostly lucky that
* the VHPT is mapped.
*/
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_ITLB:
case IA64_VEC_DTLB:
case IA64_VEC_EXT_INTR:
/* We never call trap() with these vectors. */
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_ALT_ITLB:
@ -403,7 +403,7 @@ trap(int vector, struct trapframe *framep)
* VHPT. If we get one of these it means we didn't program
* the region registers correctly.
*/
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_NESTED_DTLB:
@ -414,7 +414,7 @@ trap(int vector, struct trapframe *framep)
* we could switch to a special (hardwired) stack and
* come here to produce a nice panic().
*/
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_IKEY_MISS:
@ -424,7 +424,7 @@ trap(int vector, struct trapframe *framep)
* We don't use protection keys, so we should never get
* these faults.
*/
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_DIRTY_BIT:
@ -437,36 +437,36 @@ trap(int vector, struct trapframe *framep)
* either means we have a stale PTE in the TLB, or we lost
* the PTE in our datastructures.
*/
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_BREAK:
if (user) {
if (framep->tf_special.ifa == 0x100000) {
break_syscall(framep);
if (tf->tf_special.ifa == 0x100000) {
break_syscall(tf);
return; /* do_ast() already called. */
} else if (framep->tf_special.ifa == 0x180000) {
} else if (tf->tf_special.ifa == 0x180000) {
mcontext_t mc;
error = copyin((void*)framep->tf_scratch.gr8,
error = copyin((void*)tf->tf_scratch.gr8,
&mc, sizeof(mc));
if (!error) {
set_mcontext(td, &mc);
return; /* Don't call do_ast()!!! */
}
ucode = framep->tf_scratch.gr8;
ucode = tf->tf_scratch.gr8;
sig = SIGSEGV;
} else {
framep->tf_special.psr &= ~IA64_PSR_SS;
tf->tf_special.psr &= ~IA64_PSR_SS;
sig = SIGTRAP;
}
} else {
#ifdef DDB
if (kdb_trap(vector, framep))
if (kdb_trap(vector, tf))
return;
panic("trap");
#else
trap_panic(vector, framep);
trap_panic(vector, tf);
#endif
}
break;
@ -481,7 +481,7 @@ trap(int vector, struct trapframe *framep)
int rv;
rv = 0;
va = trunc_page(framep->tf_special.ifa);
va = trunc_page(tf->tf_special.ifa);
if (va >= VM_MAX_ADDRESS) {
/*
@ -498,9 +498,9 @@ trap(int vector, struct trapframe *framep)
map = &vm->vm_map;
}
if (framep->tf_special.isr & IA64_ISR_X)
if (tf->tf_special.isr & IA64_ISR_X)
ftype = VM_PROT_EXECUTE;
else if (framep->tf_special.isr & IA64_ISR_W)
else if (tf->tf_special.isr & IA64_ISR_W)
ftype = VM_PROT_WRITE;
else
ftype = VM_PROT_READ;
@ -536,13 +536,13 @@ trap(int vector, struct trapframe *framep)
if (!user) {
/* Check for copyin/copyout fault. */
if (td != NULL && td->td_pcb->pcb_onfault != 0) {
framep->tf_special.iip =
tf->tf_special.iip =
td->td_pcb->pcb_onfault;
framep->tf_special.psr &= ~IA64_PSR_RI;
tf->tf_special.psr &= ~IA64_PSR_RI;
td->td_pcb->pcb_onfault = 0;
goto out;
}
trap_panic(vector, framep);
trap_panic(vector, tf);
}
ucode = va;
sig = (rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV;
@ -558,7 +558,7 @@ trap(int vector, struct trapframe *framep)
ucode = vector;
sig = SIGILL;
} else
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
case IA64_VEC_DISABLED_FP: {
@ -568,7 +568,7 @@ trap(int vector, struct trapframe *framep)
/* Always fatal in kernel. Should never happen. */
if (!user)
trap_panic(vector, framep);
trap_panic(vector, tf);
critical_enter();
thr = PCPU_GET(fpcurthread);
@ -583,7 +583,7 @@ trap(int vector, struct trapframe *framep)
* return.
*/
printf("XXX: bogusly disabled high FP regs\n");
framep->tf_special.psr &= ~IA64_PSR_DFH;
tf->tf_special.psr &= ~IA64_PSR_DFH;
critical_exit();
goto out;
} else if (thr != NULL) {
@ -613,8 +613,8 @@ trap(int vector, struct trapframe *framep)
restore_high_fp(&pcb->pcb_high_fp);
PCPU_SET(fpcurthread, td);
pcb->pcb_fpcpu = pcpup;
framep->tf_special.psr &= ~IA64_PSR_MFH;
framep->tf_special.psr &= ~IA64_PSR_DFH;
tf->tf_special.psr &= ~IA64_PSR_MFH;
tf->tf_special.psr &= ~IA64_PSR_DFH;
}
critical_exit();
@ -624,14 +624,14 @@ trap(int vector, struct trapframe *framep)
case IA64_VEC_DEBUG:
case IA64_VEC_TAKEN_BRANCH_TRAP:
case IA64_VEC_SINGLE_STEP_TRAP:
framep->tf_special.psr &= ~IA64_PSR_SS;
tf->tf_special.psr &= ~IA64_PSR_SS;
if (!user) {
#ifdef DDB
if (kdb_trap(vector, framep))
if (kdb_trap(vector, tf))
return;
panic("trap");
#else
trap_panic(vector, framep);
trap_panic(vector, tf);
#endif
}
sig = SIGTRAP;
@ -644,20 +644,20 @@ trap(int vector, struct trapframe *framep)
* and per-process unaligned-access-handling flags).
*/
if (user) {
sig = unaligned_fixup(framep, td);
sig = unaligned_fixup(tf, td);
if (sig == 0)
goto out;
ucode = framep->tf_special.ifa; /* VA */
ucode = tf->tf_special.ifa; /* VA */
} else {
/* Check for copyin/copyout fault. */
if (td != NULL && td->td_pcb->pcb_onfault != 0) {
framep->tf_special.iip =
tf->tf_special.iip =
td->td_pcb->pcb_onfault;
framep->tf_special.psr &= ~IA64_PSR_RI;
tf->tf_special.psr &= ~IA64_PSR_RI;
td->td_pcb->pcb_onfault = 0;
goto out;
}
trap_panic(vector, framep);
trap_panic(vector, tf);
}
break;
@ -669,7 +669,7 @@ trap(int vector, struct trapframe *framep)
/* Always fatal in kernel. Should never happen. */
if (!user)
trap_panic(vector, framep);
trap_panic(vector, tf);
if (fpswa_interface == NULL) {
sig = SIGFPE;
@ -677,7 +677,7 @@ trap(int vector, struct trapframe *framep)
break;
}
error = copyin((void *)(framep->tf_special.iip), &bundle, 16);
error = copyin((void *)(tf->tf_special.iip), &bundle, 16);
if (error) {
sig = SIGBUS; /* EFAULT, basically */
ucode = 0; /* exception summary */
@ -688,7 +688,7 @@ trap(int vector, struct trapframe *framep)
fp_state.bitmask_low64 = 0xffc0; /* bits 6 - 15 */
fp_state.bitmask_high64 = 0x0;
fp_state.fp_low_preserved = NULL;
fp_state.fp_low_volatile = &framep->tf_scratch_fp.fr6;
fp_state.fp_low_volatile = &tf->tf_scratch_fp.fr6;
fp_state.fp_high_preserved = NULL;
fp_state.fp_high_volatile = NULL;
@ -700,9 +700,9 @@ trap(int vector, struct trapframe *framep)
/* The docs are unclear. Is Fpswa reentrant? */
fpswa_ret = fpswa_interface->Fpswa(1, &bundle,
&framep->tf_special.psr, &framep->tf_special.fpsr,
&framep->tf_special.isr, &framep->tf_special.pr,
&framep->tf_special.cfm, &fp_state);
&tf->tf_special.psr, &tf->tf_special.fpsr,
&tf->tf_special.isr, &tf->tf_special.pr,
&tf->tf_special.cfm, &fp_state);
ia64_disable_highfp();
@ -710,16 +710,16 @@ trap(int vector, struct trapframe *framep)
/* fixed. update ipsr and iip to next insn */
int ei;
ei = (framep->tf_special.isr >> 41) & 0x03;
ei = (tf->tf_special.isr >> 41) & 0x03;
if (ei == 0) { /* no template for this case */
framep->tf_special.psr &= ~IA64_ISR_EI;
framep->tf_special.psr |= IA64_ISR_EI_1;
tf->tf_special.psr &= ~IA64_ISR_EI;
tf->tf_special.psr |= IA64_ISR_EI_1;
} else if (ei == 1) { /* MFI or MFB */
framep->tf_special.psr &= ~IA64_ISR_EI;
framep->tf_special.psr |= IA64_ISR_EI_2;
tf->tf_special.psr &= ~IA64_ISR_EI;
tf->tf_special.psr |= IA64_ISR_EI_2;
} else if (ei == 2) { /* MMF */
framep->tf_special.psr &= ~IA64_ISR_EI;
framep->tf_special.iip += 0x10;
tf->tf_special.psr &= ~IA64_ISR_EI;
tf->tf_special.iip += 0x10;
}
goto out;
} else if (fpswa_ret.status == -1) {
@ -748,7 +748,7 @@ trap(int vector, struct trapframe *framep)
}
case IA64_VEC_IA32_EXCEPTION:
switch ((framep->tf_special.isr >> 16) & 0xffff) {
switch ((tf->tf_special.isr >> 16) & 0xffff) {
case IA32_EXCEPTION_DIVIDE:
ucode = FPE_INTDIV;
sig = SIGFPE;
@ -772,7 +772,7 @@ trap(int vector, struct trapframe *framep)
case IA32_EXCEPTION_NOT_PRESENT:
case IA32_EXCEPTION_STACK_FAULT:
case IA32_EXCEPTION_GPFAULT:
ucode = (framep->tf_special.isr & 0xffff) +
ucode = (tf->tf_special.isr & 0xffff) +
BUS_SEGM_FAULT;
sig = SIGBUS;
break;
@ -781,7 +781,7 @@ trap(int vector, struct trapframe *framep)
sig = SIGFPE;
break;
case IA32_EXCEPTION_ALIGNMENT_CHECK:
ucode = framep->tf_special.ifa; /* VA */
ucode = tf->tf_special.ifa; /* VA */
sig = SIGBUS;
break;
case IA32_EXCEPTION_STREAMING_SIMD:
@ -789,46 +789,46 @@ trap(int vector, struct trapframe *framep)
sig = SIGFPE;
break;
default:
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
}
break;
case IA64_VEC_IA32_INTERCEPT:
/* XXX Maybe need to emulate ia32 instruction. */
trap_panic(vector, framep);
trap_panic(vector, tf);
case IA64_VEC_IA32_INTERRUPT:
/* INT n instruction - probably a syscall. */
if (((framep->tf_special.isr >> 16) & 0xffff) == 0x80) {
ia32_syscall(framep);
if (((tf->tf_special.isr >> 16) & 0xffff) == 0x80) {
ia32_syscall(tf);
goto out;
}
ucode = (framep->tf_special.isr >> 16) & 0xffff;
ucode = (tf->tf_special.isr >> 16) & 0xffff;
sig = SIGILL;
break;
default:
/* Reserved vectors get here. Should never happen of course. */
trap_panic(vector, framep);
trap_panic(vector, tf);
break;
}
KASSERT(sig != 0, ("foo"));
if (print_usertrap)
printtrap(vector, framep, 1, user);
printtrap(vector, tf, 1, user);
trapsignal(td, sig, ucode);
out:
if (user) {
userret(td, framep, sticks);
userret(td, tf, sticks);
mtx_assert(&Giant, MA_NOTOWNED);
#ifdef DIAGNOSTIC
cred_free_thread(td);
#endif
do_ast(framep);
do_ast(tf);
}
return;
}
@ -1012,7 +1012,7 @@ syscall(struct trapframe *tf)
#include <i386/include/psl.h>
static void
ia32_syscall(struct trapframe *framep)
ia32_syscall(struct trapframe *tf)
{
caddr_t params;
int i;
@ -1034,19 +1034,19 @@ ia32_syscall(struct trapframe *framep)
cnt.v_syscall++;
sticks = td->td_sticks;
td->td_frame = framep;
td->td_frame = tf;
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
params = (caddr_t)(framep->tf_special.sp & ((1L<<32)-1))
params = (caddr_t)(tf->tf_special.sp & ((1L<<32)-1))
+ sizeof(u_int32_t);
code = framep->tf_scratch.gr8; /* eax */
code = tf->tf_scratch.gr8; /* eax */
orig_eflags = ia64_get_eflag();
if (p->p_sysent->sv_prepsyscall) {
/*
* The prep code is MP aware.
*/
(*p->p_sysent->sv_prepsyscall)(framep, args, &code, &params);
(*p->p_sysent->sv_prepsyscall)(tf, args, &code, &params);
} else {
/*
* Need to check if this is a 32 bit or 64 bit syscall.
@ -1105,7 +1105,7 @@ ia32_syscall(struct trapframe *framep)
if (error == 0) {
td->td_retval[0] = 0;
td->td_retval[1] = framep->tf_scratch.gr10; /* edx */
td->td_retval[1] = tf->tf_scratch.gr10; /* edx */
STOPEVENT(p, S_SCE, narg);
@ -1114,8 +1114,8 @@ ia32_syscall(struct trapframe *framep)
switch (error) {
case 0:
framep->tf_scratch.gr8 = td->td_retval[0]; /* eax */
framep->tf_scratch.gr10 = td->td_retval[1]; /* edx */
tf->tf_scratch.gr8 = td->td_retval[0]; /* eax */
tf->tf_scratch.gr10 = td->td_retval[1]; /* edx */
ia64_set_eflag(ia64_get_eflag() & ~PSL_C);
break;
@ -1124,7 +1124,7 @@ ia32_syscall(struct trapframe *framep)
* Reconstruct pc, assuming lcall $X,y is 7 bytes,
* int 0x80 is 2 bytes. XXX Assume int 0x80.
*/
framep->tf_special.iip -= 2;
tf->tf_special.iip -= 2;
break;
case EJUSTRETURN:
@ -1137,7 +1137,7 @@ ia32_syscall(struct trapframe *framep)
else
error = p->p_sysent->sv_errtbl[error];
}
framep->tf_scratch.gr8 = error;
tf->tf_scratch.gr8 = error;
ia64_set_eflag(ia64_get_eflag() | PSL_C);
break;
}
@ -1159,7 +1159,7 @@ ia32_syscall(struct trapframe *framep)
/*
* Handle reschedule and other end-of-syscall issues
*/
userret(td, framep, sticks);
userret(td, tf, sticks);
#ifdef KTRACE
if (KTRPOINT(td, KTR_SYSRET))