As suggested on tech-kern@ days ago:

* Get rid of PTmap, PTD, PTDpde, APTmap, APTD, and APTDpde from locore.S.
* Rename PTDpaddr to PDPpaddr, ptdpaddr in struct cpu_kcore_hdr to pdppaddr for consistency.
This commit is contained in:
junyoung 2004-08-26 10:12:33 +00:00
parent fb21d92089
commit 581cbf8089
6 changed files with 32 additions and 50 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bioscall.S,v 1.2 2003/04/02 07:35:58 thorpej Exp $ */
/* $NetBSD: bioscall.S,v 1.3 2004/08/26 10:12:33 junyoung Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -46,8 +46,8 @@
/* LINTSTUB: include <sys/types.h> */
/* LINTSTUB: include <machine/bioscall.h> */
.globl _C_LABEL(PTDpaddr) /* from locore.s */
.globl _C_LABEL(PDPpaddr) /* from locore.S */
_C_LABEL(biostramp_image):
.globl _C_LABEL(biostramp_image)
@ -74,10 +74,10 @@ NENTRY(bioscall)
pushl %ebp
movl %esp,%ebp /* set up frame ptr */
movl %cr3,%eax /* save PTDB register */
movl %cr3,%eax /* save PDP base register */
pushl %eax
movl _C_LABEL(PTDpaddr),%eax /* install proc0 PTD */
movl _C_LABEL(PDPpaddr),%eax /* install proc0 PDP */
movl %eax,%cr3
movl $(BIOSTRAMP_BASE),%eax /* address of trampoline area */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kvm86call.S,v 1.3 2003/08/11 16:56:46 drochner Exp $ */
/* $NetBSD: kvm86call.S,v 1.4 2004/08/26 10:12:33 junyoung Exp $ */
/*-
* Copyright (c) 1998 Jonathan Lemon
@ -35,7 +35,7 @@
#include "assym.h"
__KERNEL_RCSID(0, "$NetBSD: kvm86call.S,v 1.3 2003/08/11 16:56:46 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: kvm86call.S,v 1.4 2004/08/26 10:12:33 junyoung Exp $");
.data
.align 4
@ -106,9 +106,9 @@ ENTRY(kvm86_call)
movl %cr3,%eax
pushl %eax /* save address space */
movl PTDpaddr,%ecx
movl PDPpaddr,%ecx
movl %ecx,%ebx
addl $KERNBASE_LOCORE,%ebx /* va of Idle PTD */
addl $KERNBASE_LOCORE,%ebx /* va of Idle PDP */
movl 0(%ebx),%eax
pushl %eax /* old pde */
pushl %ebx /* keep address for reuse */
@ -116,7 +116,7 @@ ENTRY(kvm86_call)
movl %esp,SCRSTACK /* save current stack location */
movl vm86newptd,%eax /* mapping for vm86 page table */
movl %eax,0(%ebx) /* ... install as PTD entry 0 */
movl %eax,0(%ebx) /* ... install as PDP entry 0 */
movl %ecx,%cr3 /* new page tables */
movl vm86frame,%esp /* switch to new stack */
@ -152,7 +152,7 @@ ENTRY(kvm86_ret)
movsl /* copy frame to original frame */
movl SCRSTACK,%esp /* back to old stack */
popl %ebx /* saved va of Idle PTD */
popl %ebx /* saved va of Idle PDP */
popl %eax
movl %eax,0(%ebx) /* restore old pde */
popl %eax

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.30 2004/08/22 06:46:34 junyoung Exp $ */
/* $NetBSD: locore.S,v 1.31 2004/08/26 10:12:33 junyoung Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -153,26 +153,8 @@
#include <machine/i82489reg.h>
#endif
/*
* PTmap is recursive pagemap at top of virtual address space.
* Within PTmap, the page directory can be found (third indirection).
*
* XXX 4 == sizeof pde
*/
.set _C_LABEL(PTmap),(PDSLOT_PTE << PDSHIFT)
.set _C_LABEL(PTD),(_C_LABEL(PTmap) + PDSLOT_PTE * PAGE_SIZE)
.set _C_LABEL(PTDpde),(_C_LABEL(PTD) + PDSLOT_PTE * 4)
/*
* APTmap, APTD is the alternate recursive pagemap.
* It's used when modifying another process's page tables.
*
* XXX 4 == sizeof pde
*/
.set _C_LABEL(APTmap),(PDSLOT_APTE << PDSHIFT)
.set _C_LABEL(APTD),(_C_LABEL(APTmap) + PDSLOT_APTE * PAGE_SIZE)
.set _C_LABEL(APTDpde),(_C_LABEL(PTD) + PDSLOT_APTE * 4)
/* This shouldn't conflict with a macro of the same name defined in pmap.h */
#define PTE_BASE (PDSLOT_PTE << PDSHIFT)
/*
* Initialization
@ -185,7 +167,7 @@
#ifdef COMPAT_OLDBOOT
.globl _C_LABEL(bootdev)
#endif
.globl _C_LABEL(proc0paddr),_C_LABEL(PTDpaddr)
.globl _C_LABEL(proc0paddr),_C_LABEL(PDPpaddr)
.globl _C_LABEL(biosbasemem),_C_LABEL(biosextmem)
.globl _C_LABEL(gdt)
#ifdef I586_CPU
@ -222,7 +204,7 @@ _C_LABEL(cpu): .long 0 # are we 386, 386sx, or 486,
_C_LABEL(esym): .long 0 # ptr to end of syms
_C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual
_C_LABEL(proc0paddr): .long 0
_C_LABEL(PTDpaddr): .long 0 # paddr of PTD, for libkvm
_C_LABEL(PDPpaddr): .long 0 # paddr of PDP, for libkvm
#ifndef REALBASEMEM
_C_LABEL(biosbasemem): .long 0 # base memory reported by BIOS
#else
@ -620,8 +602,8 @@ try586: /* Use the `cpuid' instruction. */
leal (PROC0PDIR+PG_V|PG_KW)(%esi),%eax # pte for ptd
movl %eax,(PROC0PDIR+PDSLOT_PTE*4)(%esi) # recursive PD slot
/* Save phys. addr of PTD, for libkvm. */
movl %esi,RELOC(PTDpaddr)
/* Save phys. addr of PDP, for libkvm. */
movl %esi,RELOC(PDPpaddr)
/* Load base of page directory and enable mapping. */
movl %esi,%eax # phys address of ptd in proc 0
@ -922,7 +904,7 @@ ENTRY(i386_copyout)
movl $2f,PCB_ONFAULT(%edx)
1: /* Check PTE for each page. */
testb $PG_RW,_C_LABEL(PTmap)(,%edi,4)
testb $PG_RW,PTE_BASE(,%edi,4)
jz 2f
4: incl %edi
@ -1132,7 +1114,7 @@ ENTRY(copyoutstr)
movl %edi,%eax
shrl $PGSHIFT,%eax # calculate pte address
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4)
testb $PG_RW,PTE_BASE(,%eax,4)
jnz 2f
6: /* Simulate a trap. */
@ -1448,7 +1430,7 @@ ENTRY(suword)
movl %edx,%eax
shrl $PGSHIFT,%eax # calculate pte address
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4)
testb $PG_RW,PTE_BASE(,%eax,4)
jnz 1f
3: /* Simulate a trap. */
@ -1496,7 +1478,7 @@ ENTRY(susword)
movl %edx,%eax
shrl $PGSHIFT,%eax # calculate pte address
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4)
testb $PG_RW,PTE_BASE(,%eax,4)
jnz 1f
3: /* Simulate a trap. */
@ -1546,7 +1528,7 @@ ENTRY(suswintr)
movl %edx,%eax
shrl $PGSHIFT,%eax # calculate pte address
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4)
testb $PG_RW,PTE_BASE(,%eax,4)
jnz 1f
/* Simulate a trap. */
@ -1584,7 +1566,7 @@ ENTRY(subyte)
movl %edx,%eax
shrl $PGSHIFT,%eax # calculate pte address
testb $PG_RW,_C_LABEL(PTmap)(,%eax,4)
testb $PG_RW,PTE_BASE(,%eax,4)
jnz 1f
3: /* Simulate a trap. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.557 2004/08/05 18:04:35 dbj Exp $ */
/* $NetBSD: machdep.c,v 1.558 2004/08/26 10:12:33 junyoung Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.557 2004/08/05 18:04:35 dbj Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.558 2004/08/26 10:12:33 junyoung Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@ -888,7 +888,7 @@ cpu_dump()
/*
* Add the machine-dependent header info.
*/
cpuhdrp->ptdpaddr = PTDpaddr;
cpuhdrp->pdppaddr = PDPpaddr;
cpuhdrp->nmemsegs = mem_cluster_cnt;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: kcore.h,v 1.1 1998/02/18 01:09:26 thorpej Exp $ */
/* $NetBSD: kcore.h,v 1.2 2004/08/26 10:12:33 junyoung Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -36,7 +36,7 @@
#define _I386_KCORE_H_
typedef struct cpu_kcore_hdr {
u_int32_t ptdpaddr; /* PA of PTD */
u_int32_t pdppaddr; /* PA of PDP */
u_int32_t nmemsegs; /* Number of RAM segments */
#if 0
phys_ram_seg_t memsegs[]; /* RAM segments */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.81 2004/08/22 05:36:42 junyoung Exp $ */
/* $NetBSD: pmap.h,v 1.82 2004/08/26 10:12:33 junyoung Exp $ */
/*
*
@ -308,8 +308,8 @@ struct pv_page {
* global kernel variables
*/
/* PTDpaddr: is the physical address of the kernel's PDP */
extern u_long PTDpaddr;
/* PDPpaddr: is the physical address of the kernel's PDP */
extern u_long PDPpaddr;
extern struct pmap kernel_pmap_store; /* kernel pmap */
extern int nkpde; /* current # of PDEs for kernel */