diff options
author | Michael Brown <mcb30@etherboot.org> | 2008-08-27 20:36:30 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-08-27 20:36:30 +0100 |
commit | bd5189a96d88a27f8c7da29491876ec3790af138 (patch) | |
tree | fdb2b54674984b016c6f034abc3489736d92e7a1 | |
parent | d5732b027252e87509aea29d35d2c2f020f11ec2 (diff) | |
download | ipxe-bd5189a96d88a27f8c7da29491876ec3790af138.tar.gz |
[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.
-rw-r--r-- | src/util/Option/ROM.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/Option/ROM.pm b/src/util/Option/ROM.pm index 7a1bb883..a86d3262 100644 --- a/src/util/Option/ROM.pm +++ b/src/util/Option/ROM.pm @@ -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; |