diff options
author | julian <julian@FreeBSD.org> | 2001-09-12 08:38:13 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2001-09-12 08:38:13 +0000 |
commit | 5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch) | |
tree | b1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/amd64/amd64/trap.c | |
parent | 83e00d4274950d2b531c24692cd123538ffbddb9 (diff) | |
download | FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz |
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/amd64/amd64/trap.c')
-rw-r--r-- | sys/amd64/amd64/trap.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 4e72f9b..ee036c2 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -173,7 +173,8 @@ void trap(frame) struct trapframe frame; { - struct proc *p = curproc; + struct thread *td = curthread; + struct proc *p = td->td_proc; u_int sticks = 0; int i = 0, ucode = 0, type, code; vm_offset_t eva; @@ -225,8 +226,8 @@ restart: ((frame.tf_eflags & PSL_VM) && !in_vm86call)) { /* user trap */ - sticks = p->p_sticks; - p->p_frame = &frame; + sticks = td->td_kse->ke_sticks; + td->td_frame = &frame; switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ @@ -444,7 +445,7 @@ restart: if (in_vm86call) break; - if (p->p_intr_nesting_level != 0) + if (td->td_intr_nesting_level != 0) break; /* @@ -620,7 +621,7 @@ restart: #endif user: - userret(p, &frame, sticks); + userret(td, &frame, sticks); if (mtx_owned(&Giant)) /* XXX why would Giant be owned here? */ mtx_unlock(&Giant); out: @@ -660,7 +661,7 @@ trap_pfault(frame, usermode, eva) if (p == NULL || (!usermode && va < VM_MAXUSER_ADDRESS && - (p->p_intr_nesting_level != 0 || + (td->td_intr_nesting_level != 0 || PCPU_GET(curpcb) == NULL || PCPU_GET(curpcb)->pcb_onfault == NULL))) { trap_fatal(frame, eva); @@ -696,7 +697,7 @@ trap_pfault(frame, usermode, eva) * a growable stack region, or if the stack * growth succeeded. */ - if (!grow_stack (p, va)) + if (!grow_stack (td, va)) rv = KERN_FAILURE; else /* Fault in the user page: */ @@ -728,7 +729,7 @@ trap_pfault(frame, usermode, eva) return (0); nogo: if (!usermode) { - if (p->p_intr_nesting_level == 0 && + if (td->td_intr_nesting_level == 0 && PCPU_GET(curpcb) != NULL && PCPU_GET(curpcb)->pcb_onfault != NULL) { frame->tf_eip = (int)PCPU_GET(curpcb)->pcb_onfault; @@ -756,7 +757,8 @@ trap_pfault(frame, usermode, eva) vm_map_t map = 0; int rv = 0; vm_prot_t ftype; - struct proc *p = curproc; + struct thread *td = curthread; + struct proc *p = td->td_proc; va = trunc_page(eva); if (va >= KERNBASE) { @@ -839,7 +841,7 @@ trap_pfault(frame, usermode, eva) return (0); nogo: if (!usermode) { - if (p->p_intr_nesting_level == 0 && + if (td->td_intr_nesting_level == 0 && PCPU_GET(curpcb) != NULL && PCPU_GET(curpcb)->pcb_onfault != NULL) { frame->tf_eip = (int)PCPU_GET(curpcb)->pcb_onfault; @@ -972,6 +974,7 @@ dblfault_handler() int trapwrite(addr) unsigned addr; { + struct thread *td; struct proc *p; vm_offset_t va; struct vmspace *vm; @@ -984,7 +987,8 @@ int trapwrite(addr) if (va >= VM_MAXUSER_ADDRESS) return (1); - p = curproc; + td = curthread; + p = td->td_proc; vm = p->p_vmspace; PROC_LOCK(p); @@ -1021,7 +1025,8 @@ syscall(frame) caddr_t params; int i; struct sysent *callp; - struct proc *p = curproc; + struct thread *td = curthread; + struct proc *p = td->td_proc; u_int sticks; int error; int narg; @@ -1039,8 +1044,8 @@ syscall(frame) } #endif - sticks = p->p_sticks; - p->p_frame = &frame; + sticks = td->td_kse->ke_sticks; + td->td_frame = &frame; params = (caddr_t)frame.tf_esp + sizeof(int); code = frame.tf_eax; @@ -1109,17 +1114,17 @@ syscall(frame) ktrsyscall(p->p_tracep, code, narg, args); } #endif - p->p_retval[0] = 0; - p->p_retval[1] = frame.tf_edx; + td->td_retval[0] = 0; + td->td_retval[1] = frame.tf_edx; STOPEVENT(p, S_SCE, narg); - error = (*callp->sy_call)(p, args); + error = (*callp->sy_call)(td, args); switch (error) { case 0: - frame.tf_eax = p->p_retval[0]; - frame.tf_edx = p->p_retval[1]; + frame.tf_eax = td->td_retval[0]; + frame.tf_edx = td->td_retval[1]; frame.tf_eflags &= ~PSL_C; break; @@ -1158,11 +1163,11 @@ bad: /* * Handle reschedule and other end-of-syscall issues */ - userret(p, &frame, sticks); + userret(td, &frame, sticks); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - ktrsysret(p->p_tracep, code, error, p->p_retval[0]); + ktrsysret(p->p_tracep, code, error, td->td_retval[0]); } #endif @@ -1183,7 +1188,7 @@ bad: STOPEVENT(p, S_SCX, code); #ifdef WITNESS - if (witness_list(p)) { + if (witness_list(td)) { panic("system call %s returning with mutex(s) held\n", syscallnames[code]); } |