diff options
| -rw-r--r-- | mubios/arch/interrupt.S | 30 | ||||
| -rw-r--r-- | mubios/core/interrupt.c | 2 | ||||
| -rw-r--r-- | mubios/include/regs.h | 19 | ||||
| -rw-r--r-- | mubios/services/int10.c | 6 | ||||
| -rw-r--r-- | mubios/services/int13.c | 16 |
5 files changed, 30 insertions, 43 deletions
diff --git a/mubios/arch/interrupt.S b/mubios/arch/interrupt.S index 0822b1a..b3a461b 100644 --- a/mubios/arch/interrupt.S +++ b/mubios/arch/interrupt.S @@ -53,21 +53,11 @@ int1a_return: .type \name, @function \name: - # Build struct bios_regs on the interrupted real-mode stack. - push 0 - push es + # Build struct bios_regs from the pushad and segment frames. push ds - push bp - push di - push si - push dx - push cx - push bx - push ax - - mov bp, sp - mov ax, word ptr [bp + 24] - mov word ptr [bp + 18], ax + push es + .byte 0x66 + pushad # ESI = linear address of struct bios_regs. movzx esi, sp @@ -88,16 +78,10 @@ int1a_return: call enter_protected_service # Restore the context modified by the C service. - pop ax - pop bx - pop cx - pop dx - pop si - pop di - pop bp - pop ds + .byte 0x66 + popad pop es - add sp, 2 + pop ds iret .endm diff --git a/mubios/core/interrupt.c b/mubios/core/interrupt.c index 3f5bbb9..a9b3ce6 100644 --- a/mubios/core/interrupt.c +++ b/mubios/core/interrupt.c @@ -36,7 +36,7 @@ bios_service_dispatch (u8 vector, struct bios_regs *regs) break; default: - regs->ax = 0x0100u; + regs->eax = 0x0100u; regs->flags |= 0x0001u; break; } diff --git a/mubios/include/regs.h b/mubios/include/regs.h index eeafe6b..350a825 100644 --- a/mubios/include/regs.h +++ b/mubios/include/regs.h @@ -26,15 +26,18 @@ struct bios_regs { - u16 ax; - u16 bx; - u16 cx; - u16 dx; - u16 si; - u16 di; - u16 bp; - u16 ds; + u32 edi; + u32 esi; + u32 ebp; + u32 esp; + u32 ebx; + u32 edx; + u32 ecx; + u32 eax; u16 es; + u16 ds; + u16 return_ip; + u16 return_cs; u16 flags; }; diff --git a/mubios/services/int10.c b/mubios/services/int10.c index 76a1c1d..0e63ef2 100644 --- a/mubios/services/int10.c +++ b/mubios/services/int10.c @@ -44,7 +44,7 @@ int10_service (struct bios_regs *regs) u8 attribute; u16 position; - function = (u8)(regs->ax >> 8); + function = (u8)(regs->eax >> 8); if (function != 0x0Eu) return; @@ -52,8 +52,8 @@ int10_service (struct bios_regs *regs) cursor = (volatile u16 *)BDA_CURSOR; video = (volatile u16 *)VGA_TEXT_BASE; - character = (u8)regs->ax; - attribute = (u8)regs->bx; + character = (u8)regs->eax; + attribute = (u8)regs->ebx; position = *cursor; if (character == 0x0Du) diff --git a/mubios/services/int13.c b/mubios/services/int13.c index e5cef43..2c12261 100644 --- a/mubios/services/int13.c +++ b/mubios/services/int13.c @@ -38,7 +38,7 @@ struct edd_packet static void int13_fail (struct bios_regs *regs) { - regs->ax = 0x0100u; + regs->eax = 0x0100u; regs->flags |= BIOS_CF; } @@ -47,7 +47,7 @@ get_edd_packet (struct bios_regs *regs) { u32 address; - address = ((u32)regs->ds << 4) + regs->si; + address = ((u32)regs->ds << 4) + (u16)regs->esi; return (struct edd_packet *)address; } @@ -58,19 +58,19 @@ int13_service (struct bios_regs *regs) struct edd_packet *packet; u32 buffer_address; - function = (u8)(regs->ax >> 8); + function = (u8)(regs->eax >> 8); if (function == 0x41u) { - if (regs->bx != 0x55AAu) + if (regs->ebx != 0x55AAu) { int13_fail (regs); return; } - regs->ax = 0x3000u; - regs->bx = 0xAA55u; - regs->cx |= 0x0001u; + regs->eax = 0x3000u; + regs->ebx = 0xAA55u; + regs->ecx |= 0x0001u; regs->flags &= (u16)~BIOS_CF; return; } @@ -98,7 +98,7 @@ int13_service (struct bios_regs *regs) return; } - regs->ax = 0; + regs->eax = 0; regs->flags &= (u16)~BIOS_CF; return; } |
