mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 10:29:15 +00:00
Rewrote cpu_fork so that it doesn't use pmap_activate, and removed
pmap_activate since it's not used anymore. Changed cpu_fork so that it uses one line of inline assembly rather than calling mvesp() to get the current stack pointer. Removed mvesp() since it is no longer being used.
This commit is contained in:
parent
2834ceec7c
commit
267173e72d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13908
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.27 1996/01/30 12:54:15 davidg Exp $
|
||||
* $Id: swtch.s,v 1.28 1996/02/02 18:30:06 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h" /* for NNPX */
|
||||
@ -501,10 +501,6 @@ swtch_com:
|
||||
sti
|
||||
ret
|
||||
|
||||
ENTRY(mvesp)
|
||||
movl %esp,%eax
|
||||
ret
|
||||
|
||||
/*
|
||||
* savectx(pcb)
|
||||
* Update pcb, saving current processor state.
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.60 1996/01/04 21:10:48 wollman Exp $
|
||||
* $Id: locore.s,v 1.61 1996/01/30 07:59:02 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -106,13 +106,6 @@
|
||||
.globl tmpstk
|
||||
.space 0x2000 /* space for tmpstk - temporary stack */
|
||||
tmpstk:
|
||||
/*
|
||||
* Dummy frame at top of tmpstk to help debuggers print a nice stack trace.
|
||||
*/
|
||||
.long tmpstk+8 /* caller's %ebp */
|
||||
.long _cpu_switch /* caller */
|
||||
.long 0 /* %ebp == 0 should terminate trace */
|
||||
.long _mvesp /* in case %ebp == 0 doesn't work ... */
|
||||
.long 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555
|
||||
|
||||
.globl _boothowto,_bootdev
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.60 1996/01/04 21:10:48 wollman Exp $
|
||||
* $Id: locore.s,v 1.61 1996/01/30 07:59:02 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -106,13 +106,6 @@
|
||||
.globl tmpstk
|
||||
.space 0x2000 /* space for tmpstk - temporary stack */
|
||||
tmpstk:
|
||||
/*
|
||||
* Dummy frame at top of tmpstk to help debuggers print a nice stack trace.
|
||||
*/
|
||||
.long tmpstk+8 /* caller's %ebp */
|
||||
.long _cpu_switch /* caller */
|
||||
.long 0 /* %ebp == 0 should terminate trace */
|
||||
.long _mvesp /* in case %ebp == 0 doesn't work ... */
|
||||
.long 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555
|
||||
|
||||
.globl _boothowto,_bootdev
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.73 1996/01/19 03:57:40 dyson Exp $
|
||||
* $Id: pmap.c,v 1.74 1996/01/19 14:19:56 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -369,15 +369,6 @@ pmap_unuse_pt(pmap, va)
|
||||
}
|
||||
}
|
||||
|
||||
/* [ macro again?, should I force kstack into user map here? -wfj ] */
|
||||
void
|
||||
pmap_activate(pmap, pcbp)
|
||||
register pmap_t pmap;
|
||||
struct pcb *pcbp;
|
||||
{
|
||||
PMAP_ACTIVATE(pmap, pcbp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bootstrap the system enough to run with virtual memory.
|
||||
*
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.27 1996/01/30 12:54:15 davidg Exp $
|
||||
* $Id: swtch.s,v 1.28 1996/02/02 18:30:06 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h" /* for NNPX */
|
||||
@ -501,10 +501,6 @@ swtch_com:
|
||||
sti
|
||||
ret
|
||||
|
||||
ENTRY(mvesp)
|
||||
movl %esp,%eax
|
||||
ret
|
||||
|
||||
/*
|
||||
* savectx(pcb)
|
||||
* Update pcb, saving current processor state.
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
|
||||
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
|
||||
* $Id: vm_machdep.c,v 1.52 1996/01/23 02:39:17 davidg Exp $
|
||||
* $Id: vm_machdep.c,v 1.53 1996/01/30 12:54:21 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -564,8 +564,8 @@ int
|
||||
cpu_fork(p1, p2)
|
||||
register struct proc *p1, *p2;
|
||||
{
|
||||
register struct user *up = p2->p_addr;
|
||||
int offset;
|
||||
struct pcb *pcb2 = &p2->p_addr->u_pcb;
|
||||
int sp, offset;
|
||||
|
||||
/*
|
||||
* Copy pcb and stack from proc p1 to p2.
|
||||
@ -573,23 +573,25 @@ 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.
|
||||
* This should be done differently, with a single call
|
||||
* that copies and updates the pcb+stack,
|
||||
* replacing the bcopy and savectx.
|
||||
*/
|
||||
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
|
||||
offset = mvesp() - (int)kstack;
|
||||
|
||||
__asm __volatile("movl %%esp,%0" : "=r" (sp));
|
||||
offset = sp - (int)kstack;
|
||||
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
|
||||
*pcb2 = p1->p_addr->u_pcb;
|
||||
pcb2->pcb_cr3 = vtophys(p2->p_vmspace->vm_pmap.pm_pdir);
|
||||
|
||||
/*
|
||||
* Return (0) in parent, (1) in child.
|
||||
* Returns (0) in parent, (1) in child.
|
||||
*/
|
||||
return (savectx(&up->u_pcb));
|
||||
return (savectx(pcb2));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.5 1995/11/21 12:52:57 bde Exp $
|
||||
* $Id: md_var.h,v 1.6 1996/01/27 02:33:25 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -59,7 +59,6 @@ void doreti_popl_ds_fault __P((void)) __asm(__STRING(doreti_popl_ds_fault));
|
||||
void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es));
|
||||
void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault));
|
||||
int fill_regs __P((struct proc *p, struct reg *regs));
|
||||
int mvesp __P((void));
|
||||
void userconfig __P((void));
|
||||
void vm_bounce_init __P((void));
|
||||
int vm_page_zero_idle __P((void));
|
||||
|
@ -42,7 +42,7 @@
|
||||
*
|
||||
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
|
||||
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
|
||||
* $Id: pmap.h,v 1.31 1995/12/17 07:39:05 bde Exp $
|
||||
* $Id: pmap.h,v 1.32 1996/01/30 22:54:48 mpp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_PMAP_H_
|
||||
@ -158,20 +158,6 @@ typedef struct pmap *pmap_t;
|
||||
extern pmap_t kernel_pmap;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for speed
|
||||
*/
|
||||
#define PMAP_ACTIVATE(pmapp, pcbp) \
|
||||
if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \
|
||||
(pcbp)->pcb_cr3 = \
|
||||
pmap_extract(kernel_pmap, (vm_offset_t)(pmapp)->pm_pdir); \
|
||||
if ((pmapp) == &curproc->p_vmspace->vm_pmap) \
|
||||
load_cr3((pcbp)->pcb_cr3); \
|
||||
(pmapp)->pm_pdchanged = FALSE; \
|
||||
}
|
||||
|
||||
#define PMAP_DEACTIVATE(pmapp, pcbp)
|
||||
|
||||
/*
|
||||
* For each vm_page_t, there is a list of all currently valid virtual
|
||||
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
|
||||
@ -205,7 +191,6 @@ extern vm_offset_t virtual_end;
|
||||
|
||||
struct pcb;
|
||||
|
||||
void pmap_activate __P((pmap_t, struct pcb *));
|
||||
void pmap_bootstrap __P(( vm_offset_t, vm_offset_t));
|
||||
pmap_t pmap_kernel __P((void));
|
||||
void *pmap_mapdev __P((vm_offset_t, vm_size_t));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.60 1996/01/04 21:10:48 wollman Exp $
|
||||
* $Id: locore.s,v 1.61 1996/01/30 07:59:02 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -106,13 +106,6 @@
|
||||
.globl tmpstk
|
||||
.space 0x2000 /* space for tmpstk - temporary stack */
|
||||
tmpstk:
|
||||
/*
|
||||
* Dummy frame at top of tmpstk to help debuggers print a nice stack trace.
|
||||
*/
|
||||
.long tmpstk+8 /* caller's %ebp */
|
||||
.long _cpu_switch /* caller */
|
||||
.long 0 /* %ebp == 0 should terminate trace */
|
||||
.long _mvesp /* in case %ebp == 0 doesn't work ... */
|
||||
.long 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555
|
||||
|
||||
.globl _boothowto,_bootdev
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.73 1996/01/19 03:57:40 dyson Exp $
|
||||
* $Id: pmap.c,v 1.74 1996/01/19 14:19:56 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -369,15 +369,6 @@ pmap_unuse_pt(pmap, va)
|
||||
}
|
||||
}
|
||||
|
||||
/* [ macro again?, should I force kstack into user map here? -wfj ] */
|
||||
void
|
||||
pmap_activate(pmap, pcbp)
|
||||
register pmap_t pmap;
|
||||
struct pcb *pcbp;
|
||||
{
|
||||
PMAP_ACTIVATE(pmap, pcbp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bootstrap the system enough to run with virtual memory.
|
||||
*
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.27 1996/01/30 12:54:15 davidg Exp $
|
||||
* $Id: swtch.s,v 1.28 1996/02/02 18:30:06 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h" /* for NNPX */
|
||||
@ -501,10 +501,6 @@ swtch_com:
|
||||
sti
|
||||
ret
|
||||
|
||||
ENTRY(mvesp)
|
||||
movl %esp,%eax
|
||||
ret
|
||||
|
||||
/*
|
||||
* savectx(pcb)
|
||||
* Update pcb, saving current processor state.
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
|
||||
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
|
||||
* $Id: vm_machdep.c,v 1.52 1996/01/23 02:39:17 davidg Exp $
|
||||
* $Id: vm_machdep.c,v 1.53 1996/01/30 12:54:21 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -564,8 +564,8 @@ int
|
||||
cpu_fork(p1, p2)
|
||||
register struct proc *p1, *p2;
|
||||
{
|
||||
register struct user *up = p2->p_addr;
|
||||
int offset;
|
||||
struct pcb *pcb2 = &p2->p_addr->u_pcb;
|
||||
int sp, offset;
|
||||
|
||||
/*
|
||||
* Copy pcb and stack from proc p1 to p2.
|
||||
@ -573,23 +573,25 @@ 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.
|
||||
* This should be done differently, with a single call
|
||||
* that copies and updates the pcb+stack,
|
||||
* replacing the bcopy and savectx.
|
||||
*/
|
||||
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
|
||||
offset = mvesp() - (int)kstack;
|
||||
|
||||
__asm __volatile("movl %%esp,%0" : "=r" (sp));
|
||||
offset = sp - (int)kstack;
|
||||
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
|
||||
*pcb2 = p1->p_addr->u_pcb;
|
||||
pcb2->pcb_cr3 = vtophys(p2->p_vmspace->vm_pmap.pm_pdir);
|
||||
|
||||
/*
|
||||
* Return (0) in parent, (1) in child.
|
||||
* Returns (0) in parent, (1) in child.
|
||||
*/
|
||||
return (savectx(&up->u_pcb));
|
||||
return (savectx(pcb2));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: md_var.h,v 1.5 1995/11/21 12:52:57 bde Exp $
|
||||
* $Id: md_var.h,v 1.6 1996/01/27 02:33:25 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_MD_VAR_H_
|
||||
@ -59,7 +59,6 @@ void doreti_popl_ds_fault __P((void)) __asm(__STRING(doreti_popl_ds_fault));
|
||||
void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es));
|
||||
void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault));
|
||||
int fill_regs __P((struct proc *p, struct reg *regs));
|
||||
int mvesp __P((void));
|
||||
void userconfig __P((void));
|
||||
void vm_bounce_init __P((void));
|
||||
int vm_page_zero_idle __P((void));
|
||||
|
@ -42,7 +42,7 @@
|
||||
*
|
||||
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
|
||||
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
|
||||
* $Id: pmap.h,v 1.31 1995/12/17 07:39:05 bde Exp $
|
||||
* $Id: pmap.h,v 1.32 1996/01/30 22:54:48 mpp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_PMAP_H_
|
||||
@ -158,20 +158,6 @@ typedef struct pmap *pmap_t;
|
||||
extern pmap_t kernel_pmap;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for speed
|
||||
*/
|
||||
#define PMAP_ACTIVATE(pmapp, pcbp) \
|
||||
if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \
|
||||
(pcbp)->pcb_cr3 = \
|
||||
pmap_extract(kernel_pmap, (vm_offset_t)(pmapp)->pm_pdir); \
|
||||
if ((pmapp) == &curproc->p_vmspace->vm_pmap) \
|
||||
load_cr3((pcbp)->pcb_cr3); \
|
||||
(pmapp)->pm_pdchanged = FALSE; \
|
||||
}
|
||||
|
||||
#define PMAP_DEACTIVATE(pmapp, pcbp)
|
||||
|
||||
/*
|
||||
* For each vm_page_t, there is a list of all currently valid virtual
|
||||
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
|
||||
@ -205,7 +191,6 @@ extern vm_offset_t virtual_end;
|
||||
|
||||
struct pcb;
|
||||
|
||||
void pmap_activate __P((pmap_t, struct pcb *));
|
||||
void pmap_bootstrap __P(( vm_offset_t, vm_offset_t));
|
||||
pmap_t pmap_kernel __P((void));
|
||||
void *pmap_mapdev __P((vm_offset_t, vm_size_t));
|
||||
|
Loading…
Reference in New Issue
Block a user