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

53 lines
800 B
Plaintext
Raw Normal View History

2019-05-30 12:44:56 +02:00
; The OS/K Team licenses this file to you under the MIT license.
2019-05-30 12:27:13 +02:00
; See the LICENSE file in the project root for more information.
2019-06-21 22:19:55 +02:00
PrintBootMsg:
2019-07-24 16:52:26 +02:00
call print, .bootmsg
2019-06-21 22:19:55 +02:00
ret
.bootmsg = "Starting DOS...\n\n"
2019-07-09 19:51:03 +02:00
;
; Initialize TRAP handlers
;
InitSyscalls:
mov ax0, 1
call RFS.ActivateFrame
mov ax1, $rip
2019-08-06 23:21:37 +02:00
mov ax2, DefaultTrapHandler
2019-07-09 19:51:03 +02:00
call RFS.StoreReg
2019-08-06 23:21:37 +02:00
mov ax0, 256
mov ax1, 1
2019-07-09 19:51:03 +02:00
call IDT.AddHandler
ret
2019-08-06 23:21:37 +02:00
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
2019-07-15 20:58:17 +02:00
SwitchToCMD:
mov rax, Sys.Exit
trap 0
2019-05-30 12:27:13 +02:00
;
; Main function
;
main:
2019-06-21 22:19:55 +02:00
call PrintBootMsg
2019-07-09 19:51:03 +02:00
call InitSyscalls
2019-08-06 23:21:37 +02:00
call InitExcepts
2019-07-15 20:58:17 +02:00
call SwitchToCMD
2019-06-18 12:58:26 +02:00
ret