From 7d7e72746e0ebe238f48041eab897bba54daa553 Mon Sep 17 00:00:00 2001 From: Alexis Engelke Date: Sun, 8 Nov 2020 11:11:18 +0100 Subject: [PATCH] parseinstr: Split escape and opcode --- parseinstrs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parseinstrs.py b/parseinstrs.py index 7ac0847..3239407 100644 --- a/parseinstrs.py +++ b/parseinstrs.py @@ -245,7 +245,8 @@ import re opcode_regex = re.compile( r"^(?:(?P(?PVEX\.)?(?PNP|66|F2|F3|NFx)\." + r"(?:W(?P[01]|IG)\.)?(?:L(?P[01]|IG)\.)?))?" + - r"(?P(?:[0-9a-f]{2})+)" + + r"(?P(?:0f|0f38|0f3a)?)" + + r"(?P[0-9a-f]{2})" + r"(?P//?[0-7]|//[c-f][0-9a-f])?" + r"(?P\+)?$") @@ -275,8 +276,8 @@ class Opcode(NamedTuple): return cls( prefix=match.group("legacy"), - escape=["", "0f", "0f38", "0f3a"].index(match.group("opcode")[:-2]), - opc=int(match.group("opcode")[-2:], 16), + escape=["", "0f", "0f38", "0f3a"].index(match.group("escape")), + opc=int(match.group("opcode"), 16), opcext=opcext, extended=match.group("extended") is not None, vex=match.group("vex") is not None,