mirror of
https://github.com/notwa/lips
synced 2024-11-14 09:19:02 -08:00
fix loading labels with overflowed PC
This commit is contained in:
parent
11b62bf9de
commit
575af689b5
1 changed files with 9 additions and 0 deletions
|
@ -221,6 +221,15 @@ function Dumper:fill(length, content)
|
|||
end
|
||||
|
||||
function Dumper:pc()
|
||||
--[[ work around a potential overflow issue. consider the assembly:
|
||||
.base 0x80000000 ; possibly by default and not explicitly written
|
||||
.org 0x80001000
|
||||
mylabel:
|
||||
la a0, mylabel ; BUG: this would load 0x1000 instead of 0x80001000
|
||||
--]]
|
||||
if self.pos >= 0x80000000 and self.base >= 0x80000000 then
|
||||
return self.pos - 0x80000000 + self.base
|
||||
end
|
||||
return self.pos + self.base
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue