Statistics
| Branch: | Revision:

root / pc-bios / bios.diff @ 0986ac3b

History | View | Annotate | Download (8.5 kB)

1
Index: apmbios.S
2
===================================================================
3
RCS file: /cvsroot/bochs/bochs/bios/apmbios.S,v
4
retrieving revision 1.4
5
diff -u -w -r1.4 apmbios.S
6
--- apmbios.S        26 Dec 2005 10:35:51 -0000        1.4
7
+++ apmbios.S        3 May 2006 21:22:46 -0000
8
@@ -225,6 +225,7 @@
9
 APMSYM(05):
10
   cmp al, #0x05
11
   jne APMSYM(07)
12
+  sti
13
   hlt
14
   jmp APMSYM(ok)
15
 
16
Index: rombios.c
17
===================================================================
18
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
19
retrieving revision 1.160
20
diff -u -w -r1.160 rombios.c
21
--- rombios.c        25 Jan 2006 17:51:49 -0000        1.160
22
+++ rombios.c        3 May 2006 21:22:48 -0000
23
@@ -1816,6 +1816,7 @@
24
 {
25
   printf(BX_APPNAME" BIOS - build: %s\n%s\nOptions: ",
26
     BIOS_BUILD_DATE, bios_cvs_version_string);
27
+#if 0
28
   printf(
29
 #ifdef BX_APM
30
   "apmbios "
31
@@ -1827,6 +1828,9 @@
32
   "eltorito "
33
 #endif
34
   "\n\n");
35
+#else
36
+  printf("apmbios pcibios eltorito \n\n");
37
+#endif
38
 }
39
 
40
 //--------------------------------------------------------------------------
41
@@ -3999,6 +4003,29 @@
42
 }
43
 #endif
44
 
45
+
46
+void set_e820_range(ES, DI, start, end, type)
47
+     Bit16u ES; 
48
+     Bit16u DI;
49
+     Bit32u start;
50
+     Bit32u end; 
51
+     Bit16u type;
52
+{
53
+    write_word(ES, DI, start);
54
+    write_word(ES, DI+2, start >> 16);
55
+    write_word(ES, DI+4, 0x00);
56
+    write_word(ES, DI+6, 0x00);
57
+    
58
+    end -= start;
59
+    write_word(ES, DI+8, end);
60
+    write_word(ES, DI+10, end >> 16);
61
+    write_word(ES, DI+12, 0x0000);
62
+    write_word(ES, DI+14, 0x0000);
63
+    
64
+    write_word(ES, DI+16, type);
65
+    write_word(ES, DI+18, 0x0);
66
+}
67
+
68
   void
69
 int15_function32(regs, ES, DS, FLAGS)
70
   pushad_regs_t regs; // REGS pushed via pushad
71
@@ -4063,19 +4090,8 @@
72
                 switch(regs.u.r16.bx)
73
                 {
74
                     case 0:
75
-                        write_word(ES, regs.u.r16.di, 0x00);
76
-                        write_word(ES, regs.u.r16.di+2, 0x00);
77
-                        write_word(ES, regs.u.r16.di+4, 0x00);
78
-                        write_word(ES, regs.u.r16.di+6, 0x00);
79
-
80
-                        write_word(ES, regs.u.r16.di+8, 0xFC00);
81
-                        write_word(ES, regs.u.r16.di+10, 0x0009);
82
-                        write_word(ES, regs.u.r16.di+12, 0x0000);
83
-                        write_word(ES, regs.u.r16.di+14, 0x0000);
84
-
85
-                        write_word(ES, regs.u.r16.di+16, 0x1);
86
-                        write_word(ES, regs.u.r16.di+18, 0x0);
87
-
88
+                        set_e820_range(ES, regs.u.r16.di, 
89
+                                       0x0000000L, 0x0009fc00L, 1);
90
                         regs.u.r32.ebx = 1;
91
                         regs.u.r32.eax = 0x534D4150;
92
                         regs.u.r32.ecx = 0x14;
93
@@ -4083,6 +4099,24 @@
94
                         return;
95
                         break;
96
                     case 1:
97
+                        set_e820_range(ES, regs.u.r16.di, 
98
+                                       0x0009fc00L, 0x000a0000L, 2);
99
+                        regs.u.r32.ebx = 2;
100
+                        regs.u.r32.eax = 0x534D4150;
101
+                        regs.u.r32.ecx = 0x14;
102
+                        CLEAR_CF();
103
+                        return;
104
+                        break;
105
+                    case 2:
106
+                        set_e820_range(ES, regs.u.r16.di, 
107
+                                       0x000e8000L, 0x00100000L, 2);
108
+                        regs.u.r32.ebx = 3;
109
+                        regs.u.r32.eax = 0x534D4150;
110
+                        regs.u.r32.ecx = 0x14;
111
+                        CLEAR_CF();
112
+                        return;
113
+                        break;
114
+                    case 3:
115
                         extended_memory_size = inb_cmos(0x35);
116
                         extended_memory_size <<= 8;
117
                         extended_memory_size |= inb_cmos(0x34);
118
@@ -4092,9 +4126,9 @@
119
                             extended_memory_size = 0x3bc000; // everything after this is reserved memory until we get to 0x100000000
120
                         }
121
                         extended_memory_size *= 1024;
122
-                        extended_memory_size += 15728640; // make up for the 16mb of memory that is chopped off
123
+                        extended_memory_size += (16L * 1024 * 1024);
124
 
125
-                        if(extended_memory_size <= 15728640)
126
+                        if(extended_memory_size <= (16L * 1024 * 1024))
127
                         {
128
                             extended_memory_size = inb_cmos(0x31);
129
                             extended_memory_size <<= 8;
130
@@ -4102,28 +4136,23 @@
131
                             extended_memory_size *= 1024;
132
                         }
133
 
134
-                        write_word(ES, regs.u.r16.di, 0x0000);
135
-                        write_word(ES, regs.u.r16.di+2, 0x0010);
136
-                        write_word(ES, regs.u.r16.di+4, 0x0000);
137
-                        write_word(ES, regs.u.r16.di+6, 0x0000);
138
-
139
-                        write_word(ES, regs.u.r16.di+8, extended_memory_size);
140
-                        extended_memory_size >>= 16;
141
-                        write_word(ES, regs.u.r16.di+10, extended_memory_size);
142
-                        extended_memory_size >>= 16;
143
-                        write_word(ES, regs.u.r16.di+12, extended_memory_size);
144
-                        extended_memory_size >>= 16;
145
-                        write_word(ES, regs.u.r16.di+14, extended_memory_size);
146
-
147
-                        write_word(ES, regs.u.r16.di+16, 0x1);
148
-                        write_word(ES, regs.u.r16.di+18, 0x0);
149
-
150
-                        regs.u.r32.ebx = 0;
151
+                        set_e820_range(ES, regs.u.r16.di, 
152
+                                       0x00100000L, extended_memory_size, 1);
153
+                        regs.u.r32.ebx = 4;
154
                         regs.u.r32.eax = 0x534D4150;
155
                         regs.u.r32.ecx = 0x14;
156
                         CLEAR_CF();
157
                         return;
158
                         break;
159
+                    case 4:
160
+                        /* 256KB BIOS area at the end of 4 GB */
161
+                        set_e820_range(ES, regs.u.r16.di, 
162
+                                       0xfffc0000L, 0x00000000L, 2);
163
+                        regs.u.r32.ebx = 0;
164
+                        regs.u.r32.eax = 0x534D4150;
165
+                        regs.u.r32.ecx = 0x14;
166
+                        CLEAR_CF();
167
+                        return;
168
                     default:  /* AX=E820, DX=534D4150, BX unrecognized */
169
                         goto int15_unimplemented;
170
                         break;
171
@@ -8713,6 +8742,7 @@
172
   mov al, #0x80
173
 bios32_end:
174
   popf
175
+  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
176
   retf
177
 
178
 .align 16
179
@@ -8823,17 +8853,17 @@
180
 pci_pro_fail:
181
   pop edi
182
   pop esi
183
-  sti
184
   popf
185
   stc
186
+  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
187
   retf
188
 pci_pro_ok:
189
   xor ah, ah
190
   pop edi
191
   pop esi
192
-  sti
193
   popf
194
   clc
195
+  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
196
   retf
197
 
198
 pci_pro_select_reg:
199
@@ -8971,7 +9001,7 @@
200
   jmp pci_real_ok
201
 pci_real_f0d: ;; write configuration dword
202
   cmp al, #0x0d
203
-  jne pci_real_unknown
204
+  jne pci_real_f0e
205
   call pci_real_select_reg
206
   push dx
207
   mov dx, #0x0cfc
208
@@ -8979,6 +9009,46 @@
209
   out dx, eax
210
   pop dx
211
   jmp pci_real_ok
212
+pci_real_f0e: ;; get irq routing options
213
+  cmp al, #0x0e
214
+  jne pci_real_unknown
215
+  SEG ES
216
+  cmp word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start
217
+  jb pci_real_too_small    
218
+  SEG ES
219
+  mov word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start        
220
+  pushf
221
+  push ds
222
+  push es
223
+  push cx
224
+  push si
225
+  push di
226
+  cld
227
+  mov si, #pci_routing_table_structure_start
228
+  push cs
229
+  pop ds
230
+  SEG ES
231
+  mov cx, [di+2]
232
+  SEG ES
233
+  mov es, [di+4]
234
+  mov di, cx
235
+  mov cx, #pci_routing_table_structure_end - pci_routing_table_structure_start
236
+  rep 
237
+      movsb
238
+  pop di
239
+  pop si
240
+  pop cx
241
+  pop es
242
+  pop ds
243
+  popf
244
+  mov bx, #(1 << 9) | (1 << 11)   ;; irq 9 and 11 are used
245
+  jmp pci_real_ok
246
+pci_real_too_small:
247
+  SEG ES
248
+  mov word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start        
249
+  mov ah, #0x89
250
+  jmp pci_real_fail
251
+
252
 pci_real_unknown:
253
   mov ah, #0x81
254
 pci_real_fail:
255
@@ -9019,6 +9089,7 @@
256
   dw 0,0 ;; Miniport data
257
   db 0,0,0,0,0,0,0,0,0,0,0 ;; reserved
258
   db 0x07 ;; checksum
259
+pci_routing_table_structure_start:
260
   ;; first slot entry PCI-to-ISA (embedded)
261
   db 0 ;; pci bus number
262
   db 0x08 ;; pci device number (bit 7-3)
263
@@ -9097,6 +9168,7 @@
264
   dw 0xdef8 ;; IRQ bitmap INTD#
265
   db 5 ;; physical slot (0 = embedded)
266
   db 0 ;; reserved
267
+pci_routing_table_structure_end:
268
 
269
 pci_irq_list:
270
   db 11, 10, 9, 5;