diff options
| author | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-12-31 18:29:31 +0100 |
|---|---|---|
| committer | Theofilos Augoustis <theofilos.augoustis@gmail.com> | 2023-12-31 18:29:31 +0100 |
| commit | eae0b3b08bd078ad2f621ce2ef201e656da3f16a (patch) | |
| tree | eb93252f39543c46146297264ff548d9925178e0 /arch/x86.py | |
| parent | d26ae0a7d583da5034cd6271f953b6253119ceae (diff) | |
| download | focaccia-eae0b3b08bd078ad2f621ce2ef201e656da3f16a.tar.gz focaccia-eae0b3b08bd078ad2f621ce2ef201e656da3f16a.zip | |
Refactor project structure
Read concrete state on demand during concolic exec During concolic tracing, don't record full program snapshots at each basic block, but instead read concrete values directly from the concrete target when they are needed.
Diffstat (limited to 'arch/x86.py')
| -rw-r--r-- | arch/x86.py | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/arch/x86.py b/arch/x86.py deleted file mode 100644 index 95e1a82..0000000 --- a/arch/x86.py +++ /dev/null @@ -1,102 +0,0 @@ -"""Architecture-specific configuration.""" - -from .arch import Arch - -archname = 'x86_64' - -# Names of registers in the architecture -regnames = [ - 'RIP', - 'RAX', - 'RBX', - 'RCX', - 'RDX', - 'RSI', - 'RDI', - 'RBP', - 'RSP', - 'R8', - 'R9', - 'R10', - 'R11', - 'R12', - 'R13', - 'R14', - 'R15', - 'RFLAGS', - - # x87 float registers - 'ST0', 'ST1', 'ST2', 'ST3', 'ST4', 'ST5', 'ST6', 'ST7', - - # Vector registers - 'YMM0', 'YMM1', 'YMM2', 'YMM3', 'YMM4', - 'YMM5', 'YMM6', 'YMM7', 'YMM8', 'YMM9', - 'YMM10', 'YMM11', 'YMM12', 'YMM13', 'YMM14', 'YMM15', - - # Segment registers - 'CS', 'DS', 'SS', 'ES', 'FS', 'GS', - 'FS_BASE', 'GS_BASE', - - # FLAGS - 'CF', 'PF', 'AF', 'ZF', 'SF', 'TF', 'IF', 'DF', 'OF', 'IOPL', 'NT', - - # EFLAGS - 'RF', 'VM', 'AC', 'VIF', 'VIP', 'ID', -] - -# A dictionary mapping aliases to standard register names. -regname_aliases = { - 'PC': 'RIP', - 'NF': 'SF', # negative flag == sign flag in Miasm? -} - -def decompose_rflags(rflags: int) -> dict[str, int]: - """Decompose the RFLAGS register's value into its separate flags. - - Uses flag name abbreviation conventions from - `https://en.wikipedia.org/wiki/FLAGS_register`. - - :param rflags: The RFLAGS register value. - :return: A dictionary mapping Miasm's flag names to their values. - """ - return { - # FLAGS - 'CF': rflags & 0x0001, - # 0x0002 reserved - 'PF': rflags & 0x0004, - # 0x0008 reserved - 'AF': rflags & 0x0010, - # 0x0020 reserved - 'ZF': rflags & 0x0040, - 'SF': rflags & 0x0080, - 'TF': rflags & 0x0100, - 'IF': rflags & 0x0200, - 'DF': rflags & 0x0400, - 'OF': rflags & 0x0800, - 'IOPL': rflags & 0x3000, - 'NT': rflags & 0x4000, - - # EFLAGS - 'RF': rflags & 0x00010000, - 'VM': rflags & 0x00020000, - 'AC': rflags & 0x00040000, - 'VIF': rflags & 0x00080000, - 'VIP': rflags & 0x00100000, - 'ID': rflags & 0x00200000, - } - -class ArchX86(Arch): - def __init__(self): - super().__init__(archname, regnames) - - def to_regname(self, name: str) -> str | None: - """The X86 override of the standard register name lookup. - - Applies certain register name aliases. - """ - reg = super().to_regname(name) - if reg is not None: - return reg - - # Apply custom register alias rules - return regname_aliases.get(name.upper(), None) |