Skip to content

Commit

Permalink
asm_parser: [ft] add extra check for the size of macro placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiOleksenko committed Aug 1, 2024
1 parent 03837f1 commit b99699a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/x86/x86_asm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ def is_instruction(line: str) -> bool:
with open(patched_asm_file + ".tmp", "w") as patched:
for line in f:
line = line.lower()
if line.startswith(".macro") and "nop" not in line:
patched.write(line[:-1] + macro_placeholder + "\n")
if line.startswith(".macro"):
if "nop" not in line:
patched.write(line[:-1] + macro_placeholder + "\n")
else:
assert macro_placeholder in line, "Unexpected NOP placeholder: " + line
patched.write(line)
else:
patched.write(line)
os.rename(patched_asm_file + ".tmp", patched_asm_file)
Expand Down

0 comments on commit b99699a

Please sign in to comment.