Page MenuHomeFreeBSD

D42567.id130021.diff
No OneTemporary

D42567.id130021.diff

diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c
--- a/sys/arm64/arm64/genassym.c
+++ b/sys/arm64/arm64/genassym.c
@@ -40,7 +40,6 @@
ASSYM(BOOTPARAMS_SIZE, roundup2(sizeof(struct arm64_bootparams),
STACKALIGNBYTES + 1));
ASSYM(BP_MODULEP, offsetof(struct arm64_bootparams, modulep));
-ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta));
ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack));
ASSYM(BP_KERN_TTBR0, offsetof(struct arm64_bootparams, kern_ttbr0));
ASSYM(BP_BOOT_EL, offsetof(struct arm64_bootparams, boot_el));
diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -77,11 +77,10 @@
msr contextidr_el1, xzr
/* Get the virt -> phys offset */
- bl get_virt_delta
+ bl get_load_phys_addr
/*
* At this point:
- * x29 = PA - VA
* x28 = Our physical load address
*/
@@ -136,10 +135,8 @@
mov x0, sp
/* Negate the delta so it is VA -> PA */
- neg x29, x29
str x1, [x0, #BP_MODULEP]
- str x29, [x0, #BP_KERN_DELTA]
adrp x25, initstack
add x25, x25, :lo12:initstack
str x25, [x0, #BP_KERN_STACK]
@@ -351,11 +348,9 @@
LEND(drop_to_el1)
/*
- * Get the delta between the physical address we were loaded to and the
- * virtual address we expect to run from. This is used when building the
- * initial page table.
+ * Get the physical address the kernel was loaded at.
*/
-LENTRY(get_virt_delta)
+LENTRY(get_load_phys_addr)
/* Load the physical address of virt_map */
adrp x29, virt_map
add x29, x29, :lo12:virt_map
@@ -371,7 +366,7 @@
.align 3
virt_map:
.quad virt_map
-LEND(get_virt_delta)
+LEND(get_load_phys_addr)
/*
* This builds the page tables containing the identity map, and the kernel
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -957,7 +957,7 @@
pan_setup();
/* Bootstrap enough of pmap to enter the kernel proper */
- pmap_bootstrap(KERNBASE - abp->kern_delta, lastaddr - KERNBASE);
+ pmap_bootstrap(lastaddr - KERNBASE);
/* Exclude entries needed in the DMAP region, but not phys_avail */
if (efihdr != NULL)
exclude_efi_map_entries(efihdr);
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1258,22 +1258,16 @@
* Bootstrap the system enough to run with virtual memory.
*/
void
-pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen)
+pmap_bootstrap(vm_size_t kernlen)
{
vm_offset_t dpcpu, msgbufpv;
vm_paddr_t start_pa, pa, min_pa;
- uint64_t kern_delta;
int i;
/* Verify that the ASID is set through TTBR0. */
KASSERT((READ_SPECIALREG(tcr_el1) & TCR_A1) == 0,
("pmap_bootstrap: TCR_EL1.A1 != 0"));
- kern_delta = KERNBASE - kernstart;
-
- printf("pmap_bootstrap %lx %lx\n", kernstart, kernlen);
- printf("%lx\n", (KERNBASE >> L1_SHIFT) & Ln_ADDR_MASK);
-
/* Set this early so we can use the pagetable walking functions */
kernel_pmap_store.pm_l0 = pagetable_l0_ttbr1;
PMAP_LOCK_INIT(kernel_pmap);
@@ -1288,7 +1282,7 @@
kernel_pmap->pm_asid_set = &asids;
/* Assume the address we were loaded to is a valid physical address */
- min_pa = KERNBASE - kern_delta;
+ min_pa = pmap_early_vtophys(KERNBASE);
physmap_idx = physmem_avail(physmap, nitems(physmap));
physmap_idx /= 2;
@@ -1316,7 +1310,7 @@
*/
bs_state.table_attrs &= ~TATTR_PXN_TABLE;
- start_pa = pa = KERNBASE - kern_delta;
+ start_pa = pa = pmap_early_vtophys(KERNBASE);
/*
* Create the l2 tables up to VM_MAX_KERNEL_ADDRESS. We assume that the
@@ -7848,7 +7842,7 @@
pmap_san_bootstrap(struct arm64_bootparams *abp)
{
- pmap_san_early_kernstart = KERNBASE - abp->kern_delta;
+ pmap_san_early_kernstart = pmap_early_vtophys(KERNBASE);
kasan_init_early(abp->kern_stack, KSTACK_PAGES * PAGE_SIZE);
}
diff --git a/sys/arm64/include/machdep.h b/sys/arm64/include/machdep.h
--- a/sys/arm64/include/machdep.h
+++ b/sys/arm64/include/machdep.h
@@ -31,7 +31,6 @@
struct arm64_bootparams {
vm_offset_t modulep;
- uint64_t kern_delta;
vm_offset_t kern_stack;
vm_paddr_t kern_ttbr0;
uint64_t hcr_el2;
diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h
--- a/sys/arm64/include/pmap.h
+++ b/sys/arm64/include/pmap.h
@@ -144,7 +144,7 @@
#define pmap_vm_page_alloc_check(m)
void pmap_activate_vm(pmap_t);
-void pmap_bootstrap(vm_paddr_t, vm_size_t);
+void pmap_bootstrap(vm_size_t);
int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode);
int pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot);
void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode);

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 7, 3:29 AM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16505243
Default Alt Text
D42567.id130021.diff (4 KB)

Event Timeline