summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-02-04 21:20:53 +0000
committerdg <dg@FreeBSD.org>1996-02-04 21:20:53 +0000
commitc0534275170b3269a4899ce19e63dc45e6d1dd88 (patch)
tree5fe1b18a2c07b79819737a71546c463bc7199a64 /sys
parent276899d730ed09c8d2362c150aa0908e69928c36 (diff)
downloadFreeBSD-src-c0534275170b3269a4899ce19e63dc45e6d1dd88.zip
FreeBSD-src-c0534275170b3269a4899ce19e63dc45e6d1dd88.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/cpu_switch.S6
-rw-r--r--sys/amd64/amd64/locore.S9
-rw-r--r--sys/amd64/amd64/locore.s9
-rw-r--r--sys/amd64/amd64/pmap.c11
-rw-r--r--sys/amd64/amd64/swtch.s6
-rw-r--r--sys/amd64/amd64/vm_machdep.c20
-rw-r--r--sys/amd64/include/md_var.h3
-rw-r--r--sys/amd64/include/pmap.h17
-rw-r--r--sys/i386/i386/locore.s9
-rw-r--r--sys/i386/i386/pmap.c11
-rw-r--r--sys/i386/i386/swtch.s6
-rw-r--r--sys/i386/i386/vm_machdep.c20
-rw-r--r--sys/i386/include/md_var.h3
-rw-r--r--sys/i386/include/pmap.h17
14 files changed, 34 insertions, 113 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index e7006cf..02854b9 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -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.
diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S
index 27c49aa..6cafa00 100644
--- a/sys/amd64/amd64/locore.S
+++ b/sys/amd64/amd64/locore.S
@@ -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
diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s
index 27c49aa..6cafa00 100644
--- a/sys/amd64/amd64/locore.s
+++ b/sys/amd64/amd64/locore.s
@@ -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
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index e47ba6b..84907b4 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -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.
*
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index e7006cf..02854b9 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -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.
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 5f1f50f..2fa2fa9 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -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
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 67daa03..19e2822 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -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));
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index b7569f6..34720b6 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -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_
@@ -159,20 +159,6 @@ 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));
diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s
index 27c49aa..6cafa00 100644
--- a/sys/i386/i386/locore.s
+++ b/sys/i386/i386/locore.s
@@ -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
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index e47ba6b..84907b4 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -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.
*
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index e7006cf..02854b9 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -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.
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 5f1f50f..2fa2fa9 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -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
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index 67daa03..19e2822 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -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));
diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h
index b7569f6..34720b6 100644
--- a/sys/i386/include/pmap.h
+++ b/sys/i386/include/pmap.h
@@ -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_
@@ -159,20 +159,6 @@ 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));
OpenPOWER on IntegriCloud