Don't jump directly to inmate_main from assembly, jump to c_entry. At the moment, c_entry does nothing else than jumping to inmate_main and stop the machine if inmate_main returns.
Later we can use c_entry to do platform independant setup/checks. Signed-off-by: Ralf Ramsauer <[email protected]> --- inmates/lib/arm-common/Makefile.lib | 2 +- inmates/lib/arm/header.S | 2 +- inmates/lib/arm64/header.S | 2 +- inmates/lib/setup.c | 9 +++++++++ inmates/lib/x86/Makefile | 2 +- inmates/lib/x86/header-32.S | 2 +- inmates/lib/x86/header.S | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 inmates/lib/setup.c diff --git a/inmates/lib/arm-common/Makefile.lib b/inmates/lib/arm-common/Makefile.lib index fb3b6585..9edb2d9f 100644 --- a/inmates/lib/arm-common/Makefile.lib +++ b/inmates/lib/arm-common/Makefile.lib @@ -36,7 +36,7 @@ # THE POSSIBILITY OF SUCH DAMAGE. # -objs-y := ../string.o ../cmdline.o +objs-y := ../string.o ../cmdline.o ../setup.o objs-y += printk.o gic.o timer.o objs-y += uart-jailhouse.o uart-pl011.o uart-8250.o uart-8250-8.o objs-y += uart-xuartps.o uart-mvebu.o uart-hscif.o uart-scifa.o uart-imx.o diff --git a/inmates/lib/arm/header.S b/inmates/lib/arm/header.S index d0a8f219..be1d23a8 100644 --- a/inmates/lib/arm/header.S +++ b/inmates/lib/arm/header.S @@ -85,6 +85,6 @@ __reset_entry: 2: ldr sp, =stack_top - b inmate_main + b c_entry .ltorg diff --git a/inmates/lib/arm64/header.S b/inmates/lib/arm64/header.S index e284aa5a..011aeb63 100644 --- a/inmates/lib/arm64/header.S +++ b/inmates/lib/arm64/header.S @@ -57,7 +57,7 @@ __reset_entry: isb - b inmate_main + b c_entry handle_irq: bl vector_irq diff --git a/inmates/lib/setup.c b/inmates/lib/setup.c new file mode 100644 index 00000000..5af94fc8 --- /dev/null +++ b/inmates/lib/setup.c @@ -0,0 +1,9 @@ +#include <inmate.h> + +void __attribute__((noreturn)) c_entry(void); + +void __attribute__((noreturn)) c_entry(void) +{ + inmate_main(); + stop(); +} diff --git a/inmates/lib/x86/Makefile b/inmates/lib/x86/Makefile index de4d74b7..6561d0cf 100644 --- a/inmates/lib/x86/Makefile +++ b/inmates/lib/x86/Makefile @@ -41,7 +41,7 @@ include $(INMATES_LIB)/Makefile.lib always := lib.a lib32.a TARGETS := header.o hypercall.o ioapic.o printk.o smp.o -TARGETS += ../pci.o ../string.o ../cmdline.o +TARGETS += ../pci.o ../string.o ../cmdline.o ../setup.o TARGETS_64_ONLY := int.o mem.o pci.o timing.o ccflags-y := -ffunction-sections diff --git a/inmates/lib/x86/header-32.S b/inmates/lib/x86/header-32.S index 119f9555..6ea8da38 100644 --- a/inmates/lib/x86/header-32.S +++ b/inmates/lib/x86/header-32.S @@ -109,7 +109,7 @@ start32: mov $bss_dwords,%ecx rep stosl - mov $inmate_main,%ebx + mov $c_entry,%ebx call_entry: mov $stack_top,%esp diff --git a/inmates/lib/x86/header.S b/inmates/lib/x86/header.S index 95c7a5a4..1df4345b 100644 --- a/inmates/lib/x86/header.S +++ b/inmates/lib/x86/header.S @@ -116,7 +116,7 @@ start64: mov $bss_qwords,%rcx rep stosq - mov $inmate_main,%rbx + mov $c_entry,%rbx call_entry: mov $stack_top,%rsp -- 2.17.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
