0.6.2-alt1
[qemu] / qemu-snapshot-2004-11-28_23 / pc-bios / bios.diff
1 Index: rombios.c
2 ===================================================================
3 RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
4 retrieving revision 1.110
5 diff -u -w -r1.110 rombios.c
6 --- rombios.c   31 May 2004 13:11:27 -0000      1.110
7 +++ rombios.c   7 Oct 2004 21:23:50 -0000
8 @@ -137,6 +137,7 @@
9  #define DEBUG_INT16        0
10  #define DEBUG_INT1A        0
11  #define DEBUG_INT74        0
12 +#define DEBUG_APM          0
13  
14  #define BX_CPU           3
15  #define BX_USE_PS2_MOUSE 1
16 @@ -145,6 +146,7 @@
17  #define BX_SUPPORT_FLOPPY 1
18  #define BX_FLOPPY_ON_CNT 37   // 2 seconds
19  #define BX_PCIBIOS       1
20 +#define BX_APM           1
21  
22  #define BX_USE_ATADRV    1
23  #define BX_ELTORITO_BOOT 1
24 @@ -230,17 +232,6 @@
25    out dx,ax
26  MEND
27  
28 -MACRO HALT2
29 -  ;; the HALT macro is called with the line number of the HALT call.
30 -  ;; The line number is then sent to the PANIC_PORT, causing Bochs/Plex
31 -  ;; to print a BX_PANIC message.  This will normally halt the simulation
32 -  ;; with a message such as "BIOS panic at rombios.c, line 4091".
33 -  ;; However, users can choose to make panics non-fatal and continue.
34 -  mov dx,#PANIC_PORT2
35 -  mov ax,#?1
36 -  out dx,ax
37 -MEND
38 -
39  MACRO JMP_AP
40    db 0xea
41    dw ?2
42 @@ -1543,15 +1534,12 @@
43      }
44  
45    if (action & BIOS_PRINTF_HALT) {
46 -    // freeze in a busy loop.  If I do a HLT instruction, then in versions
47 -    // 1.3.pre1 and earlier, it will panic without ever updating the VGA
48 -    // display, so the panic message will not be visible.  By waiting
49 -    // forever, you are certain to see the panic message on screen.
50 -    // After a few more versions have passed, we can turn this back into
51 -    // a halt or something.
52 -    // do {} while (1);
53 +    // freeze in a busy loop.  
54  ASM_START
55 -    HALT2(__LINE__)
56 +    cli
57 + halt2_loop:
58 +    hlt
59 +    jmp halt2_loop
60  ASM_END
61      }
62  }
63 @@ -5412,8 +5400,8 @@
64          case 0x03: SET_BL( 0x06 ); break;
65          }
66  
67 -      DI = 0xefc7;
68 -      ES = 0xf000;
69 +      DI = read_word(0x00, 0x1e*4); // INT vector 0x1E
70 +      ES = read_word(0x00, 0x1e*4+2);
71        goto int13_success;
72        break;
73  
74 @@ -6984,8 +6972,8 @@
75          }
76  
77        /* set es & di to point to 11 byte diskette param table in ROM */
78 -      DI = 0xefc7;
79 -      ES = 0xf000;
80 +      DI = read_word(0x00, 0x1e*4); // INT vector 0x1E
81 +      ES = read_word(0x00, 0x1e*4+2);
82        CLEAR_CF(); // success
83        /* disk status not changed upon success */
84        return;
85 @@ -7880,7 +7868,7 @@
86    mov  al, #0x02
87    out  #0x0a, al   ;; clear DMA-1 channel 2 mask bit
88  
89 -  SET_INT_VECTOR(0x1E, #0xF000, #diskette_param_table)
90 +  SET_INT_VECTOR(0x1E, #0xF000, #diskette_param_table2)
91    SET_INT_VECTOR(0x40, #0xF000, #int13_diskette)
92    SET_INT_VECTOR(0x0E, #0xF000, #int0e_handler) ;; IRQ 6
93  
94 @@ -8344,6 +8332,19 @@
95    pop   ax
96    iret
97  
98 +
99 +;--------------------
100 +#if BX_APM
101 +use32 386
102 +#define APM_PROT32
103 +#include "apmbios.S"
104 +use16 386
105 +
106 +#define APM_REAL
107 +#include "apmbios.S"
108 +
109 +#endif
110 +
111  ;--------------------
112  #if BX_PCIBIOS
113  use32 386
114 @@ -9515,6 +9516,26 @@
115    pop  ds
116    iret
117  
118 +diskette_param_table2:
119 +;;  New diskette parameter table adding 3 parameters from IBM
120 +;;  Since no provisions are made for multiple drive types, most
121 +;;  values in this table are ignored.  I set parameters for 1.44M
122 +;;  floppy here
123 +db  0xAF
124 +db  0x02 ;; head load time 0000001, DMA used
125 +db  0x25
126 +db  0x02
127 +db    18
128 +db  0x1B
129 +db  0xFF
130 +db  0x6C
131 +db  0xF6
132 +db  0x0F
133 +db  0x08
134 +db    79 ;; maximum track
135 +db     0 ;; data transfer rate
136 +db     4 ;; drive type in cmos
137 +
138  .org 0xf045 ; INT 10 Functions 0-Fh Entry Point
139    HALT(__LINE__)
140    iret
141 @@ -9560,6 +9581,10 @@
142  .org 0xf859 ; INT 15h System Services Entry Point
143  int15_handler:
144    pushf
145 +#if BX_APM
146 +  cmp ah, #0x53
147 +  je apm_call
148 +#endif
149    push  ds
150    push  es
151    pushad
152 @@ -9570,6 +9595,10 @@
153    popf
154    //JMPL(iret_modify_cf)
155    jmp iret_modify_cf
156 +#if BX_APM
157 +apm_call:
158 +  jmp _apmreal_entry
159 +#endif
160  
161  ;; Protected mode IDT descriptor
162  ;;