summaryrefslogtreecommitdiff
path: root/pc-bios/bios.diff
blob: 0bb1d345c9cbb266aa717ee7231b4820d7bcee59 (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
Index: BIOS-bochs-latest
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/BIOS-bochs-latest,v
retrieving revision 1.133
diff -u -w -r1.133 BIOS-bochs-latest
Binary files /tmp/cvsrjjP5I and BIOS-bochs-latest differ
Index: rombios.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
retrieving revision 1.170
diff -u -w -r1.170 rombios.c
--- rombios.c	30 Sep 2006 11:22:53 -0000	1.170
+++ rombios.c	1 Oct 2006 16:03:53 -0000
@@ -4115,7 +4115,7 @@
                     case 3:
                         set_e820_range(ES, regs.u.r16.di, 
                                        0x00100000L, 
-                                       extended_memory_size - 0x10000L, 1);
+                                       extended_memory_size - ACPI_DATA_SIZE, 1);
                         regs.u.r32.ebx = 4;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4124,7 +4124,7 @@
                         break;
                     case 4:
                         set_e820_range(ES, regs.u.r16.di, 
-                                       extended_memory_size - 0x10000L, 
+                                       extended_memory_size - ACPI_DATA_SIZE, 
                                        extended_memory_size, 3); // ACPI RAM
                         regs.u.r32.ebx = 5;
                         regs.u.r32.eax = 0x534D4150;
@@ -8723,7 +8723,7 @@
 
 .align 16
 bios32_entry_point:
-  pushf
+  pushfd
   cmp eax, #0x49435024 ;; "$PCI"
   jne unknown_service
   mov eax, #0x80000000
@@ -8750,12 +8750,12 @@
 #ifdef BX_QEMU
   and dword ptr[esp+8],0xfffffffc ;; reset CS.RPL for kqemu
 #endif
-  popf
+  popfd
   retf
 
 .align 16
 pcibios_protected:
-  pushf
+  pushfd
   cli
   push esi
   push edi
@@ -8864,7 +8864,7 @@
 #ifdef BX_QEMU
   and dword ptr[esp+8],0xfffffffc ;; reset CS.RPL for kqemu
 #endif
-  popf
+  popfd
   stc
   retf
 pci_pro_ok:
@@ -8874,7 +8874,7 @@
 #ifdef BX_QEMU
   and dword ptr[esp+8],0xfffffffc ;; reset CS.RPL for kqemu
 #endif
-  popf
+  popfd
   clc
   retf
 
Index: rombios.h
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.h,v
retrieving revision 1.1
diff -u -w -r1.1 rombios.h
--- rombios.h	30 Sep 2006 11:22:53 -0000	1.1
+++ rombios.h	1 Oct 2006 16:03:54 -0000
@@ -19,7 +19,7 @@
 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 /* define it to include QEMU specific code */
-//#define BX_QEMU
+#define BX_QEMU
 
 #define BX_ROMBIOS32     1
 #define DEBUG_ROMBIOS    0
@@ -48,3 +48,7 @@
 #endif
 #define BX_INFO(format, p...)   bios_printf(BIOS_PRINTF_INFO, format, ##p)
 #define BX_PANIC(format, p...)  bios_printf(BIOS_PRINTF_DEBHALT, format, ##p)
+
+#define ACPI_DATA_SIZE    0x00010000L
+#define PM_IO_BASE        0xb000
+#define CPU_COUNT_ADDR    0xf000
Index: rombios32.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios32.c,v
retrieving revision 1.4
diff -u -w -r1.4 rombios32.c
--- rombios32.c	30 Sep 2006 11:22:53 -0000	1.4
+++ rombios32.c	1 Oct 2006 16:03:54 -0000
@@ -55,13 +55,10 @@
 
 #define APIC_ENABLED 0x0100
 
-#define CPU_COUNT_ADDR 0xf000
 #define AP_BOOT_ADDR 0x10000
 
 #define MPTABLE_MAX_SIZE  0x00002000
-#define ACPI_DATA_SIZE    0x00010000
 #define SMI_CMD_IO_ADDR   0xb2
-#define PM_IO_BASE        0xb000
 
 #define BIOS_TMP_STORAGE  0x00030000 /* 64 KB used to copy the BIOS to shadow RAM */
 
@@ -354,12 +351,14 @@
 
 void delay_ms(int n)
 {
-    int i, j, r1, r2;
+    int i, j;
     for(i = 0; i < n; i++) {
-#if BX_QEMU
+#ifdef BX_QEMU
         /* approximative ! */
         for(j = 0; j < 1000000; j++);
 #else
+        {
+            int r1, r2;
         j = 66;
         r1 = inb(0x61) & 0x10;
         do {
@@ -369,6 +368,7 @@
                 r1 = r2;
             }
         } while (j > 0);
+        }
 #endif
     }
 }
Index: rombios32start.S
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios32start.S,v
retrieving revision 1.1
diff -u -w -r1.1 rombios32start.S
--- rombios32start.S	28 Sep 2006 18:56:20 -0000	1.1
+++ rombios32start.S	1 Oct 2006 16:03:54 -0000
@@ -1,3 +1,25 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: bios.diff,v 1.15 2006-10-01 16:08:15 bellard Exp $
+/////////////////////////////////////////////////////////////////////////
+//
+//  32 bit Bochs BIOS init code
+//  Copyright (C) 2006 Fabrice Bellard
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2 of the License, or (at your option) any later version.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+#include "rombios.h"
+
 .globl _start
 .globl smp_ap_boot_code_start
 .globl smp_ap_boot_code_end
@@ -6,8 +28,6 @@
 .global smm_code_start
 .global smm_code_end
 
-#define PM_IO_BASE        0xb000
-
 _start:
   /* clear bss section */
   xor %eax, %eax
@@ -18,13 +38,11 @@
 
   jmp rombios32_init
 
-#define CPU_COUNT 0xf000
-
   .code16                        
 smp_ap_boot_code_start:
   xor %ax, %ax
   mov %ax, %ds
-  incw CPU_COUNT
+  incw CPU_COUNT_ADDR
 1:
   hlt
   jmp 1b
@@ -33,7 +51,7 @@
 /* code to relocate SMBASE to 0xa0000 */
 smm_relocation_start:
   mov $0x38000 + 0x7efc, %ebx
-  mov (%ebx), %al  /* revision ID to see if x86_64 or x86 */
+  addr32 mov (%ebx), %al  /* revision ID to see if x86_64 or x86 */
   cmp $0x64, %al
   je 1f
   mov $0x38000 + 0x7ef8, %ebx
@@ -42,7 +60,7 @@
   mov $0x38000 + 0x7f00, %ebx
 2:
   movl $0xa0000, %eax
-  movl %eax, (%ebx)
+  addr32 movl %eax, (%ebx)
   rsm                
 smm_relocation_end: