-/* $OpenBSD: locore.S,v 1.19 2017/08/08 21:52:41 drahn Exp $ */
+/* $OpenBSD: locore.S,v 1.20 2017/12/31 08:42:04 kettenis Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
.space PAGE_SIZE * 2 // allocate 2 pages for pmapvp2
pagetable_l1_ttbr1:
.space PAGE_SIZE * 2 // allocate 2 pages for pmapvp1
+ .globl pagetable_l1_ttbr0
pagetable_l1_ttbr0:
.space PAGE_SIZE * 2 // allocate 2 pages, reused later in pmap
+ .globl pagetable_l0_ttbr0
pagetable_l0_ttbr0:
.space PAGE_SIZE
.globl pagetable_end
-/* $OpenBSD: locore0.S,v 1.2 2017/08/06 20:05:24 kettenis Exp $ */
+/* $OpenBSD: locore0.S,v 1.3 2017/12/31 08:42:04 kettenis Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
/* Build the L1 block entry */
lsl x12, x7, #2
orr x12, x12, #L1_BLOCK
- orr x12, x12, #(ATTR_AF)
- orr x12, x12, ATTR_SH(SH_INNER)
+ orr x12, x12, #(ATTR_nG | ATTR_AF | ATTR_SH(SH_INNER))
+ orr x12, x12, #ATTR_UXN
/* Only use the output address bits */
lsr x9, x9, #L1_SHIFT
/* Build the L2 block entry */
lsl x12, x7, #2
orr x12, x12, #L2_BLOCK
- orr x12, x12, #(ATTR_AF)
- orr x12, x12, ATTR_SH(SH_INNER)
+ orr x12, x12, #(ATTR_nG | ATTR_AF | ATTR_SH(SH_INNER))
+ orr x12, x12, #ATTR_UXN
/* Only use the output address bits */
lsr x9, x9, #L2_SHIFT
-/* $OpenBSD: pmap.c,v 1.40 2017/12/27 14:13:05 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.41 2017/12/31 08:42:04 kettenis Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
pted, vp3->l3[VP_IDX3(va)], VP_IDX3(va)*8);
}
+void
+pmap_map_early(paddr_t spa, psize_t len)
+{
+ extern pd_entry_t pagetable_l0_ttbr0[];
+ extern pd_entry_t pagetable_l1_ttbr0[];
+ paddr_t pa, epa = spa + len;
+
+ for (pa = spa & ~(L1_SIZE - 1); pa < epa; pa += L1_SIZE) {
+ if (pagetable_l0_ttbr0[VP_IDX0(pa)] == 0)
+ panic("%s: outside existing L0 entry", __func__);
+
+ pagetable_l1_ttbr0[VP_IDX1(pa)] = pa | L1_BLOCK |
+ ATTR_IDX(PTE_ATTR_WB) | ATTR_SH(SH_INNER) |
+ ATTR_nG | ATTR_UXN | ATTR_AF | ATTR_AP(0);
+ }
+}
+
#define NUM_ASID (1 << 16)
uint64_t pmap_asid[NUM_ASID / 64];
-/* $OpenBSD: pmap.h,v 1.6 2017/08/27 19:33:02 drahn Exp $ */
+/* $OpenBSD: pmap.h,v 1.7 2017/12/31 08:42:04 kettenis Exp $ */
/*
* Copyright (c) 2008,2009,2014 Dale Rahn <drahn@dalerahn.com>
*
#define pmap_unuse_final(p) do { /* nothing */ } while (0)
int pmap_fault_fixup(pmap_t, vaddr_t, vm_prot_t, int);
void pmap_postinit(void);
-void pmap_map_section(vaddr_t, vaddr_t, paddr_t, int, int);
-void pmap_map_entry(vaddr_t, vaddr_t, paddr_t, int, int);
-vsize_t pmap_map_chunk(vaddr_t, vaddr_t, paddr_t, vsize_t, int, int);
+void pmap_map_early(paddr_t, psize_t);
#ifndef _LOCORE