|
@@ -11,6 +11,7 @@
|
11
|
11
|
#define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
|
12
|
12
|
#define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
|
13
|
13
|
#define PNP_GET_BBS_VERSION 0x60
|
|
14
|
+#define PMM_ALLOCATE 0x0000
|
14
|
15
|
|
15
|
16
|
.text
|
16
|
17
|
.code16
|
|
@@ -83,7 +84,7 @@ pnpheader:
|
83
|
84
|
.byte 0x02 /* Device base type code */
|
84
|
85
|
.byte 0x00 /* Device sub-type code */
|
85
|
86
|
.byte 0x00 /* Device interface type code */
|
86
|
|
- .byte 0x54 /* Device indicator */
|
|
87
|
+ .byte 0xf4 /* Device indicator */
|
87
|
88
|
.word 0x0000 /* Boot connection vector */
|
88
|
89
|
.word 0x0000 /* Disconnect vector */
|
89
|
90
|
.word bev_entry /* Boot execution vector */
|
|
@@ -203,14 +204,13 @@ init:
|
203
|
204
|
|
204
|
205
|
/* Check for PnP BIOS */
|
205
|
206
|
testw $0x0f, %bx /* PnP signature must be aligned - bochs */
|
206
|
|
- jnz hook_int19 /* uses unalignment to indicate 'fake' PnP. */
|
|
207
|
+ jnz no_bbs /* uses unalignment to indicate 'fake' PnP. */
|
207
|
208
|
cmpl $PNP_SIGNATURE, %es:0(%bx)
|
208
|
|
- jne hook_int19
|
|
209
|
+ jne no_bbs
|
209
|
210
|
/* Is PnP: print PnP message */
|
210
|
211
|
movw $init_message_pnp, %si
|
211
|
212
|
xorw %di, %di
|
212
|
213
|
call print_message
|
213
|
|
-
|
214
|
214
|
/* Check for BBS */
|
215
|
215
|
pushw %es:0x1b(%bx) /* Real-mode data segment */
|
216
|
216
|
pushw %ds /* &(bbs_version) */
|
|
@@ -219,13 +219,8 @@ init:
|
219
|
219
|
lcall *%es:0xd(%bx)
|
220
|
220
|
addw $8, %sp
|
221
|
221
|
testw %ax, %ax
|
222
|
|
- jne hook_int19
|
223
|
|
- movw $init_message_bbs, %si
|
224
|
|
- xorw %di, %di
|
225
|
|
- call print_message
|
226
|
|
- jmp hook_bbs
|
227
|
|
- /* Not BBS-compliant - must hook INT 19 */
|
228
|
|
-hook_int19:
|
|
222
|
+ je got_bbs
|
|
223
|
+no_bbs: /* Not BBS-compliant - must hook INT 19 */
|
229
|
224
|
movw $init_message_int19, %si
|
230
|
225
|
xorw %di, %di
|
231
|
226
|
call print_message
|
|
@@ -236,7 +231,12 @@ hook_int19:
|
236
|
231
|
pushw %gs /* %gs contains runtime %cs */
|
237
|
232
|
pushw $int19_entry
|
238
|
233
|
popl %es:( 0x19 * 4 )
|
239
|
|
-hook_bbs:
|
|
234
|
+ jmp bbs_done
|
|
235
|
+got_bbs: /* BBS compliant - no need to hook INT 19 */
|
|
236
|
+ movw $init_message_bbs, %si
|
|
237
|
+ xorw %di, %di
|
|
238
|
+ call print_message
|
|
239
|
+bbs_done:
|
240
|
240
|
|
241
|
241
|
/* Check for PMM */
|
242
|
242
|
movw $( 0xe000 - 1 ), %bx
|
|
@@ -261,22 +261,20 @@ pmm_scan:
|
261
|
261
|
pushw $0x0006 /* Aligned, extended memory */
|
262
|
262
|
pushl $0xffffffff /* No handle */
|
263
|
263
|
pushl $( 0x00200000 / 16 ) /* 2MB in paragraphs */
|
264
|
|
- pushw $0x0000 /* pmmAllocate */
|
|
264
|
+ pushw $PMM_ALLOCATE
|
265
|
265
|
lcall *%es:7
|
266
|
266
|
addw $12, %sp
|
267
|
|
- testw %dx, %dx /* %ax==0 even on success, since align=2MB */
|
268
|
|
- jnz gotpmm
|
269
|
|
- movb $'-', %al
|
|
267
|
+ movw %dx, %ax
|
270
|
268
|
xorw %di, %di
|
271
|
|
- call print_character
|
272
|
|
- jmp no_pmm
|
273
|
|
-gotpmm: /* PMM allocation succeeded: copy ROM to PMM block */
|
|
269
|
+ call print_hex_word
|
|
270
|
+ movw %dx, ( image_source + 2 )
|
|
271
|
+ testw %dx, %dx /* %ax==0 even on success, since align=2MB */
|
|
272
|
+ jz no_pmm
|
|
273
|
+ /* PMM allocation succeeded: copy ROM to PMM block */
|
274
|
274
|
pushal /* PMM presence implies 1kB stack */
|
275
|
|
- movw %ax, %es /* %ax=0 already - see above */
|
276
|
|
- pushw %dx
|
277
|
|
- pushw %ax
|
278
|
|
- popl %edi
|
279
|
|
- movl %edi, image_source
|
|
275
|
+ xorw %ax, %ax
|
|
276
|
+ movw %ax, %es
|
|
277
|
+ movl image_source, %edi
|
280
|
278
|
xorl %esi, %esi
|
281
|
279
|
movzbl romheader_size, %ecx
|
282
|
280
|
shll $9, %ecx
|
|
@@ -373,7 +371,7 @@ no_key_pressed:
|
373
|
371
|
.size init, . - init
|
374
|
372
|
|
375
|
373
|
init_message:
|
376
|
|
- .asciz "gPXE (http://etherboot.org) - PCI "
|
|
374
|
+ .asciz "gPXE (http://etherboot.org) - "
|
377
|
375
|
.size init_message, . - init_message
|
378
|
376
|
init_message_pci:
|
379
|
377
|
.asciz " PCI"
|
|
@@ -419,6 +417,7 @@ decompress_to:
|
419
|
417
|
*/
|
420
|
418
|
bbs_version:
|
421
|
419
|
.word 0
|
|
420
|
+ .size bbs_version, . - bbs_version
|
422
|
421
|
|
423
|
422
|
/* Boot Execution Vector entry point
|
424
|
423
|
*
|
|
@@ -459,9 +458,11 @@ exec: /* Set %ds = %cs */
|
459
|
458
|
popw %ds
|
460
|
459
|
|
461
|
460
|
/* Print message as soon as possible */
|
462
|
|
- movw $exec_message, %si
|
|
461
|
+ movw $prodstr, %si
|
463
|
462
|
xorw %di, %di
|
464
|
463
|
call print_message
|
|
464
|
+ movw $exec_message, %si
|
|
465
|
+ call print_message
|
465
|
466
|
|
466
|
467
|
/* Store magic word on BIOS stack and remember BIOS %ss:sp */
|
467
|
468
|
pushl $STACK_MAGIC
|
|
@@ -509,7 +510,7 @@ exec: /* Set %ds = %cs */
|
509
|
510
|
.previous
|
510
|
511
|
|
511
|
512
|
exec_message:
|
512
|
|
- .asciz "Entering gPXE\n"
|
|
513
|
+ .asciz " starting execution\n"
|
513
|
514
|
.size exec_message, . - exec_message
|
514
|
515
|
|
515
|
516
|
/* UNDI loader
|