Skip to content

Commit

Permalink
SETcc branch prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
JensDll committed May 5, 2024
1 parent da6505e commit d5f7da3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unix/.config/lldbdash/modules/assembly_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def __init__(
self.offset: int = self.addr - symbol.GetStartAddress().GetLoadAddress(target)

@classmethod
def list(cls, symbol: lldb.SBSymbol, target: lldb.SBTarget):
def list(cls, symbol: lldb.SBSymbol, target: lldb.SBTarget) -> list["Instruction"]:
instructions = symbol.GetInstructions(
target, AssemblyModule.settings["disassembly-flavor"].value
)
return list(map(lambda inst: cls(target, symbol, inst), instructions))
return [cls(target, symbol, inst) for inst in instructions]

def print(
self,
Expand All @@ -72,7 +72,7 @@ def print(
].value

does_branch = BRANCH_MAP.get(self.mnemonic)
does_branch_result = does_branch(flags, reader) if does_branch else False
does_branch_result = does_branch and does_branch(flags, reader)

# Address
out.write(f"{color}{self.addr:#0x}{RESET_COLOR} ")
Expand Down
30 changes: 30 additions & 0 deletions unix/.config/lldbdash/modules/branch_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,34 @@
"cmovpo": parity_odd,
"cmovs": sign,
"cmovz": zero,
"seta": above,
"setae": above_equal,
"setb": below,
"setbe": below_equal,
"setc": carry,
"sete": equal,
"setg": greater,
"setge": greater_equal,
"setl": less,
"setle": less_equal,
"setna": not_above,
"setnae": not_above_equal,
"setnb": not_below,
"setnbe": not_below_equal,
"setnc": not_carry,
"setne": not_equal,
"setng": not_greater,
"setnge": not_greater_equal,
"setnl": not_less,
"setnle": not_less_equal,
"setno": not_overflow,
"setnp": not_parity,
"setns": not_sign,
"setnz": not_zero,
"seto": overflow,
"setp": parity,
"setpe": parity_even,
"setpo": parity_odd,
"sets": sign,
"setz": zero,
}

0 comments on commit d5f7da3

Please sign in to comment.