remove support for double-mapping the user area and kernel stack.
This commit is contained in:
parent
6203812f8d
commit
a7b2a08bc6
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: genassym.c,v 1.1 1995/02/13 23:06:57 cgd Exp $ */
|
||||
/* $NetBSD: genassym.c,v 1.2 1995/03/24 15:07:10 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
@ -145,7 +145,6 @@ main()
|
||||
off("P_VMSPACE", struct proc, p_vmspace);
|
||||
off("P_MD_FLAGS", struct proc, p_md.md_flags);
|
||||
off("P_MD_PCBPADDR", struct proc, p_md.md_pcbpaddr);
|
||||
off("P_MD_UPTE", struct proc, p_md.md_upte[0]);
|
||||
off("PH_LINK", struct prochd, ph_link);
|
||||
off("PH_RLINK", struct prochd, ph_rlink);
|
||||
|
||||
@ -155,9 +154,6 @@ main()
|
||||
|
||||
/* Important offsets into the user struct & associated constants */
|
||||
def("UPAGES", UPAGES);
|
||||
def("SYSMAP_UPTES", SYSMAP_UPTES);
|
||||
def("UADDR", UADDR);
|
||||
def("KSTACKTOP", KSTACKTOP);
|
||||
off("U_PCB", struct user, u_pcb);
|
||||
off("U_PCB_KSP", struct user, u_pcb.pcb_ksp);
|
||||
off("U_PCB_CONTEXT", struct user, u_pcb.pcb_context[0]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.2 1995/03/09 12:05:34 mycroft Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.3 1995/03/24 15:07:13 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
@ -81,22 +81,8 @@ NESTED(__start,1,0,ra,0,0)
|
||||
CALL(pal_wrvptptr)
|
||||
|
||||
/*
|
||||
* Switch to proc0's PCB, which is at U_PCB off of proc0paddr,
|
||||
* and map its upages in at UADDR.
|
||||
* Switch to proc0's PCB, which is at U_PCB off of proc0paddr.
|
||||
*/
|
||||
lda t0, proc0
|
||||
CONST(UPAGES, t1) /* t1 = # of pages to map */
|
||||
lda t2, P_MD_UPTE(t0) /* t2 = &proc0->p_md.md_upte */
|
||||
ldq t3, Sysmap /* t3 = &Sysmap[UMAPPING] */
|
||||
lda t3, (SYSMAP_UPTES * 8)(t3)
|
||||
5:
|
||||
ldq t0, 0(t2) /* load pte from md_upte */
|
||||
addq t2, 8, t2 /* increment "from" pointer */
|
||||
stq t0, 0(t3) /* store pte to Sysmap */
|
||||
addq t3, 8, t3 /* increment "to" pointer */
|
||||
subq t1, 1, t1 /* decrement number to do */
|
||||
bne t1, 5b
|
||||
|
||||
lda t0,proc0 /* get phys addr of pcb */
|
||||
ldq a0,P_MD_PCBPADDR(t0)
|
||||
call_pal PAL_OSF1_swpctx
|
||||
@ -719,40 +705,16 @@ LEAF(restorefpstate, 1)
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
/*
|
||||
* copykstack: Copy a process's kernel stack
|
||||
*
|
||||
* Arguments:
|
||||
* a0 'struct user *' of new process
|
||||
*/
|
||||
|
||||
.set at
|
||||
LEAF(copykstack, 1)
|
||||
SETGP(pv)
|
||||
mov sp, t0 /* t0 = old stack address ("from") */
|
||||
subq t0, UADDR, t1 /* compute offset from U to stack */
|
||||
addq a0, t1, t1 /* t1 = new stack address ("to") */
|
||||
lda t2, KSTACKTOP
|
||||
subq t2, sp, t2 /* t2 = number of bytes to copy */
|
||||
|
||||
ble t2, 2f /* make sure we have work to do */
|
||||
1:
|
||||
subq t2, 8, t2 /* mark 8 as having been copied */
|
||||
ldq t3, 0(t0) /* bring in a quad of the stack */
|
||||
addq t0, 8, t0 /* increment the "from" pointer */
|
||||
stq t3, 0(t1) /* store the quad */
|
||||
addq t1, 8, t1 /* increment the "to" pointer */
|
||||
bgt t2, 1b
|
||||
2:
|
||||
|
||||
/*
|
||||
* savectx: save process context, i.e. callee-saved registers
|
||||
*
|
||||
* Note that savectx() only works for processes other than curproc,
|
||||
* since cpu_switch will copy over the info saved here.
|
||||
* since cpu_switch will copy over the info saved here. (It _can_
|
||||
* sanely be used for curproc iff cpu_switch won't be called again, e.g.
|
||||
* from if called from boot().)
|
||||
*
|
||||
* Arguments:
|
||||
* a0 'struct user *' of process who needs context saved
|
||||
* a0 'struct user *' of the process that needs its context saved
|
||||
*
|
||||
* Return:
|
||||
* v0 0. (note that for child processes, it seems
|
||||
@ -760,7 +722,7 @@ LEAF(copykstack, 1)
|
||||
* in the PCB is set to the return address from savectx().)
|
||||
*/
|
||||
|
||||
XLEAF(savectx, 2)
|
||||
LEAF(savectx, 1)
|
||||
br pv, 1f
|
||||
1: SETGP(pv)
|
||||
stq sp, U_PCB_KSP(a0) /* store sp */
|
||||
@ -777,7 +739,7 @@ XLEAF(savectx, 2)
|
||||
|
||||
mov zero, v0
|
||||
RET
|
||||
END(copykstack)
|
||||
END(savectx)
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
@ -815,7 +777,8 @@ LEAF(idle, 0)
|
||||
LEAF(cpu_switch, 0)
|
||||
SETGP(pv)
|
||||
/* do an inline savectx(), to save old context */
|
||||
lda a0, UADDR
|
||||
ldq a0, curproc
|
||||
ldq a0, P_ADDR(a0)
|
||||
/* NOTE: ksp is stored by the swpctx */
|
||||
stq s0, U_PCB_CONTEXT+(0 * 8)(a0) /* store s0 - s6 */
|
||||
stq s1, U_PCB_CONTEXT+(1 * 8)(a0)
|
||||
@ -883,19 +846,6 @@ sw1:
|
||||
ldq t5, P_MD_PCBPADDR(t4) /* t5 = p->p_md.md_pcbpaddr */
|
||||
stq t5, curpcb /* and store it in curpcb */
|
||||
|
||||
/* Replace the PTE's to map the u struct. */
|
||||
CONST(UPAGES, t1) /* t1 = # of pages to map */
|
||||
lda t2, P_MD_UPTE(t4) /* t2 = &p->p_md.md_upte */
|
||||
ldq t3, Sysmap /* t3 = &Sysmap[UMAPPING] */
|
||||
lda t3, (SYSMAP_UPTES * 8)(t3)
|
||||
6:
|
||||
ldq t0, 0(t2) /* load pte from md_upte */
|
||||
addq t2, 8, t2 /* increment "from" pointer */
|
||||
stq t0, 0(t3) /* store pte to Sysmap */
|
||||
addq t3, 8, t3 /* increment "to" pointer */
|
||||
subq t1, 1, t1 /* decrement number to do */
|
||||
bne t1, 6b
|
||||
|
||||
/*
|
||||
* Do the context swap, and invalidate old TLB entries (XXX).
|
||||
* XXX should do the ASN thing, and therefore not have to invalidate.
|
||||
@ -913,7 +863,8 @@ sw1:
|
||||
* Now running on the new u struct.
|
||||
* Restore registers and return.
|
||||
*/
|
||||
lda t0, UADDR
|
||||
ldq t0, curproc
|
||||
ldq t0, P_ADDR(t0)
|
||||
/* NOTE: ksp is restored by the swpctx */
|
||||
ldq s0, U_PCB_CONTEXT+(0 * 8)(t0) /* restore s0 - s6 */
|
||||
ldq s1, U_PCB_CONTEXT+(1 * 8)(t0)
|
||||
@ -931,6 +882,22 @@ sw1:
|
||||
RET
|
||||
END(cpu_switch)
|
||||
|
||||
/*
|
||||
* proc_trampoline()
|
||||
*
|
||||
* Arrange for a function to be invoked neatly, after a cpu_switch().
|
||||
*
|
||||
* Invokes the function specified by the s0 register with the return
|
||||
* address specified by the s1 register and with one argument, a
|
||||
* pointer to the executing process's proc structure.
|
||||
*/
|
||||
LEAF(proc_trampoline, 0)
|
||||
mov s0, pv
|
||||
mov s1, ra
|
||||
ldq a0, curproc
|
||||
jmp zero, (pv)
|
||||
END(proc_trampoline)
|
||||
|
||||
/*
|
||||
* switch_exit(struct proc *p)
|
||||
* Make a the named process exit. Partially switch to proc0, unmap
|
||||
@ -948,19 +915,6 @@ LEAF(switch_exit, 1)
|
||||
ldq t5, P_MD_PCBPADDR(t4) /* t5 = p->p_md.md_pcbpaddr */
|
||||
stq t5, curpcb /* and store it in curpcb */
|
||||
|
||||
/* Replace the PTE's to map the u struct. */
|
||||
CONST(UPAGES, t1) /* t1 = # of pages to map */
|
||||
lda t2, P_MD_UPTE(t4) /* t2 = &p->p_md.md_upte */
|
||||
ldq t3, Sysmap /* t3 = &Sysmap[UMAPPING] */
|
||||
lda t3, (SYSMAP_UPTES * 8)(t3)
|
||||
5:
|
||||
ldq t0, 0(t2) /* load pte from md_upte */
|
||||
addq t2, 8, t2 /* increment "from" pointer */
|
||||
stq t0, 0(t3) /* store pte to Sysmap */
|
||||
addq t3, 8, t3 /* increment "to" pointer */
|
||||
subq t1, 1, t1 /* decrement number to do */
|
||||
bne t1, 5b
|
||||
|
||||
/*
|
||||
* Do the context swap, and invalidate old TLB entries (XXX).
|
||||
* XXX should do the ASN thing, and therefore not have to invalidate.
|
||||
@ -1041,12 +995,14 @@ NESTED(copyinstr, 4, 16, ra, 0, 0)
|
||||
beq t1, copyerr /* if it's not, error out. */
|
||||
lda v0, copyerr /* set up fault handler. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq v0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
CALL(copystr) /* do the copy. */
|
||||
.set noat
|
||||
lda at_reg, UADDR /* kill the fault handler. */
|
||||
ldq at_reg, curproc /* kill the fault handler. */
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
ldq ra, (16-8)(sp) /* restore ra. */
|
||||
@ -1063,12 +1019,14 @@ NESTED(copyoutstr, 4, 16, ra, 0, 0)
|
||||
beq t1, copyerr /* if it's not, error out. */
|
||||
lda v0, copyerr /* set up fault handler. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq v0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
CALL(copystr) /* do the copy. */
|
||||
.set noat
|
||||
lda at_reg, UADDR /* kill the fault handler. */
|
||||
ldq at_reg, curproc /* kill the fault handler. */
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
ldq ra, (16-8)(sp) /* restore ra. */
|
||||
@ -1114,12 +1072,14 @@ NESTED(copyin, 3, 16, ra, 0, 0)
|
||||
beq t1, copyerr /* if it's not, error out. */
|
||||
lda v0, copyerr /* set up fault handler. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq v0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
CALL(bcopy) /* do the copy. */
|
||||
.set noat
|
||||
lda at_reg, UADDR /* kill the fault handler. */
|
||||
ldq at_reg, curproc /* kill the fault handler. */
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
ldq ra, (16-8)(sp) /* restore ra. */
|
||||
@ -1136,12 +1096,14 @@ NESTED(copyout, 3, 16, ra, 0, 0)
|
||||
beq t1, copyerr /* if it's not, error out. */
|
||||
lda v0, copyerr /* set up fault handler. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq v0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
CALL(bcopy) /* do the copy. */
|
||||
.set noat
|
||||
lda at_reg, UADDR /* kill the fault handler. */
|
||||
ldq at_reg, curproc /* kill the fault handler. */
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
ldq ra, (16-8)(sp) /* restore ra. */
|
||||
@ -1174,13 +1136,15 @@ XLEAF(fuiword, 1)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
ldq v0, 0(a0)
|
||||
zap v0, 0xf0, v0
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
RET
|
||||
@ -1194,12 +1158,14 @@ XLEAF(fuisword, 1)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX FETCH IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
RET
|
||||
@ -1213,12 +1179,14 @@ XLEAF(fuibyte, 1)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX FETCH IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
RET
|
||||
@ -1232,12 +1200,14 @@ LEAF(suword, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
stq a1, 0(a0) /* do the wtore. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
mov zero, v0
|
||||
@ -1252,12 +1222,14 @@ LEAF(suiword, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX STORE IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
call_pal PAL_OSF1_imb /* sync instruction stream */
|
||||
@ -1272,12 +1244,14 @@ LEAF(susword, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX STORE IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
mov zero, v0
|
||||
@ -1291,12 +1265,14 @@ LEAF(suisword, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX STORE IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
call_pal PAL_OSF1_imb /* sync instruction stream */
|
||||
@ -1312,7 +1288,8 @@ LEAF(subyte, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
zap a1, 0xfe, a1 /* kill arg's high bytes */
|
||||
@ -1322,7 +1299,8 @@ LEAF(subyte, 2)
|
||||
or t0, a1, a1 /* put the result together */
|
||||
stq_u a1, 0(a0) /* and store it. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
mov zero, v0
|
||||
@ -1336,7 +1314,8 @@ LEAF(suibyte, 2)
|
||||
beq t1, fswberr /* if it's not, error out. */
|
||||
lda t0, fswberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
zap a1, 0xfe, a1 /* kill arg's high bytes */
|
||||
@ -1346,7 +1325,8 @@ LEAF(suibyte, 2)
|
||||
or t0, a1, a1 /* put the result together */
|
||||
stq_u a1, 0(a0) /* and store it. */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
call_pal PAL_OSF1_imb /* sync instruction stream */
|
||||
@ -1376,12 +1356,14 @@ LEAF(fuswintr, 2)
|
||||
beq t1, fswintrberr /* if it's not, error out. */
|
||||
lda t0, fswintrberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX FETCH IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
RET
|
||||
@ -1394,12 +1376,14 @@ LEAF(suswintr, 2)
|
||||
beq t1, fswintrberr /* if it's not, error out. */
|
||||
lda t0, fswintrberr
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq t0, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
/* XXX STORE IT */
|
||||
.set noat
|
||||
lda at_reg, UADDR
|
||||
ldq at_reg, curproc
|
||||
ldq at_reg, P_ADDR(at_reg)
|
||||
stq zero, U_PCB_ONFAULT(at_reg)
|
||||
.set at
|
||||
mov zero, v0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.2 1995/03/08 00:38:53 cgd Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.3 1995/03/24 15:07:15 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -412,7 +412,7 @@ pmap_bootstrap(firstaddr, ptaddr)
|
||||
avail_end = alpha_ptob(maxmem);
|
||||
mem_size = avail_end - avail_start;
|
||||
|
||||
virtual_avail = VM_MIN_KERNEL_ADDRESS + (SYSMAP_UPTES + UPAGES) * NBPG;
|
||||
virtual_avail = VM_MIN_KERNEL_ADDRESS;
|
||||
virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
|
||||
|
||||
simple_lock_init(&kernel_pmap_store.pm_lock);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.old.c,v 1.2 1995/03/08 00:38:53 cgd Exp $ */
|
||||
/* $NetBSD: pmap.old.c,v 1.3 1995/03/24 15:07:15 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -412,7 +412,7 @@ pmap_bootstrap(firstaddr, ptaddr)
|
||||
avail_end = alpha_ptob(maxmem);
|
||||
mem_size = avail_end - avail_start;
|
||||
|
||||
virtual_avail = VM_MIN_KERNEL_ADDRESS + (SYSMAP_UPTES + UPAGES) * NBPG;
|
||||
virtual_avail = VM_MIN_KERNEL_ADDRESS;
|
||||
virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
|
||||
|
||||
simple_lock_init(&kernel_pmap_store.pm_lock);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: process_machdep.c,v 1.1 1995/02/13 23:07:08 cgd Exp $ */
|
||||
/* $NetBSD: process_machdep.c,v 1.2 1995/03/24 15:07:17 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
@ -73,8 +73,7 @@ process_read_regs(p, regs)
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
frame = (struct trapframe *)
|
||||
((char *)p->p_addr + ((char *)p->p_md.md_tf - (char *)KSTACK));
|
||||
frame = p->p_md.md_tf;
|
||||
|
||||
frametoreg(frame, regs);
|
||||
|
||||
@ -91,8 +90,7 @@ process_write_regs(p, regs)
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
frame = (struct trapframe *)
|
||||
((char *)p->p_addr + ((char *)p->p_md.md_tf - (char *)KSTACK));
|
||||
frame = p->p_md.md_tf;
|
||||
|
||||
regtoframe(regs, frame);
|
||||
|
||||
@ -121,8 +119,7 @@ process_set_pc(p, addr)
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
frame = (struct trapframe *)
|
||||
((char *)p->p_addr + ((char *)p->p_md.md_tf - (char *)KSTACK));
|
||||
frame = p->p_md.md_tf;
|
||||
|
||||
frame->tf_pc = (u_int64_t)addr;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.1 1995/02/13 23:07:17 cgd Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.2 1995/03/24 15:07:19 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
@ -142,20 +142,12 @@ cpu_fork(p1, p2)
|
||||
p2->p_md.md_flags = p1->p_md.md_flags & MDP_FPUSED;
|
||||
|
||||
/*
|
||||
* Cache the PTEs for the user area in the machine dependent
|
||||
* part of the proc struct so cpu_switch() can quickly map in
|
||||
* the user struct and kernel stack. Note: if the virtual address
|
||||
* translation changes (e.g. swapout) we have to update this.
|
||||
* Also cache the physical address of the pcb, so we can
|
||||
* Cache the physical address of the pcb, so we can
|
||||
* swap to it easily.
|
||||
*/
|
||||
ptep = kvtopte(up);
|
||||
p2->p_md.md_pcbpaddr =
|
||||
&((struct user *)(PG_PFNUM(*ptep) << PGSHIFT))->u_pcb;
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
p2->p_md.md_upte[i] = *ptep & ~PG_ASM;
|
||||
ptep++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy floating point state from the FP chip to the PCB
|
||||
@ -185,15 +177,69 @@ cpu_fork(p1, p2)
|
||||
if (up->u_pcb.pcb_fen != 0)
|
||||
printf("DANGER WILL ROBINSON: FEN SET IN cpu_fork!\n");
|
||||
#endif
|
||||
if (copykstack(up)) {
|
||||
|
||||
/*
|
||||
* create the child's kernel stack, from scratch.
|
||||
*/
|
||||
{
|
||||
struct trapframe *p2tf;
|
||||
extern void rei();
|
||||
|
||||
/*
|
||||
* Return 1 in child.
|
||||
* Pick a stack pointer, leaving room for a trapframe;
|
||||
* copy trapframe from parent so return to user mode
|
||||
* will be to right address, with correct registers.
|
||||
*/
|
||||
return (1);
|
||||
p2tf = p2->p_md.md_tf = (struct trapframe *)
|
||||
((char *)p2->p_addr + USPACE - sizeof(struct trapframe));
|
||||
bcopy(p1->p_md.md_tf, p2->p_md.md_tf,
|
||||
sizeof(struct trapframe));
|
||||
|
||||
/*
|
||||
* Set up return-value registers as fork() libc stub expects.
|
||||
*/
|
||||
p2tf->tf_regs[FRAME_V0] = p1->p_pid; /* parent's pid */
|
||||
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
|
||||
p2tf->tf_regs[FRAME_A4] = 1; /* is child */
|
||||
|
||||
/*
|
||||
* Arrange for continuation at rei(). Note that the
|
||||
* child process doesn't stay in the kernel for long!
|
||||
*/
|
||||
up->u_pcb.pcb_ksp = (u_int64_t)p2tf;
|
||||
up->u_pcb.pcb_context[7] = (u_int64_t)rei;
|
||||
up->u_pcb.pcb_context[8] = 0;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* cpu_set_pc:
|
||||
*
|
||||
* Arrange for in-kernel execution of a process to continue at the
|
||||
* named pc, as if the code at that address were called as a function
|
||||
* with argument, the current process's process pointer.
|
||||
*
|
||||
* Note that it's assumed that when the named process returns, rei()
|
||||
* should be invoked, to return to user mode.
|
||||
*/
|
||||
void
|
||||
cpu_set_kpc(p, pc)
|
||||
struct proc *p;
|
||||
u_int64_t pc;
|
||||
{
|
||||
struct pcb *pcbp;
|
||||
extern void proc_trampoline();
|
||||
extern void rei();
|
||||
|
||||
pcbp = &p->p_addr->u_pcb;
|
||||
pcbp->pcb_context[0] = pc; /* s0 - pc to invoke */
|
||||
pcbp->pcb_context[1] = (u_int64_t)rei; /* s1 - return address */
|
||||
pcbp->pcb_context[7] =
|
||||
(u_int64_t)proc_trampoline; /* ra - assembly magic */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finish a swapin operation.
|
||||
* We neded to update the cached PTEs for the user area in the
|
||||
@ -208,18 +254,12 @@ cpu_swapin(p)
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Cache the PTEs for the user area in the machine dependent
|
||||
* part of the proc struct so cpu_switch() can quickly map in
|
||||
* the user struct and kernel stack. Also cache the physical
|
||||
* address of the pcb, so we can swap to it easily.
|
||||
* Cache the physical address of the pcb, so we can swap to
|
||||
* it easily.
|
||||
*/
|
||||
ptep = kvtopte(up);
|
||||
p->p_md.md_pcbpaddr =
|
||||
&((struct user *)(PG_PFNUM(*ptep) << PGSHIFT))->u_pcb;
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
p->p_md.md_upte[i] = *ptep & ~PG_ASM;
|
||||
ptep++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user