mirror of
https://github.com/mattrberry/crab.git
synced 2025-02-10 20:48:28 +01:00
arm fix negative branch offset
This commit is contained in:
parent
cf156829e5
commit
71235e4b2a
1 changed files with 1 additions and 2 deletions
|
@ -2,8 +2,7 @@ module ARM
|
||||||
def arm_branch(instr : Word) : Nil
|
def arm_branch(instr : Word) : Nil
|
||||||
link = bit?(instr, 24)
|
link = bit?(instr, 24)
|
||||||
offset = instr & 0xFFFFFF
|
offset = instr & 0xFFFFFF
|
||||||
offset = (~offset &+ 1).to_i32 if bit?(offset, 23) # negative
|
offset = (offset << 8).to_i32! >> 6
|
||||||
offset <<= 2
|
|
||||||
@r[14] = @r[15] - 4 if link
|
@r[14] = @r[15] - 4 if link
|
||||||
@r[15] &+= offset
|
@r[15] &+= offset
|
||||||
clear_pipeline
|
clear_pipeline
|
||||||
|
|
Loading…
Add table
Reference in a new issue