kvisc/ka/sys/intr/trap0.k

50 lines
760 B
Plaintext

; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
TRAP0_STACK := 0x300000
trap0_handler:
.init:
mov rcx, .impl
mov rbp, TRAP0_STACK
jmp TrapHandlers.prolog
.impl:
mov ax0, r12
mov ax1, $rax
call RFS.LoadReg
call RFS.LoadArgs
b.z rax, Sys.HLT, .handle_HLT
b.z rax, Sys.FindNext, .handle_FindNext
b.z rax, Sys.FindFirst, .handle_FindFirst
.fini:
jmp TrapHandlers.epilog
;
; Syscall implementations
;
.handle_FindFirst:
call DISK.FindFirst
jmp .fini
.handle_FindNext:
call DISK.FindNext
jmp .fini
.handle_HLT:
hlt
.HLT.loop:
xpause
scan rax
b.z rax, 0, .HLT.loop
prn rax
jmp .HLT.loop