|
|
|
|
@ -12,7 +12,7 @@ section .text
|
|
|
|
|
[bits 32]
|
|
|
|
|
|
|
|
|
|
; FIXME: use a separate stack for real mode
|
|
|
|
|
bios_call:
|
|
|
|
|
_bios_call:
|
|
|
|
|
.PARAMS_START equ 36
|
|
|
|
|
.PARAM_BIOS_INTR_NUM equ .PARAMS_START
|
|
|
|
|
.PARAM_BIOS_INTR_ARGS_PTR equ .PARAMS_START + 4
|
|
|
|
|
@ -83,13 +83,30 @@ bios_call:
|
|
|
|
|
call [bp + 2]
|
|
|
|
|
pop bp
|
|
|
|
|
|
|
|
|
|
; TODO: return resulting registers to the caller
|
|
|
|
|
; Copy the resulting register values back into the `BiosIntr` struct provided by the caller.
|
|
|
|
|
pushfd
|
|
|
|
|
push es
|
|
|
|
|
push ds
|
|
|
|
|
push edi
|
|
|
|
|
push esi
|
|
|
|
|
push edx
|
|
|
|
|
push ecx
|
|
|
|
|
push ebx
|
|
|
|
|
push eax
|
|
|
|
|
mov cx, 32
|
|
|
|
|
mov si, sp
|
|
|
|
|
mov di, [bp + .PARAM_BIOS_INTR_ARGS_PTR]
|
|
|
|
|
rep movsb
|
|
|
|
|
add sp, 32
|
|
|
|
|
|
|
|
|
|
; Reset the segment registers that were changed to the caller-provided values.
|
|
|
|
|
xor ax, ax
|
|
|
|
|
mov ds, ax
|
|
|
|
|
mov es, ax
|
|
|
|
|
|
|
|
|
|
; Pop the `int` function off the stack.
|
|
|
|
|
add sp, 4
|
|
|
|
|
|
|
|
|
|
; Reload the GDT in case the BIOS call changed it.
|
|
|
|
|
mov bx, sp
|
|
|
|
|
lgdt [bx]
|
|
|
|
|
@ -116,7 +133,7 @@ bios_call:
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
global bios_call
|
|
|
|
|
global _bios_call
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%macro int_fn 1
|
|
|
|
|
|