From owner-svn-src-head@freebsd.org Sat May 12 10:57:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D830FD3D06; Sat, 12 May 2018 10:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27312821C2; Sat, 12 May 2018 10:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0595A1D671; Sat, 12 May 2018 10:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4CAvYj7088838; Sat, 12 May 2018 10:57:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4CAvYET088836; Sat, 12 May 2018 10:57:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805121057.w4CAvYET088836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 May 2018 10:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333524 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 333524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2018 10:57:35 -0000 Author: kib Date: Sat May 12 10:57:34 2018 New Revision: 333524 URL: https://svnweb.freebsd.org/changeset/base/333524 Log: Initialize tramp_idleptd during cold pmap startup, before the exception code is copied to the trampoline. The correct value is then copied to trampoline automatically, so tramp_idleptd_reloced can be eliminated. This will allow to use the same exception entry code to handle traps from vm86 bios calls on early boot stage, as after the trampoline is configured. Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/machdep.c head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Sat May 12 10:51:50 2018 (r333523) +++ head/sys/i386/i386/machdep.c Sat May 12 10:57:34 2018 (r333524) @@ -2508,15 +2508,12 @@ init386(int first) return ((register_t)thread0.td_pcb); } -extern u_int tramp_idleptd; - static void machdep_init_trampoline(void) { struct region_descriptor r_gdt, r_idt; struct i386tss *tss; char *copyout_buf, *trampoline, *tramp_stack_base; - u_int *tramp_idleptd_reloced; int x; gdt = pmap_trm_alloc(sizeof(union descriptor) * NGDT * mp_ncpus, @@ -2553,14 +2550,6 @@ machdep_init_trampoline(void) /* Re-initialize new IDT since the handlers were relocated */ setidt_disp = trampoline - start_exceptions; fixup_idt(); - - tramp_idleptd_reloced = (u_int *)((uintptr_t)&tramp_idleptd + - setidt_disp); -#if defined(PAE) || defined(PAE_TABLES) - *tramp_idleptd_reloced = (u_int)IdlePDPT; -#else - *tramp_idleptd_reloced = (u_int)IdlePTD; -#endif r_idt.rd_limit = sizeof(struct gate_descriptor) * NIDT - 1; r_idt.rd_base = (int)idt; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat May 12 10:51:50 2018 (r333523) +++ head/sys/i386/i386/pmap.c Sat May 12 10:57:34 2018 (r333524) @@ -366,6 +366,7 @@ pdpt_entry_t *IdlePDPT; /* phys addr of kernel PDPT */ #endif pt_entry_t *KPTmap; /* address of kernel page tables */ u_long KPTphys; /* phys addr of kernel page tables */ +extern u_long tramp_idleptd; static u_long allocpages(u_int cnt, u_long *physfree) @@ -531,6 +532,7 @@ pmap_cold(void) #else cr3 = (u_int)IdlePTD; #endif + tramp_idleptd = cr3; load_cr3(cr3); load_cr0(rcr0() | CR0_PG);