diff options
author | peter <peter@FreeBSD.org> | 2003-05-31 06:54:29 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-05-31 06:54:29 +0000 |
commit | d5cee515b42fd4184742629c43e6a43ee2e5200c (patch) | |
tree | 05953a1cc7705b86b3a540db0931045ef2643d7e /sys | |
parent | a32db9797c5b0343f7c14e6549f04324c9ef9268 (diff) | |
download | FreeBSD-src-d5cee515b42fd4184742629c43e6a43ee2e5200c.zip FreeBSD-src-d5cee515b42fd4184742629c43e6a43ee2e5200c.tar.gz |
Have hammer_time() return the proc0 stack location, and have locore
switch to it before calling mi_startup(). The bootstack is WAY too small
for running acpica during probe/attach. While here, pass modulep/physfree
to the startup routine, rather than writing to the global variables in
locore.S.
Approved by: re (amd64/*)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/locore.S | 10 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 32 |
2 files changed, 17 insertions, 25 deletions
diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 0d2c2cc..55cda3a 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -69,17 +69,15 @@ NON_GPROF_ENTRY(btext) /* Find the metadata pointers before we lose them */ movq %rsp, %rbp - xorq %rax, %rax - movl 4(%rbp),%eax /* modulep */ - movq %rax,modulep - movl 8(%rbp),%eax /* kernend */ - movq %rax,physfree + movl 4(%rbp),%edi /* modulep (arg 1) */ + movl 8(%rbp),%esi /* kernend (arg 2) */ /* Get onto a stack that we can trust - there is no going back now. */ movq $bootstack,%rsp - xorq %rbp, %rbp + xorl %ebp, %ebp call hammer_time /* set up cpu for unix operation */ + movq %rax,%rsp /* set up kstack for mi_startup() */ call mi_startup /* autoconfiguration, mountroot etc */ 0: hlt jmp 0b diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 6afe51a..d751a7a 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -112,7 +112,7 @@ #include <sys/ptrace.h> #include <machine/sigframe.h> -extern void hammer_time(void); +extern u_int64_t hammer_time(u_int64_t, u_int64_t); extern void dblfault_handler(void); extern void printcpuinfo(void); /* XXX header file */ @@ -131,9 +131,6 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) int _udatasel, _ucodesel, _ucode32sel; u_long atdevbase; -u_int64_t modulep; /* phys addr of metadata table */ -u_int64_t physfree; /* first free page after kernel */ - int cold = 1; long Maxmem = 0; @@ -1070,19 +1067,8 @@ physmap_done: avail_end = phys_avail[pa_indx]; } -static u_int64_t -allocpages(int n) -{ - u_int64_t ret; - - ret = physfree; - bzero((void *)ret, n * PAGE_SIZE); - physfree += n * PAGE_SIZE; - return (ret); -} - -void -hammer_time(void) +u_int64_t +hammer_time(u_int64_t modulep, u_int64_t physfree) { caddr_t kmdp; int gsel_tss, off, x; @@ -1095,10 +1081,15 @@ hammer_time(void) msr = rdmsr(MSR_EFER) | EFER_NXE; wrmsr(MSR_EFER, msr); - proc0.p_uarea = (struct user *)(allocpages(UAREA_PAGES) + KERNBASE); - thread0.td_kstack = allocpages(KSTACK_PAGES) + KERNBASE; + proc0.p_uarea = (struct user *)(physfree + KERNBASE); + bzero(proc0.p_uarea, UAREA_PAGES * PAGE_SIZE); + physfree += UAREA_PAGES * PAGE_SIZE; + thread0.td_kstack = physfree + KERNBASE; + bzero((void *)thread0.td_kstack, KSTACK_PAGES * PAGE_SIZE); + physfree += KSTACK_PAGES * PAGE_SIZE; thread0.td_pcb = (struct pcb *) (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + atdevbase = ISA_HOLE_START + KERNBASE; /* @@ -1244,6 +1235,9 @@ hammer_time(void) env = getenv("kernelname"); if (env != NULL) strlcpy(kernelname, env, sizeof(kernelname)); + + /* Location of kernel stack for locore */ + return ((u_int64_t)thread0.td_pcb); } void |