mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
fix rdar://8444631 - encoder crash on 'enter'
What a weird instruction. llvm-svn: 114190
This commit is contained in:
parent
61838d80cd
commit
4bce01542c
@ -39,7 +39,8 @@ def MRM_E8 : Format<39>;
|
|||||||
def MRM_F0 : Format<40>;
|
def MRM_F0 : Format<40>;
|
||||||
def MRM_F8 : Format<41>;
|
def MRM_F8 : Format<41>;
|
||||||
def MRM_F9 : Format<42>;
|
def MRM_F9 : Format<42>;
|
||||||
def RawFrmImm16 : Format<43>;
|
def RawFrmImm8 : Format<43>;
|
||||||
|
def RawFrmImm16 : Format<44>;
|
||||||
|
|
||||||
// ImmType - This specifies the immediate type used by an instruction. This is
|
// ImmType - This specifies the immediate type used by an instruction. This is
|
||||||
// part of the ad-hoc solution used to emit machine instruction encodings by our
|
// part of the ad-hoc solution used to emit machine instruction encodings by our
|
||||||
|
@ -311,12 +311,17 @@ namespace X86II {
|
|||||||
MRM_F0 = 40,
|
MRM_F0 = 40,
|
||||||
MRM_F8 = 41,
|
MRM_F8 = 41,
|
||||||
MRM_F9 = 42,
|
MRM_F9 = 42,
|
||||||
|
|
||||||
|
/// RawFrmImm8 - This is used for the ENTER instruction, which has two
|
||||||
|
/// immediates, the first of which is a 16-bit immediate (specified by
|
||||||
|
/// the imm encoding) and the second is a 8-bit fixed value.
|
||||||
|
RawFrmImm8 = 43,
|
||||||
|
|
||||||
/// RawFrmImm16 - This is used for CALL FAR instructions, which have two
|
/// RawFrmImm16 - This is used for CALL FAR instructions, which have two
|
||||||
/// immediates, the first of which is a 16 or 32-bit immediate (specified by
|
/// immediates, the first of which is a 16 or 32-bit immediate (specified by
|
||||||
/// the imm encoding) and the second is a 16-bit fixed value. In the AMD
|
/// the imm encoding) and the second is a 16-bit fixed value. In the AMD
|
||||||
/// manual, this operand is described as pntr16:32 and pntr16:16
|
/// manual, this operand is described as pntr16:32 and pntr16:16
|
||||||
RawFrmImm16 = 43,
|
RawFrmImm16 = 44,
|
||||||
|
|
||||||
FormMask = 63,
|
FormMask = 63,
|
||||||
|
|
||||||
@ -528,6 +533,7 @@ namespace X86II {
|
|||||||
case X86II::AddRegFrm:
|
case X86II::AddRegFrm:
|
||||||
case X86II::MRMDestReg:
|
case X86II::MRMDestReg:
|
||||||
case X86II::MRMSrcReg:
|
case X86II::MRMSrcReg:
|
||||||
|
case X86II::RawFrmImm8:
|
||||||
case X86II::RawFrmImm16:
|
case X86II::RawFrmImm16:
|
||||||
return -1;
|
return -1;
|
||||||
case X86II::MRMDestMem:
|
case X86II::MRMDestMem:
|
||||||
|
@ -757,8 +757,8 @@ let isCall = 1 in
|
|||||||
|
|
||||||
// Constructing a stack frame.
|
// Constructing a stack frame.
|
||||||
|
|
||||||
def ENTER : I<0xC8, RawFrm, (outs), (ins i16imm:$len, i8imm:$lvl),
|
def ENTER : Ii16<0xC8, RawFrmImm8, (outs), (ins i16imm:$len, i8imm:$lvl),
|
||||||
"enter\t$len, $lvl", []>;
|
"enter\t$len, $lvl", []>;
|
||||||
|
|
||||||
// Tail call stuff.
|
// Tail call stuff.
|
||||||
|
|
||||||
|
@ -828,6 +828,13 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
|
|||||||
EmitByte(BaseOpcode, CurByte, OS);
|
EmitByte(BaseOpcode, CurByte, OS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case X86II::RawFrmImm8:
|
||||||
|
EmitByte(BaseOpcode, CurByte, OS);
|
||||||
|
EmitImmediate(MI.getOperand(CurOp++),
|
||||||
|
X86II::getSizeOfImm(TSFlags), getImmFixupKind(TSFlags),
|
||||||
|
CurByte, OS, Fixups);
|
||||||
|
EmitImmediate(MI.getOperand(CurOp++), 1, FK_Data_1, CurByte, OS, Fixups);
|
||||||
|
break;
|
||||||
case X86II::RawFrmImm16:
|
case X86II::RawFrmImm16:
|
||||||
EmitByte(BaseOpcode, CurByte, OS);
|
EmitByte(BaseOpcode, CurByte, OS);
|
||||||
EmitImmediate(MI.getOperand(CurOp++),
|
EmitImmediate(MI.getOperand(CurOp++),
|
||||||
|
@ -293,3 +293,15 @@ sldt %cx
|
|||||||
lcall *0xbadeface
|
lcall *0xbadeface
|
||||||
ljmp *0xbadeface
|
ljmp *0xbadeface
|
||||||
|
|
||||||
|
|
||||||
|
// rdar://8444631
|
||||||
|
// CHECK: enter $31438, $0
|
||||||
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x00]
|
||||||
|
// CHECK: enter $31438, $1
|
||||||
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x01]
|
||||||
|
// CHECK: enter $31438, $127
|
||||||
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x7f]
|
||||||
|
enter $0x7ace,$0
|
||||||
|
enter $0x7ace,$1
|
||||||
|
enter $0x7ace,$0x7f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user