kvisc/ka/sys/main.k

44 lines
674 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-02 20:13:05 +02:00
mov rcx, STRLEN_MAX
mov rdx, .bootmsg
prns.rep.nz rdx
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
.prepare_next:
call RFS.ActivateFrame
mov ax1, $rip
mov ax2, trap0_handler
call RFS.StoreReg
mov ax1, ax0
2019-07-17 22:25:50 +02:00
add ax0, ax0, 255 # TRAP no. (ax0 - 1)
2019-07-09 19:51:03 +02:00
call IDT.AddHandler
ret
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-07-15 20:58:17 +02:00
call SwitchToCMD
2019-06-18 12:58:26 +02:00
ret