Skip to content

XBDM hack is slow #13

@JayFoxRox

Description

@JayFoxRox

Current code (eb69c7fba9cdd1bb1e81eec60f4fed4394a42c67):

def xbdm_hack(address, operation, data=0):
  SetMem(hack_bank, struct.pack("<III", address, operation, data))
  xbdm_command("resume thread=0x" + format(hack_bank, 'X'))
  return GetMem(hack_bank + 8, 4)

(Also see xbdm-hack.md for more information)

Here is what the hack does for reads and writes:

Reads

def xbdm_read_8(address):
  return xbdm_hack(address, 1)
  1. xbdm_hack will call SetMem, which is the first communication with Xbox, to setup the next step
  2. xbdm_hack will call xbdm_command which is another communiation with Xbox
  3. xbdm_hack will readback the result which is another communication with Xbox

That is 3 back-and-forth transfers for a single read.

Writes

def xbdm_write_8(address, data):
  xbdm_hack(address, 4, int.from_bytes(data, byteorder='little', signed=False))
  1. xbdm_hack will call SetMem, which is the first communication with Xbox, to setup the next step
  2. xbdm_hack will call xbdm_command which is another communiation with Xbox
  3. xbdm_hack will readback the result which is another communication with Xbox, even if it isn't returned from xbdm_write.

That is 3 back-and-forth transfers for a single read, with one of them being completly useless.
There's various ways to optimize it.

Calls

def xbdm_call(address, stack):
  assert(len(stack) < 64)
  SetMem(hack_bank + 12, stack)
  return xbdm_hack(address, 7, len(stack))
  1. xbdm_call will call SetMem, which is the first communication with Xbox
  2. xbdm_hack will call SetMem, which is the more communication with Xbox, to setup the next step
  3. xbdm_hack will call xbdm_command which is another communiation with Xbox
  4. xbdm_hack will readback the result which is another communication with Xbox

Ideally we'd pass all optional input data in the xbdm_hack request, and return all optional output data in the response.
Maybe we should also allow packing of commands, simply to avoid XBDM command processing overhead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions