kvisc/ka/sys/main.k

49 lines
752 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:
call print, .bootmsg
ret
.bootmsg = "Starting DOS...\n\n"
;
; Initialize TRAP handlers
;
InitSyscalls:
call RFS.ActivateFrame, 1
mov ax1, $eip
mov ax2, DefaultTrapHandler
call RFS.StoreReg
mov ax0, 256
mov ax1, 1
call IDT.AddHandler
ret
InitExcepts:
call RFS.ActivateFrame, 2
mov ax1, $eip
mov ax2, DefaultExceptionHandler
call RFS.StoreReg
call IDT.AddHandler, zero, 2
SwitchToCMD:
mov eax, Sys.Exit
trap 0
;
; Main function
;
main:
call PrintBootMsg
call InitSyscalls
call InitExcepts
call SwitchToCMD
ret