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/main.k
julianb0 b890d67ff4
vm
2019-08-06 23:21:37 +02:00

53 lines
800 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:
mov ax0, 1
call RFS.ActivateFrame
mov ax1, $rip
mov ax2, DefaultTrapHandler
call RFS.StoreReg
mov ax0, 256
mov ax1, 1
call IDT.AddHandler
ret
InitExcepts:
mov ax0, 2
call RFS.ActivateFrame
mov ax1, $rip
mov ax2, DefaultExceptionHandler
call RFS.StoreReg
mov ax0, zero
mov ax1, 2
call IDT.AddHandler
SwitchToCMD:
mov rax, Sys.Exit
trap 0
;
; Main function
;
main:
call PrintBootMsg
call InitSyscalls
call InitExcepts
call SwitchToCMD
ret