Initialize per-CPU pointer register earlier.
authorkettenis <kettenis@openbsd.org>
Sun, 2 May 2021 21:47:51 +0000 (21:47 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 2 May 2021 21:47:51 +0000 (21:47 +0000)
ok patrick@

sys/arch/arm64/arm64/machdep.c

index 1160757..10f63a8 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.61 2021/03/17 12:03:40 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.62 2021/05/02 21:47:51 kettenis Exp $ */
 /*
  * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
  *
@@ -760,6 +760,13 @@ initarm(struct arm64_bootparams *abp)
        int (*map_func_save)(bus_space_tag_t, bus_addr_t, bus_size_t, int,
            bus_space_handle_t *);
 
+       /*
+        * Set the per-CPU pointer with a backup in tpidr_el1 to be
+        * loaded when entering the kernel from userland.
+        */
+       __asm volatile("mov x18, %0\n"
+           "msr tpidr_el1, %0" :: "r"(&cpu_info_primary));
+
        pmap_map_early((paddr_t)config, PAGE_SIZE);
        if (!fdt_init(config) || fdt_get_size(config) == 0)
                panic("initarm: no FDT");
@@ -832,14 +839,6 @@ initarm(struct arm64_bootparams *abp)
                }
        }
 
-       /*
-        * Set the per-CPU pointer with a backup in tpidr_el1 to be
-        * loaded when entering the kernel from userland.
-        */
-       __asm __volatile(
-           "mov x18, %0 \n"
-           "msr tpidr_el1, %0" :: "r"(&cpu_info_primary));
-
        cache_setup();
 
        process_kernel_args();