From 040bb34290c9a4305e13637e002060411e5a8385 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 19 Aug 2022 23:36:29 +0200 Subject: include: make camellia/syscalls.h compatible with assembly --- src/user/lib/elfload.S | 20 ++++++++++++++++++++ src/user/lib/elfload.s | 17 ----------------- 2 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 src/user/lib/elfload.S delete mode 100644 src/user/lib/elfload.s (limited to 'src/user/lib') diff --git a/src/user/lib/elfload.S b/src/user/lib/elfload.S new file mode 100644 index 0000000..0f15c06 --- /dev/null +++ b/src/user/lib/elfload.S @@ -0,0 +1,20 @@ +#define ASM_FILE 1 +#include + +.section .text +.global _freejmp_chstack +.type _freejmp_chstack, @function +// void _freejmp_chstack(void *entry, void *low, size_t len, char **argv, char **envp, void *stack); +_freejmp_chstack: + mov %r9, %rsp + jmp _freejmp + +.section .text +.global execbuf_chstack +.type execbuf_chstack, @function +// _Noreturn void execbuf_chstack(void *stack, void __user *buf, size_t len); +execbuf_chstack: + mov %rdi, %rsp + mov $_SYSCALL_EXECBUF, %rdi + syscall + hlt // if execbuf failed we might as well crash diff --git a/src/user/lib/elfload.s b/src/user/lib/elfload.s deleted file mode 100644 index faab85f..0000000 --- a/src/user/lib/elfload.s +++ /dev/null @@ -1,17 +0,0 @@ -.section .text -.global _freejmp_chstack -.type _freejmp_chstack, @function -// void _freejmp_chstack(void *entry, void *low, size_t len, char **argv, char **envp, void *stack); -_freejmp_chstack: - mov %r9, %rsp - jmp _freejmp - -.section .text -.global execbuf_chstack -.type execbuf_chstack, @function -// _Noreturn void execbuf_chstack(void *stack, void __user *buf, size_t len); -execbuf_chstack: - mov %rdi, %rsp - mov $100, %rdi - syscall - jmp 0 // if execbuf failed we might as well crash -- cgit v1.2.3