93 lines
870 B
ArmAsm
93 lines
870 B
ArmAsm
.global irq0
|
|
.extern _switch_task
|
|
|
|
.global jump_kernel
|
|
.global jump_user
|
|
|
|
.extern ss
|
|
.extern esp
|
|
.extern eflags
|
|
.extern cs
|
|
.extern eip
|
|
|
|
.section .bss
|
|
.align 16
|
|
task_stack_bottom:
|
|
.skip 4096
|
|
task_stack_top:
|
|
|
|
.skip 4
|
|
|
|
temp_esp:
|
|
|
|
.skip 4
|
|
|
|
.section .text
|
|
irq0:
|
|
mov %esp, (temp_esp)
|
|
mov $task_stack_top, %esp
|
|
|
|
pusha
|
|
mov temp_esp, %eax
|
|
push %eax
|
|
push 8(%eax)
|
|
push 4(%eax)
|
|
push (%eax)
|
|
|
|
mov $0x10, %eax
|
|
mov %ax, %ds
|
|
mov %ax, %es
|
|
mov %ax, %fs
|
|
mov %ax, %gs
|
|
|
|
call _switch_task
|
|
|
|
iret
|
|
|
|
jump_kernel:
|
|
mov (ss), %eax
|
|
mov %ax, %ds
|
|
mov %ax, %es
|
|
mov %ax, %fs
|
|
mov %ax, %gs
|
|
mov %ax, %ss
|
|
|
|
pop %eax
|
|
|
|
mov $0x20, %eax
|
|
outb %al, $0x20
|
|
|
|
popa
|
|
|
|
mov (esp), %esp
|
|
|
|
push (eflags)
|
|
push (cs)
|
|
push (eip)
|
|
|
|
iret
|
|
|
|
jump_user:
|
|
mov (ss), %eax
|
|
mov %ax, %ds
|
|
mov %ax, %es
|
|
mov %ax, %fs
|
|
mov %ax, %gs
|
|
|
|
pop %eax
|
|
|
|
mov $0x20, %eax
|
|
outb %al, $0x20
|
|
|
|
popa
|
|
|
|
push (ss)
|
|
push (esp)
|
|
push (eflags)
|
|
push (cs)
|
|
push (eip)
|
|
|
|
iret
|
|
|
|
|