summaryrefslogtreecommitdiff
path: root/src/user/lib/elfload.s
diff options
context:
space:
mode:
authordzwdz2022-07-27 13:59:52 +0200
committerdzwdz2022-07-27 13:59:52 +0200
commitc77b0fa7916f79c099ee4a6a80a093334e9090ac (patch)
tree19eaedcecaa1584b83342853f1616975b50cad97 /src/user/lib/elfload.s
parent55b3a04e97b7ddd0db17a4fc3ba35461b106b92f (diff)
user/libc: execve() supports passing argv now
Diffstat (limited to 'src/user/lib/elfload.s')
-rw-r--r--src/user/lib/elfload.s17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/user/lib/elfload.s b/src/user/lib/elfload.s
new file mode 100644
index 0000000..faab85f
--- /dev/null
+++ b/src/user/lib/elfload.s
@@ -0,0 +1,17 @@
+.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