kvisc/ka/sys/main.k

44 lines
674 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.
PrintBootMsg:
mov rcx, STRLEN_MAX
mov rdx, .bootmsg
prns.rep.nz rdx
ret
.bootmsg = "Starting DOS...\n\n"
;
; Initialize TRAP handlers
;
InitSyscalls:
mov ax0, 1
.prepare_next:
call RFS.ActivateFrame
mov ax1, $rip
mov ax2, trap0_handler
call RFS.StoreReg
mov ax1, ax0
add ax0, ax0, 255 # TRAP no. (ax0 - 1)
call IDT.AddHandler
ret
SwitchToCMD:
mov rax, Sys.Exit
trap 0
;
; Main function
;
main:
call PrintBootMsg
call InitSyscalls
call SwitchToCMD
ret