Subject: PTD name changes and PTmap removal
To: None <tech-kern@NetBSD.org>
From: Bang Jun-Young <junyoung@mogua.com>
List: tech-kern
Date: 08/22/2004 16:16:34
Hi,
The following patch does two things for i386:
- Rename PTD* to PDP* for consistency. It's quite confusing to use two
terms for the same thing.
- Eliminate PTmap, PTD, PTDpde, APTmap, APTD, and APTDpde from locore.S.
All but PTmap are not even currently used anywhere. As a good side
effect of this, the kernel size is a bit smaller.
Index: include/kcore.h
===================================================================
--- include/kcore.h (revision 12)
+++ include/kcore.h (working copy)
@@ -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 */
Index: include/pmap.h
===================================================================
--- include/pmap.h (revision 12)
+++ include/pmap.h (working copy)
@@ -308,8 +308,8 @@
* 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 */
Index: i386/bioscall.S
===================================================================
--- i386/bioscall.S (revision 12)
+++ i386/bioscall.S (working copy)
@@ -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 @@
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 */
Index: i386/machdep.c
===================================================================
--- i386/machdep.c (revision 22)
+++ i386/machdep.c (working copy)
@@ -880,7 +880,7 @@
/*
* Add the machine-dependent header info.
*/
- cpuhdrp->ptdpaddr = PTDpaddr;
+ cpuhdrp->pdppaddr = PDPpaddr;
cpuhdrp->nmemsegs = mem_cluster_cnt;
/*
Index: i386/locore.S
===================================================================
--- i386/locore.S (revision 21)
+++ i386/locore.S (working copy)
@@ -153,28 +153,9 @@
#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)
+#define PTE_BASE (PDSLOT_PTE << PDSHIFT)
/*
- * 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)
-
-
-/*
* Initialization
*/
.data
@@ -185,7 +166,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 +203,7 @@
_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
@@ -613,8 +594,8 @@
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
@@ -915,7 +896,7 @@
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
@@ -1125,7 +1106,7 @@
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. */
@@ -1441,7 +1422,7 @@
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. */
@@ -1489,7 +1470,7 @@
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. */
@@ -1539,7 +1520,7 @@
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. */
@@ -1577,7 +1558,7 @@
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. */
Index: i386/kvm86call.S
===================================================================
--- i386/kvm86call.S (revision 12)
+++ i386/kvm86call.S (working copy)
@@ -106,9 +106,9 @@
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 @@
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 @@
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