Update userspace

This commit is contained in:
Alex
2023-06-10 13:10:56 +03:00
parent ed5faa7b55
commit 22e75b9540
63 changed files with 2362 additions and 2151 deletions

View File

@ -1,36 +1,36 @@
void __attribute__((naked, used, no_stack_protector)) _ld_start()
void __attribute__((naked, used, no_stack_protector)) _start()
{
__asm__("movq $0, %rbp\n"
"pushq %rbp\n"
"pushq %rbp\n"
"movq %rsp, %rbp\n"
__asm__("movq $0, %rbp\n"
"pushq %rbp\n"
"pushq %rbp\n"
"movq %rsp, %rbp\n"
"pushq %rcx\n"
"pushq %rdx\n"
"pushq %rsi\n"
"pushq %rdi\n"
"pushq %rcx\n"
"pushq %rdx\n"
"pushq %rsi\n"
"pushq %rdi\n"
"call ld_main\n"
"movl %eax, %edi\n" // Move return value to edi
"cmp $0, %edi\n" // Check if return value is 0
"jne _exit\n" // If not, jump to _exit
"call ld_main\n"
"movl %eax, %edi\n" // Move return value to edi
"cmp $0, %edi\n" // Check if return value is 0
"jne _exit\n" // If not, jump to _exit
"popq %rdi\n"
"popq %rsi\n"
"popq %rdx\n"
"popq %rcx\n"
"popq %rdi\n"
"popq %rsi\n"
"popq %rdx\n"
"popq %rcx\n"
"call ld_load\n"
"movl %eax, %edi\n" // Move return value to edi
"call _exit"); // Call _exit
"call ld_load\n"
"movl %eax, %edi\n" // Move return value to edi
"call _exit"); // Call _exit
}
void _exit(int Code)
{
__asm__ __volatile__("syscall"
:
: "a"(0), "D"(Code)
: "rcx", "r11", "memory");
while (1)
;
__asm__ __volatile__("syscall"
:
: "a"(0), "D"(Code)
: "rcx", "r11", "memory");
while (1)
;
}