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

[Minios-devel] Unikraft: _init_mem_clear_bootstrap() Fix



Hello all,

 

Currently, the call to the function unikraft/plat/x86/mm.c:_init_mem_clear_bootstrap() from unikraft/plat/xen/x86/setup.c:_init_mem() causes unikraft to crash. I investigated this issue and noticed that the VA address of _libxenplat_start (kernel entry point) is located at address 0x1000 instead of 0x0. (The .text section starts at address 0x0 though) See below:

 

balvisio@debianxen:~/unikraft/apps/helloworld/build$ nm helloworld_xen-x86_64.dbg | grep start | sort

0000000000001000 T _libxenplat_start

0000000000001017 t stack_start

000000000000435b t thread_starter

000000000000a0a0 t schedcoop_thread_start

000000000000c00c d nonopt_start

000000000000c01c D __bss_start

0000000000057060 B HYPERVISOR_start_info

 

I forced the linker script to position _libxenplat_start() at location 0x0 with the following patch and it seems to solve the problem:

 

diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S

index bdaa05a..94a5546 100644

--- a/plat/xen/x86/entry64.S

+++ b/plat/xen/x86/entry64.S

@@ -51,7 +51,7 @@ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")

 .text

 

 .globl _libxenplat_start

-

+.section .text.prologue, "ax"

 _libxenplat_start:

 #else

 

diff --git a/plat/xen/x86/link64.ld b/plat/xen/x86/link64.ld

index 2842a75..837c500 100644

--- a/plat/xen/x86/link64.ld

+++ b/plat/xen/x86/link64.ld

@@ -32,6 +32,7 @@ SECTIONS

        . = 0x0;

        _text = .;                      /* Text and read-only data */

        .text : {

+               *(.text.prologue)

                *(.text)

                *(.gnu.warning)

        } = 0x2000

diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c

index cf8bad2..18fcd24 100644

--- a/plat/xen/x86/setup.c

+++ b/plat/xen/x86/setup.c

@@ -156,7 +156,7 @@ static inline void _init_mem(void)

        uk_printd(DLVL_INFO, "       max_pfn: %lx\n", max_pfn);

 

        _init_mem_build_pagetable(&start_pfn, &max_pfn);

-       //_init_mem_clear_bootstrap(); /* FIXME - stack or text screwed up? */

+       _init_mem_clear_bootstrap(); /* FIXME - stack or text screwed up? */

        //_init_mem_set_readonly(&_text, &_erodata); /* FIXME - shared info ro? */

 

        /* Fill out mrd array */

 

 

I am not sure if the problem can be solved by adding certain flag to the linker so that it automatically places _libxenplat_start() function at 0x0.

Any comments on this would be greatly appreciated and if this looks like a right solution I can send the PATCH to the list.

 

Cheers,

 

Bruno


_______________________________________________
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®.