mirror of
https://github.com/notwa/lips
synced 2024-05-19 00:33:23 -07:00
fix loading labels with overflowed PC
This commit is contained in:
parent
11b62bf9de
commit
575af689b5
|
@ -221,6 +221,15 @@ function Dumper:fill(length, content)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Dumper:pc()
|
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
|
return self.pos + self.base
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user