s922x works
This commit is contained in:
@@ -12,7 +12,7 @@ from amlogic_rom_db import *
|
||||
ENTRY_POINT = 0xffff0000
|
||||
STACK_ADDRESS = 0xfffe3800
|
||||
|
||||
FASTBOOT_CMD_HANDLER = 0xffff9758
|
||||
# FASTBOOT_CMD_HANDLER = 0xffff9758
|
||||
TEST_OFFSET = 0xfffa0000 + 0x8000
|
||||
TEST_REQ_BUFFER = TEST_OFFSET + 0x800
|
||||
TEST_CONTEXT_BUFFER = TEST_OFFSET + 0x9000
|
||||
@@ -26,15 +26,16 @@ class Amlogic_Emulator(ARM64UC_Emulator):
|
||||
Amlogic bootrom emulator.
|
||||
'''
|
||||
super().__init__(True)
|
||||
self.device_offsets = amlogic_rom_db[device]
|
||||
self.file = self.device_offsets['path']
|
||||
|
||||
self.logger = setup_logger("GSCEmulator")
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
self.debug = debug
|
||||
|
||||
self.bootrom = open(file, 'rb').read()
|
||||
self.bootrom = open(self.file, 'rb').read()
|
||||
self.uc = Uc(UC_ARCH_ARM64, UC_MODE_LITTLE_ENDIAN)
|
||||
self.sc = ShellcodeCrafterARM64(None, None)
|
||||
self.device_offsets = amlogic_rom_db[device]
|
||||
self.setup_memory()
|
||||
self.setup_registers()
|
||||
self.setup_hooks()
|
||||
@@ -57,7 +58,7 @@ class Amlogic_Emulator(ARM64UC_Emulator):
|
||||
return bytes(self.uc.mem_read(address, size))
|
||||
|
||||
def apply_patches(self):
|
||||
self.write(self.device_offsets['fastboot_response'], self.sc.ret_ins)
|
||||
self.write(self.device_offsets['fastboot_tx_write'], self.sc.ret_ins)
|
||||
self.write(self.device_offsets['usb_ep_queue'], self.sc.ret_ins)
|
||||
|
||||
def setup_memory(self):
|
||||
@@ -242,6 +243,7 @@ class Amlogic_Emulator(ARM64UC_Emulator):
|
||||
'''
|
||||
if self.enable_trace:
|
||||
self.pc_trace.append(hex(self.pc))
|
||||
return
|
||||
# Reset expects value in DRAM
|
||||
if self.pc == 0xffff00b0:
|
||||
self.write_ptr(0xff800228, uc.reg_read(UC_ARM64_REG_X1))
|
||||
@@ -330,9 +332,9 @@ class Amlogic_Emulator(ARM64UC_Emulator):
|
||||
hexdump(em.read(em.X0, em.X1))
|
||||
# em.uc.emu_stop()
|
||||
return True
|
||||
self.uc.hook_add(UC_HOOK_CODE, _hook_fastboot_tx_write, self, self.device_offsets['fastboot_response'], self.device_offsets['fastboot_response'] + 1)
|
||||
self.uc.hook_add(UC_HOOK_CODE, _hook_fastboot_tx_write, self, self.device_offsets['fastboot_tx_write'], self.device_offsets['fastboot_tx_write'] + 1)
|
||||
|
||||
self.pc = FASTBOOT_CMD_HANDLER
|
||||
self.pc = self.device_offsets['FASTBOOT_CMD_HANDLER']
|
||||
self.sp = STACK_ADDRESS
|
||||
|
||||
# Run
|
||||
|
||||
Reference in New Issue
Block a user