Kernel: We can create basic userspace processes

These are still allocated on the kernel memory
This commit is contained in:
Bananymous
2023-04-12 17:51:36 +03:00
parent 34358b8471
commit 8ee63f8264
10 changed files with 121 additions and 82 deletions

View File

@@ -25,4 +25,23 @@ continue_thread:
movl 8(%esp), %ecx
movl 4(%esp), %esp
movl $0, %eax
jmp *%ecx
jmp *%ecx
# void thread_jump_userspace(uint32_t rsp, uint32_t rip)
.global thread_jump_userspace
thread_jump_userspace:
movl $0x23, %eax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movl 8(%esp), %ecx
movl 4(%esp), %esp
pushl $0x23
pushl %esp
pushfl
pushl $0x1B
pushl %ecx
iret

View File

@@ -23,4 +23,14 @@ start_thread:
continue_thread:
movq %rdi, %rsp
movq $0, %rax
jmp *%rsi
jmp *%rsi
# void thread_jump_userspace(uint64_t rsp, uint64_t rip)
.global thread_jump_userspace
thread_jump_userspace:
pushq $0x23
pushq %rdi
pushfq
pushq $0x1B
pushq %rsi
iretq