Browse Source

[pxe] Fill in UNDIROMID pointer in !PXE structure

IBM's iSCSI Firmware Initiator checks the UNDIROMID pointer in the
!PXE structure that gets created by the UNDI loader.  We didn't
previously fill this value in.
tags/v0.9.4
Michael Brown 15 years ago
parent
commit
fc0c40a5b0

+ 3
- 0
src/arch/i386/interface/pxe/pxe_call.c View File

@@ -347,6 +347,9 @@ __cdecl void pxe_loader_call ( struct i386_all_regs *ix86 ) {
347 347
 	/* Copy parameter block from caller */
348 348
 	copy_from_user ( &params, uparams, 0, sizeof ( params ) );
349 349
 
350
+	/* Fill in ROM segment address */
351
+	ppxe.UNDIROMID.segment = ix86->segs.ds;
352
+
350 353
 	/* Set default status in case child routine fails to do so */
351 354
 	params.Status = PXENV_STATUS_FAILURE;
352 355
 

+ 6
- 1
src/arch/i386/interface/pxe/pxe_entry.S View File

@@ -35,7 +35,7 @@ ppxe:
35 35
 	.byte 0				/* StructCksum */
36 36
 	.byte 0				/* StructRev */
37 37
 	.byte 0				/* reserved_1 */
38
-	.word 0, 0			/* UNDIROMID */
38
+	.word undiheader, 0		/* UNDIROMID */
39 39
 	.word 0, 0			/* BaseROMID */
40 40
 	.word pxe_entry_sp, 0		/* EntryPointSP */
41 41
 	.word pxe_entry_esp, 0		/* EntryPointESP */
@@ -55,6 +55,11 @@ pxe_segments:
55 55
 	.equ	pxe_length, . - ppxe
56 56
 	.size	ppxe, . - ppxe
57 57
 
58
+	/* Define undiheader=0 as a weak symbol for non-ROM builds */
59
+	.section ".weak"
60
+	.weak	undiheader
61
+undiheader:
62
+
58 63
 /****************************************************************************
59 64
  * PXENV+ structure
60 65
  ****************************************************************************

+ 11
- 5
src/arch/i386/prefix/romprefix.S View File

@@ -112,7 +112,8 @@ prodstr_separator:
112 112
 prodstr_pci_id:
113 113
 	.asciz	"xx:xx.x)"		/* Filled in by init code */
114 114
 	.size prodstr, . - prodstr
115
-	
115
+
116
+	.globl	undiheader	
116 117
 undiheader:
117 118
 	.ascii	"UNDI"			/* Signature */
118 119
 	.byte	undiheader_len		/* Length of structure */
@@ -524,18 +525,22 @@ undiloader:
524 525
 	/* Save registers */
525 526
 	pushl	%esi
526 527
 	pushl	%edi
528
+	pushw	%ds
527 529
 	pushw	%es
528 530
 	pushw	%bx
531
+	/* ROM segment address to %ds */
532
+	pushw	%cs
533
+	popw	%ds
529 534
 	/* UNDI loader parameter structure address into %es:%di */
530 535
 	movw	%sp, %bx
531
-	movw	%ss:16(%bx), %di
532
-	movw	%ss:18(%bx), %es
536
+	movw	%ss:18(%bx), %di
537
+	movw	%ss:20(%bx), %es
533 538
 	/* Install to specified real-mode addresses */
534 539
 	pushw	%di
535 540
 	movw	%es:12(%di), %bx
536 541
 	movw	%es:14(%di), %ax
537
-	movl	%cs:image_source, %esi
538
-	movl	%cs:decompress_to, %edi
542
+	movl	image_source, %esi
543
+	movl	decompress_to, %edi
539 544
 	call	install_prealloc
540 545
 	popw	%di
541 546
 	/* Call UNDI loader C code */
@@ -550,6 +555,7 @@ undiloader:
550 555
 	/* Restore registers and return */
551 556
 	popw	%bx
552 557
 	popw	%es
558
+	popw	%ds
553 559
 	popl	%edi
554 560
 	popl	%esi
555 561
 	lret

+ 10
- 0
src/arch/i386/scripts/i386.lds View File

@@ -30,6 +30,16 @@ SECTIONS {
30 30
      *
31 31
      */
32 32
 
33
+    /*
34
+     * Weak symbols that need zero values if not otherwise defined
35
+     */
36
+
37
+    . = 0;
38
+    .weak : AT ( 0 ) {
39
+	*(.weak)
40
+    }
41
+    _assert = ASSERT ( ( . == 0 ), ".weak is non-zero length" );
42
+
33 43
     /*
34 44
      * The prefix
35 45
      */

Loading…
Cancel
Save