summaryrefslogtreecommitdiffstats
path: root/src/util/Option
diff options
context:
space:
mode:
authorMichael Brown2008-08-27 21:36:30 +0200
committerMichael Brown2008-08-27 21:36:30 +0200
commitbd5189a96d88a27f8c7da29491876ec3790af138 (patch)
treefdb2b54674984b016c6f034abc3489736d92e7a1 /src/util/Option
parent[romprefix] Preserve %edi when issuing INT 1A,B101 (diff)
downloadipxe-bd5189a96d88a27f8c7da29491876ec3790af138.tar.gz
ipxe-bd5189a96d88a27f8c7da29491876ec3790af138.tar.xz
ipxe-bd5189a96d88a27f8c7da29491876ec3790af138.zip
[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.
Diffstat (limited to 'src/util/Option')
-rw-r--r--src/util/Option/ROM.pm4
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;