Ejemplo n.º 1
0
        return state


class SimBFSyscall(SimCC):
    """
    This defines our syscall format.
    Obviously this is pretty dumb, for BrainFuck
    This is really just here to make the two simprocedures work.
    """

    # No need to pull the regs out, we always just want ptr straight up.
    # THis is usually a list of string register names.
    ARG_REGS = [ 'ptr' ]
    # We never return anything to registers, but if we did, we'd use a RegArg object here.
    #RETURN_VAL = ""
    ARCH = ArchBF

    @staticmethod
    def _match(arch, args, sp_delta):   # pylint: disable=unused-argument
        # doesn't appear anywhere but syscalls
        return False

    @staticmethod
    def syscall_num(state):
        return state.regs.inout


register_simos('bf', SimBF)
register_syscall_cc('BF','default',SimBFSyscall)
register_default_cc('BF',SimCCUnknown)
Ejemplo n.º 2
0
class SimBPF(SimUserland):
    # Syscalls are for lamers
    SYSCALL_TABLE = {}

    def __init__(self, *args, **kwargs):
        super(SimBPF, self).__init__(*args, name="BPF", **kwargs)

    def state_blank(self, data_region_size=0x8000, **kwargs):  # pylint:disable=arguments-differ
        state = super(SimBPF, self).state_blank(**kwargs)  # pylint:disable=invalid-name
        return state


class SimBPFSyscall(SimCC):
    ARG_REGS = []
    # RETURN_VAL = ""
    ARCH = ArchBPF

    @staticmethod
    def _match(arch, args, sp_delta):  # pylint: disable=unused-argument
        # doesn't appear anywhere but syscalls
        return False

    @staticmethod
    def syscall_num(state):
        return state.regs.inout


register_simos('BPF', SimBPF)
register_syscall_cc('BPF', 'default', SimBPFSyscall)
register_default_cc('BPF', SimCCBPF)
Ejemplo n.º 3
0
    def state_blank(self, data_region_size=0x8000, **kwargs):
        # pylint:disable=arguments-differ
        state = super(SimRISCV, self).state_blank(**kwargs)  # pylint:disable=invalid-name
        # PTR starts halfway through memory
        return state

    def state_entry(self, **kwargs):
        state = super(SimRISCV, self).state_entry(**kwargs)
        return state


class SimRISCVSyscall(SimCC):
    ARG_REGS = []
    #RETURN_VAL = ""
    ARCH = ArchRISCV

    @staticmethod
    def _match(arch, args, sp_delta):  # pylint: disable=unused-argument
        # doesn't appear anywhere but syscalls
        return False

    @staticmethod
    def syscall_num(state):
        return state.regs.inout


register_simos('UNIX - System V', SimRISCV)
register_syscall_cc('RISCV', 'default', SimRISCVSyscall)
register_default_cc('RISCV', SimCCRISCV)
Ejemplo n.º 4
0
    def state_blank(self, data_region_size=0x8000, **kwargs):
        # pylint:disable=arguments-differ
        state = super(SimMSP430, self).state_blank(**kwargs)  # pylint:disable=invalid-name
        # PTR starts halfway through memory
        return state

    def state_entry(self, **kwargs):
        state = super(SimMSP430, self).state_entry(**kwargs)
        return state


class SimMSP430Syscall(SimCC):
    ARG_REGS = []
    #RETURN_VAL = ""
    ARCH = ArchMSP430

    @staticmethod
    def _match(arch, args, sp_delta):  # pylint: disable=unused-argument
        # doesn't appear anywhere but syscalls
        return False

    @staticmethod
    def syscall_num(state):
        return state.regs.inout


register_simos('Standalone App', SimMSP430)
register_syscall_cc('MSP430', 'default', SimMSP430Syscall)
register_default_cc('MSP430', SimCCMSP430)
Ejemplo n.º 5
0
        print(state)
        print(state.mem)
        # PTR starts halfway through memory
        return state

    def state_entry(self, **kwargs):
        state = super(SimGameboy, self).state_entry(**kwargs)
        print(state)
        print(state.mem)
        return state


class SimGameboySyscall(SimCC):
    ARG_REGS = []
    #RETURN_VAL = ""
    ARCH = ArchGameboy

    @staticmethod
    def _match(arch, args, sp_delta):  # pylint: disable=unused-argument
        # doesn't appear anywhere but syscalls
        return False

    @staticmethod
    def syscall_num(state):
        return state.regs.inout


register_simos('Standalone App', SimGameboy)
#register_syscall_cc('Gameboy', 'default', SimGameboySyscall)
register_default_cc('Gameboy', SimCCGameboy)