kernel/diskio: EBIOS access is first class citizen in kernel

This commit is contained in:
Nero 2020-04-28 22:09:56 +02:00
parent b73bfbe043
commit 6d1befb49f

View File

@ -7,6 +7,13 @@ chssiz: equ 8
chstab: resw (4*chssiz) chstab: resw (4*chssiz)
; Disk access packet for EBIOS extensions
dapps: equ 0 ; byte packet size
dapnum: equ 2 ; word number of sectors to transfer
dapbuf: equ 4 ; dword transfer buffer
dapsec: equ 8 ; qword absolute sector number
dapsiz: equ 16
section .text section .text
; Convert between drive number and BIOS dl ; Convert between drive number and BIOS dl
@ -80,30 +87,59 @@ adisk: push bp
push ds push ds
push es push es
mov bp, sp mov bp, sp
push ax
cmp cx, 0xFFFF cmp cx, 0xFFFF
je .islrg je .lrg
; build a disk access packet on the stack ; build ebios DAP from registers supplied
push ds ; dword transfer buffer ; qword sector number
push bx push cs
push cx ; word number of sectors push cs
push cs ; dword starting sector number (CS always 0) push cs
push dx push dx
; dword target buffer
push ds
push bx
; word number of sectors
push cx
jmp .psz
; set our freshly created dap as DS:BX .lrg: ; build ebios DAP from int 25h DAP
mov bx, sp ; qword sector number
push cs
push cs
mov ax, [bx+2]
push ax
mov ax, [bx]
push ax
; dword target buffer
mov ax, [bx+8]
push ax
mov ax, [bx+6]
push ax
; word number of sectors
mov ax, [bx+4]
push ax
.psz: ; word packet size
mov ax, dapsiz
push ax
; DS:SI = SS:SP (ptr to dap)
push ss push ss
pop ds pop ds
mov si, sp
.islrg: mov dl, al ; set up int 13h subfunction number
call fndchs mov ax, [si+dapsiz]
call calchs add ah, 0x40
; get BIOS drive number
mov dl, al mov dl, al
mov al, [bx+4] call dnconv
mov es, [bx+8]
mov bx, [bx+6]
int 0x13 int 0x13
jc .ret
.ret: mov sp, bp .ret: mov sp, bp
pop es pop es