From owner-p4-projects@FreeBSD.ORG Sun May 11 15:21:45 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1263337B404; Sun, 11 May 2003 15:21:45 -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 A39FB37B401 for ; Sun, 11 May 2003 15:21:44 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49C6743F93 for ; Sun, 11 May 2003 15:21:44 -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 h4BMLi0U020133 for ; Sun, 11 May 2003 15:21:44 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4BMLhUg020130 for perforce@freebsd.org; Sun, 11 May 2003 15:21:43 -0700 (PDT) Date: Sun, 11 May 2003 15:21:43 -0700 (PDT) Message-Id: <200305112221.h4BMLhUg020130@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 30967 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: Sun, 11 May 2003 22:21:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=30967 Change 30967 by peter@peter_overcee on 2003/05/11 15:21:05 I dont know why I didn't think of this before. Duplicate the same 1GB window over the entire address space for ease of KERNBASE selection. Very easy. Affected files ... .. //depot/projects/hammer/sys/boot/i386/libi386/elf64_freebsd.c#15 edit Differences ... ==== //depot/projects/hammer/sys/boot/i386/libi386/elf64_freebsd.c#15 (text+ko) ==== @@ -86,20 +86,20 @@ bzero(PT3, PAGE_SIZE); bzero(PT2, PAGE_SIZE); - /* single PML4 entry */ - PT4[0] = (p4_entry_t)VTOP((uintptr_t)&PT3[0]); - PT4[0] |= PG_V | PG_RW | PG_U; + /* + * This is kinda brutal, but every single 1GB VM memory segment points to + * the same first 1GB of physical memory. But it is more than adequate. + */ + for (i = 0; i < 512; i++) { + /* Each slot of the level 4 pages points to the same level 3 page */ + PT4[i] = (p4_entry_t)VTOP((uintptr_t)&PT3[0]); + PT4[i] |= PG_V | PG_RW | PG_U; - /* Direct map 1GB at address zero */ - PT3[0] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]); - PT3[0] |= PG_V | PG_RW | PG_U; + /* Each slot of the level 3 pages points to the same level 2 page */ + PT3[i] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]); + PT3[i] |= PG_V | PG_RW | PG_U; - /* Direct map 1GB at KERNBASE (hardcoded for now) */ - PT3[1] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]); - PT3[1] |= PG_V | PG_RW | PG_U; - - /* 512 PG_PS (2MB) page mappings for 1GB of direct mapping */ - for (i = 0; i < 512; i++) { + /* The level 2 page slots are mapped with 2MB pages for 1GB. */ PT2[i] = i * (2 * 1024 * 1024); PT2[i] |= PG_V | PG_RW | PG_PS | PG_U; }