[USER] Init libc with arguments and environment

MESS - execve - Clean up and move earlier
This commit is contained in:
2017-02-13 10:24:01 +01:00
parent 8d1e693884
commit 1693baaf6b
9 changed files with 102 additions and 17 deletions

View File

@@ -13,10 +13,12 @@
call _init
pop rdi
pop rsi
pop rdx
movabs rax, offset main
mov rdi, rax
call main
call __libc_start_main
call _fini

View File

@@ -46,8 +46,3 @@ long __syscall_common(long num, ...)
while(1);
return 0;
}
struct pthread *__pthread_self()
{
return 0;
}

21
libc/thread.c Normal file
View File

@@ -0,0 +1,21 @@
#include "syscalls.h"
struct pthread *__pt;
struct pthread *__pthread_self()
{
return __pt;
}
SYSCALL_DEF(set_thread_area)
{
SYSCALL_INIT(void *, ptr);
__pt = ptr;
return 0;
}
SYSCALL_DEF(set_tid_address)
{
SYSCALL_INIT();
return 0;
}