From owner-p4-projects@FreeBSD.ORG Sat Nov 15 19:31:01 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 147B516A4D0; Sat, 15 Nov 2003 19:31:01 -0800 (PST) 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 E224116A4CE for ; Sat, 15 Nov 2003 19:31:00 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 57EB743FA3 for ; Sat, 15 Nov 2003 19:31:00 -0800 (PST) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAG3V0XJ028392 for ; Sat, 15 Nov 2003 19:31:00 -0800 (PST) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAG3UxR0028387 for perforce@freebsd.org; Sat, 15 Nov 2003 19:30:59 -0800 (PST) (envelope-from peter@freebsd.org) Date: Sat, 15 Nov 2003 19:30:59 -0800 (PST) Message-Id: <200311160330.hAG3UxR0028387@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 42509 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, 16 Nov 2003 03:31:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=42509 Change 42509 by peter@peter_overcee on 2003/11/15 19:30:12 create AP bootstrap page tables Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#30 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#30 (text+ko) ==== @@ -454,7 +454,8 @@ u_char mpbiosreason; u_int32_t mpbioswarmvec; struct pcpu *pc; - int x, apic_id, cpu; + int x, apic_id, cpu, i; + u_int64_t *pt4, *pt3, *pt2; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); @@ -462,6 +463,28 @@ pmap_kenter(boot_address + KERNBASE, boot_address); bcopy(mptramp_start, (void *)((uintptr_t)boot_address + KERNBASE), bootMP_size); + /* Locate the page tables, they'll be below the trampoline */ + pt4 = (u_int64_t *)(uintptr_t)mptramp_pagetables; + pt3 = pt4 + 512; + pt2 = pt3 + 512; + printf("pt4 = %p; pt3 = %p; pt2 = %p\n", pt4, pt3, pt2); + + /* Create the initial 1GB replicated page tables */ + for (i = 0; i < 512; i++) { + /* Each slot of the level 4 pages points to the same level 3 page */ + pt4[i] = (u_int64_t)(uintptr_t)pt3; + pt4[i] = PG_V | PG_RW | PG_U; + + /* Each slot of the level 3 pages points to the same level 2 page */ + pt3[i] = (u_int64_t)(uintptr_t)pt2; + pt3[i] = PG_V | PG_RW | PG_U; + + /* 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; + } + printf("pagetables created\n"); + /* save the current value of the warm-start vector */ mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); outb(CMOS_REG, BIOS_RESET);