|
@@ -9,6 +9,7 @@
|
9
|
9
|
#define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
|
10
|
10
|
#define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
|
11
|
11
|
#define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
|
|
12
|
+#define PNP_GET_BBS_VERSION 0x60
|
12
|
13
|
|
13
|
14
|
.text
|
14
|
15
|
.code16
|
|
@@ -123,23 +124,41 @@ init:
|
123
|
124
|
movw $init_message, %si
|
124
|
125
|
call print_message
|
125
|
126
|
/* Check for PnP BIOS */
|
|
127
|
+ testw $0x0f, %di /* PnP signature must be aligned - bochs */
|
|
128
|
+ jnz hook_int19 /* uses unalignment to indicate 'fake' PnP. */
|
126
|
129
|
cmpl $PNP_SIGNATURE, %es:0(%di)
|
127
|
|
- je ispnp
|
128
|
|
-notpnp: /* Not PnP: hook INT19 */
|
|
130
|
+ jne hook_int19
|
|
131
|
+ /* Is PnP: print PnP message */
|
|
132
|
+ movw $init_message_pnp, %si
|
|
133
|
+ call print_message
|
|
134
|
+ xchgw %bx, %bx
|
|
135
|
+ /* Check for BBS */
|
|
136
|
+ pushw %es:0x1b(%di) /* Real-mode data segment */
|
|
137
|
+ pushw %ds /* &(bbs_version) */
|
|
138
|
+ pushw $bbs_version
|
|
139
|
+ pushw $PNP_GET_BBS_VERSION
|
|
140
|
+ lcall *%es:0xd(%di)
|
|
141
|
+ addw $16, %sp
|
|
142
|
+ testw %ax, %ax
|
|
143
|
+ jne hook_int19
|
|
144
|
+ movw $init_message_bbs, %si
|
|
145
|
+ call print_message
|
|
146
|
+ jmp hook_bbs
|
|
147
|
+ /* Not BBS-compliant - must hook INT 19 */
|
|
148
|
+hook_int19:
|
|
149
|
+ movw $init_message_int19, %si
|
|
150
|
+ call print_message
|
129
|
151
|
xorw %ax, %ax
|
130
|
152
|
movw %ax, %es
|
131
|
153
|
pushw %cs
|
132
|
154
|
pushw $int19_entry
|
133
|
155
|
popl %es:( 0x19 * 4 )
|
134
|
|
- jmp 99f
|
135
|
|
-ispnp: /* Is PnP: print PnP message */
|
136
|
|
- movw $init_message_pnp, %si
|
137
|
|
- call print_message
|
|
156
|
+hook_bbs:
|
138
|
157
|
/* Check for PMM */
|
139
|
158
|
movw $( 0xe000 - 1 ), %di
|
140
|
159
|
pmm_scan:
|
141
|
160
|
incw %di
|
142
|
|
- jz 99f
|
|
161
|
+ jz no_pmm
|
143
|
162
|
movw %di, %es
|
144
|
163
|
cmpl $PMM_SIGNATURE, %es:0
|
145
|
164
|
jne pmm_scan
|
|
@@ -158,13 +177,13 @@ pmm_scan:
|
158
|
177
|
pushl $0xffffffff /* No handle */
|
159
|
178
|
pushl $( 0x00200000 / 16 ) /* 2MB in paragraphs */
|
160
|
179
|
pushw $0x0000 /* pmmAllocate */
|
161
|
|
- lcall %es:*(7)
|
|
180
|
+ lcall *%es:7
|
162
|
181
|
addw $12, %sp
|
163
|
182
|
testw %dx, %dx /* %ax==0 even on success, since align=2MB */
|
164
|
183
|
jnz gotpmm
|
165
|
184
|
movw $init_message_pmm_failed, %si
|
166
|
185
|
call print_message
|
167
|
|
- jmp 99f
|
|
186
|
+ jmp no_pmm
|
168
|
187
|
gotpmm: /* PMM allocation succeeded: copy ROM to PMM block */
|
169
|
188
|
pushal /* PMM presence implies 1kB stack */
|
170
|
189
|
movw %ax, %es /* %ax=0 already - see above */
|
|
@@ -188,10 +207,10 @@ gotpmm: /* PMM allocation succeeded: copy ROM to PMM block */
|
188
|
207
|
loop 1b
|
189
|
208
|
subb %bl, checksum
|
190
|
209
|
popal
|
191
|
|
-99:
|
|
210
|
+no_pmm:
|
192
|
211
|
/* Print CRLF to terminate messages */
|
193
|
|
- movw $init_message_crlf, %si
|
194
|
|
- call print_message
|
|
212
|
+ movw $'\n', %ax
|
|
213
|
+ call print_character
|
195
|
214
|
/* Restore registers */
|
196
|
215
|
popw %es
|
197
|
216
|
popw %ds
|
|
@@ -202,20 +221,23 @@ gotpmm: /* PMM allocation succeeded: copy ROM to PMM block */
|
202
|
221
|
.size init, . - init
|
203
|
222
|
|
204
|
223
|
init_message:
|
205
|
|
- .asciz "gPXE (http://etherboot.org)"
|
|
224
|
+ .asciz "gPXE (http://etherboot.org) -"
|
206
|
225
|
.size init_message, . - init_message
|
207
|
226
|
init_message_pnp:
|
208
|
|
- .asciz " - PnP BIOS detected"
|
|
227
|
+ .asciz " PnP"
|
209
|
228
|
.size init_message_pnp, . - init_message_pnp
|
|
229
|
+init_message_bbs:
|
|
230
|
+ .asciz " BBS"
|
|
231
|
+ .size init_message_bbs, . - init_message_bbs
|
210
|
232
|
init_message_pmm:
|
211
|
|
- .asciz ", using PMM"
|
|
233
|
+ .asciz " PMM"
|
212
|
234
|
.size init_message_pmm, . - init_message_pmm
|
213
|
235
|
init_message_pmm_failed:
|
214
|
|
- .asciz " (failed)"
|
|
236
|
+ .asciz "(failed)"
|
215
|
237
|
.size init_message_pmm_failed, . - init_message_pmm_failed
|
216
|
|
-init_message_crlf:
|
217
|
|
- .asciz "\n"
|
218
|
|
- .size init_message_crlf, . - init_message_crlf
|
|
238
|
+init_message_int19:
|
|
239
|
+ .asciz " INT19"
|
|
240
|
+ .size init_message_int19, . - init_message_int19
|
219
|
241
|
|
220
|
242
|
/* ROM image location
|
221
|
243
|
*
|
|
@@ -224,6 +246,7 @@ init_message_crlf:
|
224
|
246
|
image_source:
|
225
|
247
|
.long 0
|
226
|
248
|
.size image_source, . - image_source
|
|
249
|
+
|
227
|
250
|
/* Temporary decompression area
|
228
|
251
|
*
|
229
|
252
|
* May be either at HIGHMEM_LOADPOINT, or within PMM-allocated block.
|
|
@@ -232,6 +255,13 @@ decompress_to:
|
232
|
255
|
.long HIGHMEM_LOADPOINT
|
233
|
256
|
.size decompress_to, . - decompress_to
|
234
|
257
|
|
|
258
|
+/* BBS version
|
|
259
|
+ *
|
|
260
|
+ * Filled in by BBS BIOS. We ignore the value.
|
|
261
|
+ */
|
|
262
|
+bbs_version:
|
|
263
|
+ .word 0
|
|
264
|
+
|
235
|
265
|
/* Boot Execution Vector entry point
|
236
|
266
|
*
|
237
|
267
|
* Called by the PnP BIOS when it wants to boot us.
|