From 39ef1f9a3e7bac57a52826ff07d2547b91eb00eb Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Mon, 13 Apr 2020 13:53:21 +0000 Subject: [PATCH] Implement some syscall handling --- boot/kernel.asm | 62 +++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/boot/kernel.asm b/boot/kernel.asm index a2873b4..6a704e7 100644 --- a/boot/kernel.asm +++ b/boot/kernel.asm @@ -1,7 +1,7 @@ cpu 8086 org 0x7C00 -stack: equ 0x7C00 +stack: equ 0x7C00 framsz: equ 0x300 jmp init @@ -68,23 +68,43 @@ getax: push ds pop si ret -sftab: dw 0, 0, 0, 0 ; 00-03 - dw 0, 0, 0, 0 ; 04-07 - dw 0, 0, 0, 0 ; 08-0b - dw 0, 0, 0, 0 ; 0c-0f - dw 0, 0, 0, 0 ; 10-13 - dw 0, 0, 0, 0 ; 14-17 - dw 0, 0, 0, 0 ; 18-1b - dw 0, 0, 0, 0 ; 1c-1f - dw 0, 0, 0, 0 ; 20-23 - dw 0, dos25, 0, 0 ; 24-27 - dw 0, 0, 0, 0 ; 28-2b - dw 0, 0, 0, 0 ; 2c-2f + ; No such subfunction - set carry and exit +sferr: stc + ret - ; DOSINT 25h: Set interrupt vector + ; Subfunction table + align 2 +sftab: dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, setint, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + dw sferr, sferr, sferr, sferr + + ; DOS 25h: Set interrupt vector ; IN al interrupt number ; ds:dx entry point -dos25: +setint: push ax + push bx + xor ah, ah + add al, al + add al, al + mov bx, ax + mov [cs:bx], dx + mov ax, ds + mov [cs:bx+2], ds + pop bx + pop ax ret ; ===== end of resident, begin of transient startup code @@ -96,16 +116,13 @@ init: xor ax, ax mov ss, ax xor sp, sp - mov ax, 0x2521 + mov al, 0x21 mov dx, int21h - pushf - push cs - call int21h + call setint + mov ax, 0x2520 mov dx, int20h - pushf - push cs - call int21h + call setint main: push cs pop ds @@ -120,5 +137,4 @@ loop: lodsb end: hlt jmp end - align 2048 msg: db "rdos kernel stub", 0x0A, 0x0D, 0