]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/kvm/arm: Make the earliest bootstack be part of the image
authorSergiu Moga <sergiu.moga@protonmail.com>
Fri, 7 Apr 2023 16:45:58 +0000 (19:45 +0300)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 10:18:44 +0000 (10:18 +0000)
In order to make it easier for the paging API to not invalidate the
stack, make it part of the image (.bss), so that it is automatically
ignored.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #848

plat/kvm/arm/entry64.S

index 52df96647949aa25f6d28b87edbac355cdec3b91..abf2c01dcc80bbeae8976289c666435c5cbd417e 100644 (file)
 #include <uk/config.h>
 #include <uk/reloc.h>
 
+/* Prefer using in-image stack, to avoid conflicts when unmapping is done by
+ * paging_init (it invalidates our stack)
+ */
+.section .bss
+.space 4096
+lcpu_bootstack:
+
 /*
  * The registers used by _libkvmplat_start:
  * x0 - FDT pointer
@@ -45,8 +52,6 @@
 ENTRY(_libkvmplat_entry)
        ur_ldr  x25, _dtb
 
-       ur_ldr  x26, _end
-
 #ifdef CONFIG_FPSIMD
        /* Enable fp/simd support */
        ldr        x0, =(3 << 20)
@@ -63,10 +68,8 @@ ENTRY(_libkvmplat_entry)
         * just need to invalidate what we are going to use:
         * DTB, TEXT, DATA, BSS, and bootstack.
         */
-       ur_ldr  x0, _start_ram_addr
-
-       add x27, x26, #__STACK_SIZE
-       sub x1, x27, x25
+       ur_ldr  x0, _start_ram_addr
+       ur_ldr  x1, _end
        bl clean_and_invalidate_dcache_range
 
        /* Disable the MMU and D-Cache. */
@@ -78,7 +81,8 @@ ENTRY(_libkvmplat_entry)
        isb
 
        /* Set the boot stack */
-       mov sp, x27
+       ur_ldr x26, lcpu_bootstack
+       mov sp, x26
 
        /* Set the context id */
        msr contextidr_el1, xzr