Kernel/LibC: pass environ pointer to process
This commit is contained in:
@@ -25,7 +25,7 @@ continue_thread:
|
||||
movq $0, %rax
|
||||
jmp *%rsi
|
||||
|
||||
# void thread_userspace_trampoline(uint64_t rsp, uint64_t rip, int argc, char** argv)
|
||||
# void thread_userspace_trampoline(uint64_t rsp, uint64_t rip, int argc, char** argv, char** envp)
|
||||
.global thread_userspace_trampoline
|
||||
thread_userspace_trampoline:
|
||||
pushq $0x23
|
||||
@@ -35,4 +35,5 @@ thread_userspace_trampoline:
|
||||
pushq %rsi
|
||||
movq %rdx, %rdi
|
||||
movq %rcx, %rsi
|
||||
movq %r8, %rdx
|
||||
iretq
|
||||
|
||||
@@ -9,10 +9,12 @@ _start:
|
||||
movq %rsp, %rbp
|
||||
|
||||
# We need those in a moment when we call main.
|
||||
pushq %rdx
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
|
||||
# Prepare signals, memory allocation, stdio and such.
|
||||
movq %rdx, %rdi
|
||||
call _init_libc
|
||||
|
||||
# Run the global constructors.
|
||||
@@ -21,6 +23,7 @@ _start:
|
||||
# Restore argc and argv.
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
popq %rdx
|
||||
|
||||
# Run main
|
||||
call main
|
||||
|
||||
Reference in New Issue
Block a user