Revision 678f2df6 pc-bios/bios.diff

b/pc-bios/bios.diff
1 1
Index: rombios.c
2 2
===================================================================
3 3
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
4
retrieving revision 1.108
5
diff -u -w -r1.108 rombios.c
6
--- rombios.c	9 Feb 2004 16:48:50 -0000	1.108
7
+++ rombios.c	23 May 2004 15:48:52 -0000
8
@@ -2254,6 +2254,7 @@
9
       type      = read_byte(get_SS(),buffer+1) & 0x1f;
10
       removable = (read_byte(get_SS(),buffer+0) & 0x80) ? 1 : 0;
11
       mode      = read_byte(get_SS(),buffer+96) ? ATA_MODE_PIO32 : ATA_MODE_PIO16;
12
+      blksize   = 2048;
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	20 Jun 2004 13:10:07 -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 13
 
14
       write_byte(ebda_seg,&EbdaData->ata.devices[device].device, type);
15
       write_byte(ebda_seg,&EbdaData->ata.devices[device].removable, removable);
16
@@ -3378,6 +3379,8 @@
17
       and al,#0x10
18
       mov ah, al
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
19 21
 
20
+      or ecx, ecx                    
21
+      je int1586_tick_end
22
 int1586_tick:
23
       in al, #0x61
24
       and al,#0x10
25
@@ -3386,6 +3389,7 @@
26
       mov ah, al
27
       dec ecx
28
       jnz int1586_tick
29
+int1586_tick_end:
30
 ASM_END
31
 
32
       break;
33
@@ -3781,7 +3785,17 @@
34
           write_word(ebda_seg, 0x0022, mouse_driver_offset);
35
           write_word(ebda_seg, 0x0024, mouse_driver_seg);
36
           mouse_flags_2 = read_byte(ebda_seg, 0x0027);
37
+          if (mouse_driver_offset == 0 && 
38
+              mouse_driver_seg == 0) {
39
+              /* remove handler */
40
+              if ( (mouse_flags_2 & 0x80) != 0 ) {
41
+                  mouse_flags_2 &= ~0x80;
42
+                  inhibit_mouse_int_and_events(); // disable IRQ12 and packets
43
+              }
44
+          } else {
45
+              /* install handler */
46
           mouse_flags_2 |= 0x80;
47
+          }
48
           write_byte(ebda_seg, 0x0027, mouse_flags_2);
49
           CLEAR_CF();
50
           regs.u.r8.ah = 0;
51
@@ -4409,7 +4423,8 @@
52
   mouse_flags_2 = read_byte(ebda_seg, 0x0027);
22
 #define BX_USE_ATADRV    1
23
 #define BX_ELTORITO_BOOT 1
24
@@ -230,17 +232,6 @@
25
   out dx,ax
26
 MEND
53 27
 
54
   if ( (mouse_flags_2 & 0x80) != 0x80 ) {
55
-    BX_PANIC("int74_function:\n");
56
+      //    BX_PANIC("int74_function:\n");
57
+      return;
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 @@
58 43
     }
59 44
 
60
   package_count = mouse_flags_2 & 0x07;
61
@@ -4833,8 +4848,10 @@
62
 // ---------------------------------------------------------------------------
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
@@ -8344,6 +8332,19 @@
64
   pop   ax
65
   iret
63 66
 
64
   void
65
-int13_cdrom(DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS)
66
-  Bit16u DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS;
67
+int13_cdrom(DI, DIH, SI, SIH, BP, BPH, SP, SPH, BX, BXH, DX, DXH, CX, CXH, AX, AXH, 
68
+            DS, ES, FLAGS)
69
+  Bit16u DI, DIH, SI, SIH, BP, BPH, SP, SPH, BX, BXH, DX, DXH, CX, CXH, AX, AXH,
70
+         DS, ES, FLAGS;
71
 {
72
   Bit16u ebda_seg=read_word(0x0040,0x000E);
73
   Bit8u  device, status, locks;
74
@@ -7692,9 +7709,12 @@
67
+
68
+;--------------------
69
+#if BX_APM
70
+use32 386
71
+#define APM_PROT32
72
+#include "apmbios.S"
73
+use16 386
74
+
75
+#define APM_REAL
76
+#include "apmbios.S"
77
+
78
+#endif
79
+
80
 ;--------------------
81
 #if BX_PCIBIOS
82
 use32 386
83
@@ -9560,6 +9561,10 @@
84
 .org 0xf859 ; INT 15h System Services Entry Point
85
 int15_handler:
86
   pushf
87
+#if BX_APM
88
+  cmp ah, #0x53
89
+  je apm_call
90
+#endif
75 91
   push  ds
76
   push  ss
77
   pop   ds
78
-  pusha
79
+  // ebx is modified: BSD 5.2.1 boot loader problem, so we save all
80
+  // the 32 bit registers. It should be done in all the bios or no 32
81
+  // bit register should be used without saving it first.
82
+  pushad
83
   call  _int13_cdrom
84
-  popa
85
+  popad
86
   pop   ds
87
   pop   es
92
   push  es
93
   pushad
94
@@ -9570,6 +9575,10 @@
88 95
   popf
89
@@ -8401,57 +8421,69 @@
90
   cmp al, #0x08
91
   jne pci_pro_f09
92
   call pci_pro_select_reg
93
+  push edx
94
   mov dx, di
95
   and dx, #0x03
96
   add dx, #0x0cfc
97
   in  al, dx
98
+  pop edx
99
   mov cl, al
100
   jmp pci_pro_ok
101
 pci_pro_f09: ;; read configuration word
102
   cmp al, #0x09
103
   jne pci_pro_f0a
104
   call pci_pro_select_reg
105
+  push edx
106
   mov dx, di
107
   and dx, #0x02
108
   add dx, #0x0cfc
109
   in  ax, dx
110
+  pop edx
111
   mov cx, ax
112
   jmp pci_pro_ok
113
 pci_pro_f0a: ;; read configuration dword
114
   cmp al, #0x0a
115
   jne pci_pro_f0b
116
   call pci_pro_select_reg
117
+  push edx
118
   mov dx, #0x0cfc
119
   in  eax, dx
120
+  pop edx
121
   mov ecx, eax
122
   jmp pci_pro_ok
123
 pci_pro_f0b: ;; write configuration byte
124
   cmp al, #0x0b
125
   jne pci_pro_f0c
126
   call pci_pro_select_reg
127
+  push edx
128
   mov dx, di
129
   and dx, #0x03
130
   add dx, #0x0cfc
131
   mov al, cl
132
   out dx, al
133
+  pop edx
134
   jmp pci_pro_ok
135
 pci_pro_f0c: ;; write configuration word
136
   cmp al, #0x0c
137
   jne pci_pro_f0d
138
   call pci_pro_select_reg
139
+  push edx
140
   mov dx, di
141
   and dx, #0x02
142
   add dx, #0x0cfc
143
   mov ax, cx
144
   out dx, ax
145
+  pop edx
146
   jmp pci_pro_ok
147
 pci_pro_f0d: ;; write configuration dword
148
   cmp al, #0x0d
149
   jne pci_pro_unknown
150
   call pci_pro_select_reg
151
+  push edx
152
   mov dx, #0x0cfc
153
   mov eax, ecx
154
   out dx, eax
155
+  pop edx
156
   jmp pci_pro_ok
157
 pci_pro_unknown:
158
   mov ah, #0x81
159
@@ -8468,6 +8500,7 @@
160
   retf
161
 
162
 pci_pro_select_reg:
163
+  push edx
164
   mov eax, #0x800000
165
   mov ax,  bx
166
   shl eax, #8
167
@@ -8476,6 +8509,7 @@
168
   and al,  #0xfc
169
   mov dx, #0x0cf8
170
   out dx,  eax
171
+  pop edx
172
   ret
173
 
174
 use16 386
175
@@ -8536,57 +8570,69 @@
176
   cmp al, #0x08
177
   jne pci_real_f09
178
   call pci_real_select_reg
179
+  push dx
180
   mov dx, di
181
   and dx, #0x03
182
   add dx, #0x0cfc
183
   in  al, dx
184
+  pop dx
185
   mov cl, al
186
   jmp pci_real_ok
187
 pci_real_f09: ;; read configuration word
188
   cmp al, #0x09
189
   jne pci_real_f0a
190
   call pci_real_select_reg
191
+  push dx
192
   mov dx, di
193
   and dx, #0x02
194
   add dx, #0x0cfc
195
   in  ax, dx
196
+  pop dx
197
   mov cx, ax
198
   jmp pci_real_ok
199
 pci_real_f0a: ;; read configuration dword
200
   cmp al, #0x0a
201
   jne pci_real_f0b
202
   call pci_real_select_reg
203
+  push dx
204
   mov dx, #0x0cfc
205
   in  eax, dx
206
+  pop dx
207
   mov ecx, eax
208
   jmp pci_real_ok
209
 pci_real_f0b: ;; write configuration byte
210
   cmp al, #0x0b
211
   jne pci_real_f0c
212
   call pci_real_select_reg
213
+  push dx
214
   mov dx, di
215
   and dx, #0x03
216
   add dx, #0x0cfc
217
   mov al, cl
218
   out dx, al
219
+  pop dx
220
   jmp pci_real_ok
221
 pci_real_f0c: ;; write configuration word
222
   cmp al, #0x0c
223
   jne pci_real_f0d
224
   call pci_real_select_reg
225
+  push dx
226
   mov dx, di
227
   and dx, #0x02
228
   add dx, #0x0cfc
229
   mov ax, cx
230
   out dx, ax
231
+  pop dx
232
   jmp pci_real_ok
233
 pci_real_f0d: ;; write configuration dword
234
   cmp al, #0x0d
235
   jne pci_real_unknown
236
   call pci_real_select_reg
237
+  push dx
238
   mov dx, #0x0cfc
239
   mov eax, ecx
240
   out dx, eax
241
+  pop dx
242
   jmp pci_real_ok
243
 pci_real_unknown:
244
   mov ah, #0x81
245
@@ -8599,6 +8645,7 @@
246
   ret
96
   //JMPL(iret_modify_cf)
97
   jmp iret_modify_cf
98
+#if BX_APM
99
+apm_call:
100
+  jmp _apmreal_entry
101
+#endif
247 102
 
248
 pci_real_select_reg:
249
+  push dx
250
   mov eax, #0x800000
251
   mov ax,  bx
252
   shl eax, #8
253
@@ -8607,6 +8654,7 @@
254
   and al,  #0xfc
255
   mov dx, #0x0cf8
256
   out dx,  eax
257
+  pop dx
258
   ret
259
   
260
 .align 16
103
 ;; Protected mode IDT descriptor
104
 ;;

Also available in: Unified diff