[LibOS] Move inline assembly to macro in shim_internal-arch.h

This commit is contained in:
Stefan Berger
2020-06-17 17:58:52 +02:00
committed by Michał Kowalczyk
parent 5181b073b2
commit 2540c63d21
2 changed files with 12 additions and 12 deletions
@@ -26,4 +26,14 @@ static_always_inline void* current_stack(void) {
return _rsp;
}
#define CALL_ELF_ENTRY(ENTRY, ARGCP) \
__asm__ volatile( \
"pushq $0\r\n" \
"popfq\r\n" \
"movq %%rbx, %%rsp\r\n" \
"jmp *%%rax\r\n" \
: \
: "a"(ENTRY), "b"(ARGCP), "d"(0) \
: "memory", "cc")
#endif /* _SHIM_INTERNAL_ARCH_H_ */
+2 -12
View File
@@ -1592,18 +1592,8 @@ noreturn void execute_elf_object(struct shim_handle* exec, int* argcp, const cha
shim_tcb_t* tcb = shim_get_tcb();
__enable_preempt(tcb);
#if defined(__x86_64__)
__asm__ volatile(
"pushq $0\r\n"
"popfq\r\n"
"movq %%rbx, %%rsp\r\n"
"jmp *%%rax\r\n"
:
: "a"(entry), "b"(argcp), "d"(0)
: "memory", "cc");
#else
#error "architecture not supported"
#endif
CALL_ELF_ENTRY(entry, argcp);
while (true)
/* nothing */;
}