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