diff --git a/Pal/src/host/Linux/Makefile b/Pal/src/host/Linux/Makefile index bccc209f..44428ad7 100644 --- a/Pal/src/host/Linux/Makefile +++ b/Pal/src/host/Linux/Makefile @@ -33,7 +33,8 @@ objs = \ db_sockets.o \ db_streams.o \ db_threading.o \ - $(commons_objs) + $(commons_objs) \ + pal_start-$(ARCH).o graphene_lib = .lib/graphene-lib.a diff --git a/Pal/src/host/Linux/db_main.c b/Pal/src/host/Linux/db_main.c index e07a11b2..d5894b8b 100644 --- a/Pal/src/host/Linux/db_main.c +++ b/Pal/src/host/Linux/db_main.c @@ -38,16 +38,6 @@ #include #include -__asm__ ( - ".global pal_start\n" - " .type pal_start,@function\n" - "pal_start:\n" - " movq %rsp, %rdi\n" /* 1st arg for pal_linux_main: initial RSP */ - " movq %rdx, %rsi\n" /* 2nd arg: fini callback */ - " xorq %rbp, %rbp\n" /* mark the last stack frame with RBP == 0 (for debuggers) */ - " andq $~15, %rsp\n" - " call pal_linux_main\n"); - #define RTLD_BOOTSTRAP /* pal_start is the entry point of libpal.so, which calls pal_main */ diff --git a/Pal/src/host/Linux/pal_start-x86_64.S b/Pal/src/host/Linux/pal_start-x86_64.S new file mode 100644 index 00000000..406f0ad3 --- /dev/null +++ b/Pal/src/host/Linux/pal_start-x86_64.S @@ -0,0 +1,31 @@ +/* + This file is part of Graphene Library OS. + + Graphene Library OS is free software: you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + Graphene Library OS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* + * pal_start-x86_64.S + * + * This file contains architecture-specific implementation of pal_start. + */ + +#include "sysdep-arch.h" + + .text +ENTRY(pal_start) + movq %rsp, %rdi /* 1st arg for pal_linux_main: initial RSP */ + movq %rdx, %rsi /* 2nd arg: fini callback */ + xorq %rbp, %rbp /* mark the last stack frame with RBP == 0 (for debuggers) */ + andq $~15, %rsp + call pal_linux_main