feat: introduced tasking, added paging (no vm), moved malloc, added
syscalls, other stuff
This commit is contained in:
42
kernel/tasks/task.S
Normal file
42
kernel/tasks/task.S
Normal file
@@ -0,0 +1,42 @@
|
||||
.code32
|
||||
|
||||
.global __task_entry_point
|
||||
__task_entry_point:
|
||||
# Load segments
|
||||
popl %eax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
# pop isr_registers
|
||||
popa
|
||||
# Remove errono etc.
|
||||
addl $8,%esp # Cleans up the pushed error code and pushed ISR number
|
||||
sti
|
||||
# return to program
|
||||
iret # pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|
||||
.global __task_entry_point_inner
|
||||
__task_entry_point_inner:
|
||||
add $8, %esp # Remove useresp and ss (only exists in user space)
|
||||
call task_entry_point
|
||||
.global switch_task
|
||||
switch_task:
|
||||
movl 4(%esp), %eax
|
||||
movl 8(%esp), %edx
|
||||
test %eax, %eax
|
||||
jz _st_no_store
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl %esp, (%eax)
|
||||
_st_no_store:
|
||||
movl %edx, %esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user