swtch() ==> cpu_switch(), add cpu_coredump()
This commit is contained in:
parent
7424fd59cf
commit
606b694dfe
|
@ -40,7 +40,7 @@
|
|||
*
|
||||
* from: @(#)locore.s 7.11 (Berkeley) 5/9/91
|
||||
* locore.s,v 1.2 1993/05/22 07:57:30 cgd Exp
|
||||
* $Id: process.s,v 1.13 1994/05/16 16:49:39 gwr Exp $
|
||||
* $Id: process.s,v 1.14 1994/05/20 04:40:20 gwr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -126,7 +126,7 @@ Lrem2:
|
|||
Lrem3:
|
||||
.asciz "remrq"
|
||||
Lsw0:
|
||||
.asciz "swtch"
|
||||
.asciz "cpu_switch"
|
||||
.even
|
||||
|
||||
.globl _curpcb
|
||||
|
@ -145,18 +145,18 @@ pcbflag:
|
|||
.text
|
||||
|
||||
/*
|
||||
* At exit of a process, do a swtch for the last time.
|
||||
* At exit of a process, do a cpu_switch for the last time.
|
||||
* The mapping of the pcb at p->p_addr has already been deleted,
|
||||
* and the memory for the pcb+stack has been freed.
|
||||
* The ipl is high enough to prevent the memory from being reallocated.
|
||||
*/
|
||||
ENTRY(swtch_exit)
|
||||
ENTRY(switch_exit)
|
||||
movl #nullpcb,_curpcb | save state into garbage pcb
|
||||
lea tmpstk,sp | goto a tmp stack
|
||||
jra _swtch
|
||||
jra _cpu_switch
|
||||
|
||||
/*
|
||||
* When no processes are on the runq, Swtch branches to idle
|
||||
* When no processes are on the runq, cpu_switch() branches to idle
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
.globl Idle
|
||||
|
@ -179,11 +179,11 @@ Lbadsw:
|
|||
|
||||
.globl _load_u_area;
|
||||
/*
|
||||
* Swtch()
|
||||
* cpu_switch()
|
||||
*
|
||||
* Hacked for sun3
|
||||
*/
|
||||
ENTRY(swtch)
|
||||
ENTRY(cpu_switch)
|
||||
movl _curpcb,a0 | current pcb
|
||||
movw sr,a0@(PCB_PS) | save sr before changing ipl
|
||||
#ifdef notyet
|
||||
|
@ -313,8 +313,8 @@ Lresfprest:
|
|||
|
||||
/*
|
||||
* savectx(pcb, altreturn)
|
||||
* Update pcb, saving current processor state and arranging
|
||||
* for alternate return ala longjmp in swtch if altreturn is true.
|
||||
* Update pcb, saving current processor state and arranging for
|
||||
* alternate return ala longjmp in cpu_switch if altreturn is true.
|
||||
*/
|
||||
ENTRY(savectx)
|
||||
movl sp@(4),a1
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* from: Utah Hdr: trap.c 1.32 91/04/06
|
||||
* from: @(#)trap.c 7.15 (Berkeley) 8/2/91
|
||||
* trap.c,v 1.3 1993/07/07 07:08:47 cgd Exp
|
||||
* $Id: trap.c,v 1.20 1994/05/16 16:49:41 gwr Exp $
|
||||
* $Id: trap.c,v 1.21 1994/05/20 04:40:23 gwr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -58,7 +58,6 @@
|
|||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/endian.h>
|
||||
#include <machine/mtpr.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/reg.h>
|
||||
|
@ -137,7 +136,7 @@ void userret(p, pc, oticks)
|
|||
int pc;
|
||||
u_quad_t oticks;
|
||||
{
|
||||
int sig;
|
||||
int sig, s;
|
||||
|
||||
while ((sig = CURSIG(p)) !=0)
|
||||
postsig(sig);
|
||||
|
@ -148,14 +147,14 @@ void userret(p, pc, oticks)
|
|||
* our priority without moving us from one queue to another
|
||||
* (since the running process is not on a queue.)
|
||||
* If that happened after we setrunqueue ourselves but
|
||||
* before we swtch()'ed, we might not be on the queue
|
||||
* before we switch()'ed, we might not be on the queue
|
||||
* indicated by our priority.
|
||||
*/
|
||||
(void) splstatclock();
|
||||
s = splstatclock();
|
||||
setrunqueue(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
spl0(); /* XXX - Is this right? -gwr */
|
||||
mi_switch();
|
||||
splx(s); /* XXX - Is this right? was: spl0() */
|
||||
while ((sig = CURSIG(p)) != 0)
|
||||
postsig(sig);
|
||||
}
|
||||
|
@ -163,8 +162,10 @@ void userret(p, pc, oticks)
|
|||
/*
|
||||
* If profiling, charge recent system time to the trapped pc.
|
||||
*/
|
||||
if (p->p_flag & P_PROFIL)
|
||||
addupc_task(p, pc, (int)(p->p_sticks - oticks));
|
||||
if (p->p_flag & P_PROFIL) {
|
||||
extern int psratio;
|
||||
addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
|
||||
}
|
||||
|
||||
curpriority = p->p_priority;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
|
||||
* from: @(#)vm_machdep.c 7.10 (Berkeley) 5/7/91
|
||||
* vm_machdep.c,v 1.3 1993/07/07 07:09:32 cgd Exp
|
||||
* $Id: vm_machdep.c,v 1.14 1994/05/06 07:47:15 gwr Exp $
|
||||
* $Id: vm_machdep.c,v 1.15 1994/05/20 04:40:25 gwr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <sys/malloc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -86,7 +87,7 @@ cpu_fork(p1, p2)
|
|||
* part of the stack. The stack and pcb need to agree;
|
||||
* this is tricky, as the final pcb is constructed by savectx,
|
||||
* but its frame isn't yet on the stack when the stack is copied.
|
||||
* swtch compensates for this when the child eventually runs.
|
||||
* cpu_switch compensates for this when the child eventually runs.
|
||||
* This should be done differently, with a single call
|
||||
* that copies and updates the pcb+stack,
|
||||
* replacing the bcopy and savectx.
|
||||
|
@ -115,23 +116,46 @@ cpu_fork(p1, p2)
|
|||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space and machine-dependent resources,
|
||||
* including the memory for the user structure and kernel stack.
|
||||
* Once finished, we call swtch_exit, which switches to a temporary
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until swtch_exit has made things safe again.
|
||||
* until switch_exit has made things safe again.
|
||||
*/
|
||||
volatile void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
extern volatile void swtch_exit();
|
||||
extern volatile void switch_exit();
|
||||
vmspace_free(p->p_vmspace);
|
||||
|
||||
(void) splimp();
|
||||
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
|
||||
swtch_exit();
|
||||
switch_exit();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
int
|
||||
cpu_coredump(p, vp, cred)
|
||||
struct proc *p;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
{
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
/*
|
||||
* BLETCH! If we loaded from an HPUX format binary file
|
||||
* we have to dump an HPUX style user struct so that the
|
||||
* HPUX debuggers can grok it.
|
||||
*/
|
||||
if (p->p_addr->u_pcb.pcb_flags & PCB_HPUXBIN)
|
||||
return (hpuxdumpu(vp, cred));
|
||||
else
|
||||
#endif
|
||||
return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES),
|
||||
(off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL,
|
||||
p));
|
||||
}
|
||||
|
||||
|
||||
extern vm_map_t phys_map;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue