Minor cleanups.
[seabios.git] / src / romlayout.S
index ab742d566cb57836e83c807c430654eb749edfd6..1aa0bbfcf9fde835bdf595365b9e5e55a29bff7c 100644 (file)
@@ -104,12 +104,12 @@ __call16_from32:
         pushl %eax
 
         // Jump to 16bit mode
-        ljmp $0x20, $1f
+        ljmp $REAL_MODE_CS, $1f
 
         .code16gcc
 1:
         // restore data segment limits to 0xffff
-        movw $0x28, %ax
+        movw $REAL_MODE_DS, %ax
         movw %ax, %ds
         movw %ax, %es
         movw %ax, %ss
@@ -173,11 +173,13 @@ __call16:
         pushfw
         pushl %eax
         movl 0x06(%esp), %eax
-        movl %ecx, 0x1c(%eax)   // Save %ecx
+        movl %ecx, %ss:0x1c(%eax)       // Save %ecx
+        movw %ss, %cx
+        movw %cx, %ds                   // Restore %ds == %ss
         popl %ecx
-        movl %ecx, 0x20(%eax)   // Save %eax
+        movl %ecx, 0x20(%eax)           // Save %eax
         popw %cx
-        movw %cx, 0x28(%eax)    // Save flags
+        movw %cx, 0x28(%eax)            // Save flags
 
         // Store remaining registers
         movw %es, 0x02(%eax)
@@ -224,6 +226,7 @@ rombios32_gdt_48:
         .word rombios32_gdt
         .word 0x000f
 
+        .balign 8
 rombios32_gdt:
         .word 0, 0, 0, 0
         .word 0, 0, 0, 0
@@ -236,22 +239,12 @@ rombios32_gdt:
         // 16 bit data segment base=0x0 limit=0xffff (REAL_MODE_DS)
         .word 0xffff, 0, 0x9300, 0x0000
 
-// We need a copy of this string, but we are not actually a PnP BIOS,
-// so make sure it is *not* aligned, so OSes will not see it if they
-// scan.
-        .align 2
-        .byte 0
-        .globl pnp_string
-pnp_string:
-        .ascii "$PnP"
-
 
 /****************************************************************
  * Interrupt entry points
  ****************************************************************/
 
         .macro ENTRY cfunc
-        cli         // In case something far-calls insted of using "int"
         pushal
         pushw %es
         pushw %ds
@@ -268,16 +261,36 @@ pnp_string:
         .macro IRQ_ENTRY num
         .globl entry_\num
         entry_\num :
+        cli         // In case something far-calls instead of using "int"
         ENTRY handle_\num
         iretw
         .endm
 
-        .macro IRQ_TRAMPOLINE num
-        .globl irq_trampoline_0x\num
-        irq_trampoline_0x\num :
-        int $0x\num
+        // APM trampolines
+        .globl apm16protected_entry
+apm16protected_entry:
+        pushfw          // save flags
+        pushl %eax      // dummy
+        ENTRY handle_1553
+        addw $4, %sp    // pop dummy
+        popfw           // restore flags
+        lretw
+
+        .code32
+        .globl apm32protected_entry
+apm32protected_entry:
+        pushfw          // save flags
+        pushw %cs       // Setup for long jump to 16bitmode
+        incw (%esp)
+        pushw 1f
+        lcallw *(%esp)
+        addl $4, %esp   // pop call address
+        popfw
+        lretl
+        .code16gcc
+1:                      // 16bit entry point for apm32 code.
+        ENTRY handle_1553
         lretw
-        .endm
 
         .org 0xe2c3
         IRQ_ENTRY nmi
@@ -301,6 +314,15 @@ entry_18:
         RESET_STACK
         calll handle_18
 
+
+        // IRQ trampolines
+        .macro IRQ_TRAMPOLINE num
+        .globl irq_trampoline_0x\num
+        irq_trampoline_0x\num :
+        int $0x\num
+        lretw
+        .endm
+
         IRQ_TRAMPOLINE 02
         IRQ_TRAMPOLINE 10
         IRQ_TRAMPOLINE 13
@@ -342,7 +364,8 @@ entry_18:
         IRQ_ENTRY 0e
 
         .org 0xefc7
-        // XXX - Diskette Controller Parameter Table
+.include "out/floppy_dbt.proc.16.s"
+        .text
 
         .org 0xefd2
         IRQ_ENTRY 17
@@ -404,8 +427,7 @@ dummy_iret_handler:
         .ascii "06/23/99"
 
         .org 0xfffe
-        // model byte 0xFC = AT
-        .byte 0xfc
+        .byte CONFIG_MODEL_ID
         .byte 0x00
 
         .end