Browse Source

[bzimage] Update setup_move_size only for protocol versions 2.00 and 2.01

The setup_move_size field is not defined in protocol versions earlier
than 2.00 (and is obsolete in versions later than 2.01).  In binaries
using versions earlier than 2.00, the relevant location is likely to
contain executable code.

Interestingly, this bug has been present since support for pre-2.00
protocol versions was added in 2009, and has been unexpectedly
modifying the memtest86+ code fragment:

	mov	$0x92, %dx
	inb	%dx, %al

Fortuitously, the modification exactly overwrote the value loaded into
%dx, and so the net effect was limited to causing Fast Gate A20
detection to always fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
2c72ce04ae
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/arch/i386/image/bzimage.c

+ 2
- 1
src/arch/i386/image/bzimage.c View File

@@ -214,7 +214,8 @@ static void bzimage_update_header ( struct image *image,
214 214
 	} else {
215 215
 		bzimg->cmdline_magic.magic = BZI_CMDLINE_MAGIC;
216 216
 		bzimg->cmdline_magic.offset = bzimg->rm_cmdline;
217
-		bzimg->bzhdr.setup_move_size = bzimg->rm_memsz;
217
+		if ( bzimg->version >= 0x0200 )
218
+			bzimg->bzhdr.setup_move_size = bzimg->rm_memsz;
218 219
 	}
219 220
 
220 221
 	/* Set video mode */

Loading…
Cancel
Save