-/* $OpenBSD: cpu.c,v 1.51 2021/03/11 11:16:55 jsg Exp $ */
+/* $OpenBSD: cpu.c,v 1.52 2021/03/16 10:57:47 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
while ((ci->ci_flags & CPUF_GO) == 0)
__asm volatile("wfe");
+ WRITE_SPECIALREG(ttbr0_el1, pmap_kernel()->pm_pt0pa);
+ __asm volatile("isb");
tcr = READ_SPECIALREG(tcr_el1);
tcr &= ~TCR_T0SZ(0x3f);
tcr |= TCR_T0SZ(64 - USER_SPACE_BITS);
tcr |= TCR_A1;
WRITE_SPECIALREG(tcr_el1, tcr);
+ cpu_tlb_flush();
/* Enable PAN. */
id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
-/* $OpenBSD: locore.S,v 1.35 2021/03/10 15:56:06 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.36 2021/03/16 10:57:47 kettenis Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
msr mdscr_el1, xzr
/* Invalidate the TLB */
+ dsb ishst
tlbi vmalle1is
+ dsb ish
+ isb
ldr x2, mair
msr mair_el1, x2
switch_mmu_kernel:
RETGUARD_SETUP(switch_mmu_kernel, x15)
dsb sy
- /* Invalidate the TLB */
- tlbi vmalle1is
+
/* Load ttbr1 (kernel) */
msr ttbr1_el1, x0
isb
+
+ /* Invalidate the TLB */
+ dsb ishst
+ tlbi vmalle1is
+ dsb ish
+ isb
+
RETGUARD_CHECK(switch_mmu_kernel, x15)
ret
-/* $OpenBSD: pmap.c,v 1.74 2021/03/11 11:16:55 jsg Exp $ */
+/* $OpenBSD: pmap.c,v 1.75 2021/03/16 10:57:47 kettenis Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
* the identity mapping in TTBR0 and can set the TCR to a
* more useful value.
*/
+ WRITE_SPECIALREG(ttbr0_el1, pmap_kernel()->pm_pt0pa);
+ __asm volatile("isb");
tcr = READ_SPECIALREG(tcr_el1);
tcr &= ~TCR_T0SZ(0x3f);
tcr |= TCR_T0SZ(64 - USER_SPACE_BITS);
tcr |= TCR_A1;
WRITE_SPECIALREG(tcr_el1, tcr);
+ cpu_tlb_flush();
pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, IPL_NONE, 0,
"pmap", NULL);