[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 6/9] plat/kvm: streamline Firecracker early boot



There are several pieces in the early boot code that are unnecessary
when building for Firecracker: namely, the multiboot header is not
required; and the 32-bit setup which forms the very earliest steps of
the boot process can be skipped because Firecracker drops us off in long
mode. However, move the page table setup code into the 64-bit part to
make sure that it is executed.

Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 plat/kvm/x86/entry64.S | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index 274ab0b3..186f6ce4 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -27,6 +27,7 @@
  * SUCH DAMAGE.
  */
 
+#include <uk/config.h>
 #include <x86/cpu_defs.h>
 #include <kvm-x86/traps.h>
 #include <kvm-x86/multiboot_defs.h>
@@ -37,6 +38,7 @@
 #define MYMULTIBOOT_FLAGS \
     (MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE)
 
+#if KVMQPLAT
 .section .data.boot
 
 .align 4
@@ -50,11 +52,13 @@ _multiboot_header:
 .long _end                                        /* bss end addr */
 .long _libkvmplat_start32                         /* entry addr */
 
+#endif
 .section .bss
 
 .space 4096
 bootstack:
 
+#if KVMQPLAT
 /*
  * Bootloader entry point.
  *
@@ -90,15 +94,6 @@ ENTRY(_libkvmplat_start32)
        orl $X86_EFER_LME, %eax
        wrmsr
 
-       /* 3: load pml4 pointer */
-       movl $cpu_pml4, %eax
-       movl %eax, %cr3
-
-       /* 4: enable paging */
-       movl %cr0, %eax
-       orl $X86_CR0_PG, %eax
-       movl %eax, %cr0
-
        jmp _libkvmplat_start64
 
        /* NOTREACHED */
@@ -111,6 +106,7 @@ haltme:
        hlt
        jmp haltme
 END(_libkvmplat_start32)
+#endif
 
 /*
  * amd64 programmer's manual:
@@ -149,6 +145,15 @@ mxcsr_ptr:
 .section .text.boot
 
 ENTRY(_libkvmplat_start64)
+       /* load pml4 pointer */
+       movq $cpu_pml4, %rax
+       movq %rax, %cr3
+
+       /* enable paging */
+       movq %cr0, %rax
+       orl $X86_CR0_PG, %eax
+       movq %rax, %cr0
+
        /* set up the boot stack */
        movq $bootstack, %rsp
        xorq %rbp, %rbp
-- 
2.21.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.