Date: Sat, 12 May 2018 10:57:34 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333524 - head/sys/i386/i386 Message-ID: <201805121057.w4CAvYET088836@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805121057.w4CAvYET088836>