43 lines
844 B
ArmAsm
43 lines
844 B
ArmAsm
.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
|
|
|
|
|
|
|