- Added macros PDESHIFT and PTESHIFT, use these instead of magic constants

in locore.
- Removed the macros PTESIZE and PDESIZE, use sizeof instead in C.

Sponsored by:	DARPA, Network Associates Laboratories
This commit is contained in:
Jake Burkholder 2003-02-23 09:45:50 +00:00
parent 73657eba91
commit e29632c9e1
9 changed files with 26 additions and 18 deletions

View File

@ -108,8 +108,9 @@ ASSYM(KSTACK_PAGES, KSTACK_PAGES);
ASSYM(PAGE_SIZE, PAGE_SIZE);
ASSYM(NPTEPG, NPTEPG);
ASSYM(NPDEPG, NPDEPG);
ASSYM(PDESIZE, PDESIZE);
ASSYM(PTESIZE, PTESIZE);
ASSYM(PDESIZE, sizeof(pd_entry_t));
ASSYM(PTESIZE, sizeof(pt_entry_t));
ASSYM(PTESHIFT, PTESHIFT);
ASSYM(PAGE_SHIFT, PAGE_SHIFT);
ASSYM(PAGE_MASK, PAGE_MASK);
ASSYM(PDRSHIFT, PDRSHIFT);

View File

@ -190,13 +190,13 @@ pc98_system_parameter:
* prot = protection bits
*/
#define fillkpt(base, prot) \
shll $2,%ebx ; \
shll $PTESHIFT,%ebx ; \
addl base,%ebx ; \
orl $PG_V,%eax ; \
orl prot,%eax ; \
1: movl %eax,(%ebx) ; \
addl $PAGE_SIZE,%eax ; /* increment physical address */ \
addl $4,%ebx ; /* next pte */ \
addl $PTESIZE,%ebx ; /* next pte */ \
loop 1b
/*

View File

@ -190,13 +190,13 @@ pc98_system_parameter:
* prot = protection bits
*/
#define fillkpt(base, prot) \
shll $2,%ebx ; \
shll $PTESHIFT,%ebx ; \
addl base,%ebx ; \
orl $PG_V,%eax ; \
orl prot,%eax ; \
1: movl %eax,(%ebx) ; \
addl $PAGE_SIZE,%eax ; /* increment physical address */ \
addl $4,%ebx ; /* next pte */ \
addl $PTESIZE,%ebx ; /* next pte */ \
loop 1b
/*

View File

@ -224,6 +224,9 @@ static void *pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait);
static pd_entry_t pdir4mb;
CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
/*
* Routine: pmap_pte
* Function:
@ -1311,7 +1314,7 @@ pmap_pinit(pmap)
mtx_unlock_spin(&allpmaps_lock);
/* Wire in kernel global address entries. */
/* XXX copies current process, does not fill in MPPTDI */
bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * PTESIZE);
bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t));
#ifdef SMP
pmap->pm_pdir[MPPTDI] = PTD[MPPTDI];
#endif
@ -1367,7 +1370,7 @@ pmap_release_free_page(pmap_t pmap, vm_page_t p)
* stuff cleared, so they can go into the zero queue also.
*/
if (p->pindex == PTDPTDI) {
bzero(pde + KPTDI, nkpt * PTESIZE);
bzero(pde + KPTDI, nkpt * sizeof(pd_entry_t));
#ifdef SMP
pde[MPPTDI] = 0;
#endif

View File

@ -139,8 +139,8 @@
typedef u_int32_t pd_entry_t;
typedef u_int32_t pt_entry_t;
#define PDESIZE sizeof(pd_entry_t) /* for assembly files */
#define PTESIZE sizeof(pt_entry_t) /* for assembly files */
#define PTESHIFT (2)
#define PDESHIFT (2)
/*
* Address of current and alternate address space page table maps

View File

@ -108,8 +108,9 @@ ASSYM(KSTACK_PAGES, KSTACK_PAGES);
ASSYM(PAGE_SIZE, PAGE_SIZE);
ASSYM(NPTEPG, NPTEPG);
ASSYM(NPDEPG, NPDEPG);
ASSYM(PDESIZE, PDESIZE);
ASSYM(PTESIZE, PTESIZE);
ASSYM(PDESIZE, sizeof(pd_entry_t));
ASSYM(PTESIZE, sizeof(pt_entry_t));
ASSYM(PTESHIFT, PTESHIFT);
ASSYM(PAGE_SHIFT, PAGE_SHIFT);
ASSYM(PAGE_MASK, PAGE_MASK);
ASSYM(PDRSHIFT, PDRSHIFT);

View File

@ -190,13 +190,13 @@ pc98_system_parameter:
* prot = protection bits
*/
#define fillkpt(base, prot) \
shll $2,%ebx ; \
shll $PTESHIFT,%ebx ; \
addl base,%ebx ; \
orl $PG_V,%eax ; \
orl prot,%eax ; \
1: movl %eax,(%ebx) ; \
addl $PAGE_SIZE,%eax ; /* increment physical address */ \
addl $4,%ebx ; /* next pte */ \
addl $PTESIZE,%ebx ; /* next pte */ \
loop 1b
/*

View File

@ -224,6 +224,9 @@ static void *pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait);
static pd_entry_t pdir4mb;
CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
/*
* Routine: pmap_pte
* Function:
@ -1311,7 +1314,7 @@ pmap_pinit(pmap)
mtx_unlock_spin(&allpmaps_lock);
/* Wire in kernel global address entries. */
/* XXX copies current process, does not fill in MPPTDI */
bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * PTESIZE);
bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t));
#ifdef SMP
pmap->pm_pdir[MPPTDI] = PTD[MPPTDI];
#endif
@ -1367,7 +1370,7 @@ pmap_release_free_page(pmap_t pmap, vm_page_t p)
* stuff cleared, so they can go into the zero queue also.
*/
if (p->pindex == PTDPTDI) {
bzero(pde + KPTDI, nkpt * PTESIZE);
bzero(pde + KPTDI, nkpt * sizeof(pd_entry_t));
#ifdef SMP
pde[MPPTDI] = 0;
#endif

View File

@ -139,8 +139,8 @@
typedef u_int32_t pd_entry_t;
typedef u_int32_t pt_entry_t;
#define PDESIZE sizeof(pd_entry_t) /* for assembly files */
#define PTESIZE sizeof(pt_entry_t) /* for assembly files */
#define PTESHIFT (2)
#define PDESHIFT (2)
/*
* Address of current and alternate address space page table maps