david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[util] Fix interpretation of short jumps in Option::ROM

Option::ROM was assuming that ROM images using a short jump
instruction for the init entry point would have a zero byte at offset
5; this is not necessarily true.
This commit is contained in:
Michael Brown 2008-08-27 20:36:30 +01:00
parent d5732b0272
commit bd5189a96d
1 changed files with 3 additions and 1 deletions

View File

@ -192,10 +192,12 @@ sub unpack_init {
my $instr = shift;
# Accept both short and near jumps
( my $jump, my $offset ) = unpack ( "CS", $instr );
my $jump = unpack ( "C", $instr );
if ( $jump == JMP_SHORT ) {
my $offset = unpack ( "xC", $instr );
return ( $offset + 5 );
} elsif ( $jump == JMP_NEAR ) {
my $offset = unpack ( "xS", $instr );
return ( $offset + 6 );
} elsif ( $jump == 0 ) {
return 0;