summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-03-15 05:10:06 +0000
committerpeter <peter@FreeBSD.org>2001-03-15 05:10:06 +0000
commitd7e8a2bd6694fef706e0403d2b689ee7fb515848 (patch)
tree50b7fdc1abf4df5cf78457432d520174c6857d93 /sys/amd64
parent91396cbcebe98f331cbc81d48a85cb05209b5012 (diff)
downloadFreeBSD-src-d7e8a2bd6694fef706e0403d2b689ee7fb515848.zip
FreeBSD-src-d7e8a2bd6694fef706e0403d2b689ee7fb515848.tar.gz
Kill the 4MB kernel limit dead. [I hope :-)].
For UP, we were using $tmp_stk as a stack from the data section. If the kernel text section grew beyond ~3MB, the data section would be pushed beyond the temporary 4MB P==V mapping. This would cause the trampoline up to high memory to fault. The hack workaround I did was to use all of the page table pages that we already have while preparing the initial P==V mapping, instead of just the first one. For SMP, the AP bootstrap process suffered the same sort of problem and got the same treatment. MFC candidate - this breaks on 4.x just the same.. Thanks to: Richard Todd <rmtodd@ichotolot.servalan.com>
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/locore.S2
-rw-r--r--sys/amd64/amd64/locore.s2
-rw-r--r--sys/amd64/amd64/mp_machdep.c12
-rw-r--r--sys/amd64/amd64/mptable.c12
-rw-r--r--sys/amd64/amd64/pmap.c5
-rw-r--r--sys/amd64/include/mptable.h12
6 files changed, 32 insertions, 13 deletions
diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S
index 68927d5..379af45 100644
--- a/sys/amd64/amd64/locore.S
+++ b/sys/amd64/amd64/locore.S
@@ -889,7 +889,7 @@ map_read_write:
/* install a pde for temporary double map of bottom of VA */
movl R(KPTphys), %eax
xorl %ebx, %ebx
- movl $1, %ecx
+ movl $NKPT, %ecx
fillkpt(R(IdlePTD), $PG_RW)
/* install pde's for pt's */
diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s
index 68927d5..379af45 100644
--- a/sys/amd64/amd64/locore.s
+++ b/sys/amd64/amd64/locore.s
@@ -889,7 +889,7 @@ map_read_write:
/* install a pde for temporary double map of bottom of VA */
movl R(KPTphys), %eax
xorl %ebx, %ebx
- movl $1, %ecx
+ movl $NKPT, %ecx
fillkpt(R(IdlePTD), $PG_RW)
/* install pde's for pt's */
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index f6d23dd..9797905 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
u_long mpbioswarmvec;
struct globaldata *gd;
char *stack;
+ uintptr_t kptbase;
POSTCODE(START_ALL_APS_POST);
@@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
/* record BSP in CPU map */
all_cpus = 1;
- /* set up 0 -> 4MB P==V mapping for AP boot */
- *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
+ /* set up temporary P==V mapping for AP boot */
+ /* XXX this is a hack, we should boot the AP on its own stack/PTD */
+ kptbase = (uintptr_t)(void *)KPTphys;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = (pd_entry_t)(PG_V | PG_RW |
+ ((kptbase + x * PAGE_SIZE) & PG_FRAME));
invltlb();
/* start each AP */
@@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
- *(int *)PTD = 0;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = 0;
pmap_set_opt();
/* number of APs actually started */
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index f6d23dd..9797905 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
u_long mpbioswarmvec;
struct globaldata *gd;
char *stack;
+ uintptr_t kptbase;
POSTCODE(START_ALL_APS_POST);
@@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
/* record BSP in CPU map */
all_cpus = 1;
- /* set up 0 -> 4MB P==V mapping for AP boot */
- *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
+ /* set up temporary P==V mapping for AP boot */
+ /* XXX this is a hack, we should boot the AP on its own stack/PTD */
+ kptbase = (uintptr_t)(void *)KPTphys;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = (pd_entry_t)(PG_V | PG_RW |
+ ((kptbase + x * PAGE_SIZE) & PG_FRAME));
invltlb();
/* start each AP */
@@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
- *(int *)PTD = 0;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = 0;
pmap_set_opt();
/* number of APs actually started */
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 4bf0ace..9360328 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -282,6 +282,7 @@ pmap_bootstrap(firstaddr, loadaddr)
{
vm_offset_t va;
pt_entry_t *pte;
+ int i;
avail_start = firstaddr;
@@ -360,8 +361,8 @@ pmap_bootstrap(firstaddr, loadaddr)
virtual_avail = va;
*(int *) CMAP1 = *(int *) CMAP2 = 0;
- *(int *) PTD = 0;
-
+ for (i = 0; i < NKPT; i++)
+ PTD[i] = 0;
pgeflag = 0;
#if !defined(SMP) /* XXX - see also mp_machdep.c */
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index f6d23dd..9797905 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
u_long mpbioswarmvec;
struct globaldata *gd;
char *stack;
+ uintptr_t kptbase;
POSTCODE(START_ALL_APS_POST);
@@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
/* record BSP in CPU map */
all_cpus = 1;
- /* set up 0 -> 4MB P==V mapping for AP boot */
- *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
+ /* set up temporary P==V mapping for AP boot */
+ /* XXX this is a hack, we should boot the AP on its own stack/PTD */
+ kptbase = (uintptr_t)(void *)KPTphys;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = (pd_entry_t)(PG_V | PG_RW |
+ ((kptbase + x * PAGE_SIZE) & PG_FRAME));
invltlb();
/* start each AP */
@@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
- *(int *)PTD = 0;
+ for (x = 0; x < NKPT; x++)
+ PTD[x] = 0;
pmap_set_opt();
/* number of APs actually started */
OpenPOWER on IntegriCloud