From owner-p4-projects Sat Sep 21 13:14:26 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4D07437B404; Sat, 21 Sep 2002 13:14:23 -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 E8F9C37B401 for ; Sat, 21 Sep 2002 13:14:22 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A530E43E65 for ; Sat, 21 Sep 2002 13:14:22 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8LKEMCo059049 for ; Sat, 21 Sep 2002 13:14:22 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8LKEM6o059038 for perforce@freebsd.org; Sat, 21 Sep 2002 13:14:22 -0700 (PDT) Date: Sat, 21 Sep 2002 13:14:22 -0700 (PDT) Message-Id: <200209212014.g8LKEM6o059038@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 17882 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17882 Change 17882 by peter@peter_overcee on 2002/09/21 13:10:50 start turning on long mode. We're now as far as running in "compatability mode" (long mode but with a 32 bit app) because the 'long' bit in %cs isn't set yet. This means this has a fair way to go yet.. we'll need to mess with evil gdt stuff before we can reach kernbase. :-( Affected files ... .. //depot/projects/hammer/sys/x86_64/x86_64/locore.s#14 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/x86_64/locore.s#14 (text+ko) ==== @@ -133,13 +133,13 @@ * prot = protection bits */ #define fillkpt(base, prot) \ - shll $2,%ebx ; \ + shll $3,%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 $8,%ebx ; /* next pte */ \ loop 1b /* @@ -185,17 +185,35 @@ call identify_cpu call create_pagetables -/* Now enable paging */ +/* Enable PAE mode (prerequisite for long mode) */ + movl %cr4, %eax + orl $CR4_PAE, %eax + movl %eax, %cr4 + +/* Point to the PML4 */ movl R(IdlePTD), %eax movl %eax,%cr3 /* load ptd addr into mmu */ + +/* Enable long mode */ + movl $MSR_EFER, %ecx + rdmsr + orl $EFER_LME, %eax + wrmsr +/* + * At this point, we are in 32 bit "compatability" mode, where + * EFER.LMA = 1, CS.L = 0, CS.D = 0, CR0.PE = 1. + */ + +/* Now enable paging */ movl %cr0,%eax /* get control word */ - orl $CR0_PE|CR0_PG,%eax /* enable paging */ + orl $CR0_PG, %eax /* enable paging */ movl %eax,%cr0 /* and let's page NOW! */ - pushl $begin /* jump to high virtualized address */ + pushl $begin /* prepare for jump to virtual address */ ret /* now running relocated at KERNBASE where the system is linked to run */ +/* XXX not yet, we have to set the segment 'long' bit first! */ begin: /* set up bootstrap stack */ movl proc0kstack,%eax /* location of in-kernel stack */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message