mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-20 14:33:15 +00:00
[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:
parent
d5732b0272
commit
bd5189a96d
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user