1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/ka/sys/intr/trap0.k
2019-07-09 19:51:03 +02:00

43 lines
605 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 rax, .impl
mov rbp, TRAP0_STACK
jmp TrapHandlers.prolog
.impl:
mov ax0, r12
call RFS.LoadArgs
b.z ax0, Sys.HLT, .handle_HLT
b.z ax0, Sys.DIR, .handle_DIR
.fini:
jmp TrapHandlers.epilog
;
; Syscall implementations
;
.handle_DIR:
call CMD.builtins.dir
jmp .fini
.handle_HLT:
hlt
.HLT.loop:
xpause
scan rax
b.z rax, 0, .HLT.loop
prn rax
jmp .HLT.loop