From owner-p4-projects@FreeBSD.ORG Fri May 30 18:53:00 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8A64C37B404; Fri, 30 May 2003 18:52:59 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13C1237B401 for ; Fri, 30 May 2003 18:52:59 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91B7E43F93 for ; Fri, 30 May 2003 18:52:58 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4V1qw0U092478 for ; Fri, 30 May 2003 18:52:58 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4V1qw3E092470 for perforce@freebsd.org; Fri, 30 May 2003 18:52:58 -0700 (PDT) Date: Fri, 30 May 2003 18:52:58 -0700 (PDT) Message-Id: <200305310152.h4V1qw3E092470@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 32142 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 May 2003 01:53:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=32142 Change 32142 by peter@peter_hammer on 2003/05/30 18:52:09 Minor tweaks. Have hammer_time() take arguments and return the new stack location. Have locore switch to the proc0 kstack rather than run mi_startup (aka proc0) on the tiny bootstack - this is bad because acpica overflows it. Tidy up locore.S. Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/locore.S#6 edit .. //depot/projects/hammer/sys/amd64/amd64/machdep.c#42 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/locore.S#6 (text+ko) ==== @@ -69,17 +69,15 @@ /* 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 ==== //depot/projects/hammer/sys/amd64/amd64/machdep.c#42 (text+ko) ==== @@ -112,7 +112,7 @@ #include #include -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 @@ 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 @@ 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 @@ 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 @@ 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