|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 01/18] plat/kvm: Place early boot code to the start of the image (x86)
Simon Kuenzer <simon.kuenzer@xxxxxxxxx> writes:
> Places early boot code (e.g., 64bit mode switch) and
> data (e.g., GDT) to the start of the image.
> This avoids general protection faults that were caused
> whenever the linker placed such items to addresses
> that were not accessible while the mode switch to 64bit
> and address space setup was not finished.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
> plat/kvm/x86/entry64.S | 21 ++++++++++++---------
> plat/kvm/x86/link64.ld | 3 ++-
> 2 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
> index bda7d40..1a10359 100644
> --- a/plat/kvm/x86/entry64.S
> +++ b/plat/kvm/x86/entry64.S
> @@ -30,24 +30,24 @@
> #include <x86/cpu_defs.h>
> #include <kvm-x86/multiboot_defs.h>
>
> -#define ENTRY(x) .text; .globl x; .type x,%function; x:
> +#define ENTRY(x) .globl x; .type x,%function; x:
> #define END(x) .size x, . - x
>
> #define MYMULTIBOOT_FLAGS \
> (MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE)
>
> -.section .data.multiboot
> +.section .data.boot
>
> .align 4
> _multiboot_header:
> .long MULTIBOOT_HEADER_MAGIC
> .long MYMULTIBOOT_FLAGS
> -.long -(MULTIBOOT_HEADER_MAGIC+MYMULTIBOOT_FLAGS)
> -.long _multiboot_header
> -.long 0x100000
> -.long _edata
> -.long _end
> -.long _libkvmplat_start32
> +.long -(MULTIBOOT_HEADER_MAGIC+MYMULTIBOOT_FLAGS) /* checksum */
> +.long _multiboot_header /* header addr */
> +.long 0x100000 /* load addr */
> +.long _edata /* load end addr */
> +.long _end /* bss end addr */
> +.long _libkvmplat_start32 /* entry addr */
>
> .section .bss
>
> @@ -63,6 +63,7 @@ bootstack:
> * we've switched to long mode.
> */
> .code32
> +.section .text.boot
>
> ENTRY(_libkvmplat_start32)
> cld
> @@ -139,7 +140,7 @@ END(_libkvmplat_start32)
> * Uuuyea, exceptions.
> */
>
> -.data
> +.section .data.boot
> .align 64
> gdt64:
> .quad 0x0000000000000000
> @@ -165,6 +166,7 @@ mxcsr_ptr:
> #include "pagetable.S"
>
> .code64
> +.section .text.boot
>
> ENTRY(_libkvmplat_start64)
> movq $bootstack, %rsp
> @@ -192,6 +194,7 @@ ENTRY(_libkvmplat_start64)
> hlt
> END(_libkvmplat_start64)
>
> +.text
> ENTRY(_libkvmplat_newstack)
> movq %rdi, %rsp
> movq %rdx, %rdi
> diff --git a/plat/kvm/x86/link64.ld b/plat/kvm/x86/link64.ld
> index d1bfa73..60b5d21 100644
> --- a/plat/kvm/x86/link64.ld
> +++ b/plat/kvm/x86/link64.ld
> @@ -33,7 +33,8 @@ SECTIONS
> .text :
> {
> /* prevent linker gc from removing multiboot header */
> - KEEP (*(.data.multiboot))
> + KEEP (*(.data.boot))
> + *(.text.boot)
>
> *(.text)
> *(.text.*)
> --
> 2.7.4
>
--
Yuri Volchkov
Software Specialist
NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |