1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-06-18 01:13:06 -07:00

fix asm length calculation

This commit is contained in:
Connor Olding 2015-12-17 07:37:06 -08:00
parent 8a666f7dfc
commit 9cd9381463

View File

@ -49,14 +49,15 @@ start:
]] ]]
local inject = {} local inject = {}
local length = 0
local add_inject = function(line) local add_inject = function(line)
--print(line) length = length + #line/2
table.insert(inject, tonumber(line, 16)) table.insert(inject, tonumber(line, 16))
end end
local true_offset = 0x80000000 + inject_addr local true_offset = 0x80000000 + inject_addr
assemble(header, add_inject, {unsafe=true, offset=true_offset}) 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 + length})
assemble(asm_path, add_inject, {unsafe=true, offset=true_offset + #inject*4}) printf("length: %i words", length/4)
if #inject > inject_maxlen then if #inject > inject_maxlen then
print("Assembly too large!") print("Assembly too large!")