Skip to content

Commit

Permalink
Fix HI16 relocation shift
Browse files Browse the repository at this point in the history
  • Loading branch information
kotcrab committed May 19, 2024
1 parent 7939d59 commit 05cb8f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### Version 19
- Fixed HI16 relocation calculation when relocating to a very high address

#### Version 18
- Updated to Ghidra 11.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object AllegrexRelocationApplicator {
newAddr += relocation.linkedLoValue
newAddr += relocateToSect
val newLo = (newAddr and 0xFFFF).toShort()
val newHi = (newAddr - newLo) shr 16
val newHi = (newAddr - newLo) ushr 16
newInstr = (initialValue and 0xFFFF0000.toInt()) or newHi
}
AllegrexElfRelocationConstants.R_MIPS_LO16 -> {
Expand Down

0 comments on commit 05cb8f6

Please sign in to comment.