qcom fix disasm (#6703)

This commit is contained in:
nimlgen 2024-09-24 15:23:43 +08:00 committed by GitHub
parent a473bf4ba9
commit ca66b11e07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import ctypes
import os
import pathlib
import struct
from hexdump import hexdump
fxn = None
@ -14,7 +15,8 @@ def disasm_raw(buf):
fxn(buf, len(buf))
def disasm(buf):
END = b"\x00\x00\x00\x00\x00\x00\x00\x03"
buf = buf[0x510:] # this right?
buf = buf.split(END)[0] + END
disasm_raw(buf)
def _read_lib(off): return struct.unpack("I", buf[off:off+4])[0]
image_offset = _read_lib(0xc0)
image_size = _read_lib(0x100)
disasm_raw(buf[image_offset:image_offset+image_size])