Further restrict Intel register classes to prevent incorrect encoding of R12 derefs.

This commit is contained in:
Tyler McMullen
2018-01-29 13:15:39 -08:00
committed by Jakob Stoklund Olesen
parent 584a33bca7
commit 21f0fc39ad
2 changed files with 22 additions and 17 deletions

View File

@@ -46,10 +46,13 @@ FlagRegs = RegBank(
names=['eflags'])
GPR = RegClass(IntRegs)
# Certain types of deref encodings cannot be used with all registers.
# R13/RBP cannot be used with zero-offset load or store instructions.
# R12 cannot be used with a non-SIB-byte encoding of all derefs.
GPR_DEREF_SAFE = GPR.without(GPR.r12)
GPR_ZERO_DEREF_SAFE = GPR_DEREF_SAFE.without(GPR.rbp, GPR.r13)
GPR8 = GPR[0:8]
# In certain instructions, RBP and R13 are interpreted as RIP-relative.
GPR_NORIP = GPR.without(GPR.rbp, GPR.r13)
GPR8_NORIP = GPR8.without(GPR.rbp)
GPR8_ZERO_DEREF_SAFE = GPR8.without(GPR.rbp)
ABCD = GPR[0:4]
FPR = RegClass(FloatRegs)
FPR8 = FPR[0:8]