def ret_uses(): # a0 contains return address, and sp should be preserved across # call, so depend on it also. return {REG("a0"), REG("sp")}
def reg_range(first, last): return {REG("a%d" % x) for x in range(first, last + 1)}
def reg_range(prefix, first, last): return {REG("%s%d" % (prefix, x)) for x in range(first, last + 1)}
def call_save(addr): return reg_range(12, 15) | {REG("sp")}
import os.path from core import ADDR, REG import yaml import progdb BITNESS = 32 ENDIANNESS = "LITTLE" def reg_range(first, last): return {REG("a%d" % x) for x in range(first, last + 1)} ALL_REGS = {REG("a0"), REG("sp")} | reg_range(2, 15) def call_params(addr): if isinstance(addr, ADDR): addr = addr.addr if addr in progdb.FUNC_DB and "params" in progdb.FUNC_DB[addr]: return progdb.FUNC_DB[addr]["params"] return reg_range(2, 7) def call_ret(addr): return reg_range(2, 5) def call_save(addr):
def call_save(addr): return reg_range("r", 13, 31) | {REG("sp")}
def ret_filter(regs): # Assuming there is no floating-point stuff return {REG("r3")}
def call_ret(addr): return {REG("r3")}
from core import ADDR, REG from archutils import * BITNESS = 32 ENDIANNESS = "big" ALL_REGS = {REG("r0"), REG("sp"), REG("rtoc")} | reg_range("r", 3, 31) def call_params(addr): return reg_range("r", 3, 10) def param_filter(regs): # Assume for now that all parameters will be passed in registers. # This must be good enough to cover the most usage cases. # The following cases will break it: # - functions accepting more then 8 params # - functions accepting floating-point params # - variadic functions return reg_continuous_subrange(regs, reg_range("r", 3, 10)) def call_ret(addr): return {REG("r3")} def ret_filter(regs): # Assuming there is no floating-point stuff return {REG("r3")}