mirror of
https://github.com/notwa/mm
synced 2024-11-05 01:19:02 -08:00
fix asm length calculation
This commit is contained in:
parent
8a666f7dfc
commit
9cd9381463
1 changed files with 4 additions and 3 deletions
|
@ -49,14 +49,15 @@ start:
|
|||
]]
|
||||
|
||||
local inject = {}
|
||||
local length = 0
|
||||
local add_inject = function(line)
|
||||
--print(line)
|
||||
length = length + #line/2
|
||||
table.insert(inject, tonumber(line, 16))
|
||||
end
|
||||
local true_offset = 0x80000000 + inject_addr
|
||||
assemble(header, add_inject, {unsafe=true, offset=true_offset})
|
||||
-- warning: assumes each line is 4 bytes long
|
||||
assemble(asm_path, add_inject, {unsafe=true, offset=true_offset + #inject*4})
|
||||
assemble(asm_path, add_inject, {unsafe=true, offset=true_offset + length})
|
||||
printf("length: %i words", length/4)
|
||||
|
||||
if #inject > inject_maxlen then
|
||||
print("Assembly too large!")
|
||||
|
|
Loading…
Reference in a new issue