Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/backend/iasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

// This is for when the reg field of modregrm specifies which instruction it is
#define NUM_MASK 0x7
#define NUM_MASKR 0x8 // REX extension bit
#define _0 (0x0 | _modrm) // insure that some _modrm bit is set
#define _1 0x1 // with _0
#define _2 0x2
Expand Down Expand Up @@ -67,6 +68,7 @@
#define _modall 0xb000 // Instruction modifies all register values
#define _modsiax 0xc000 // Instruction modifies AX and SI
#define _modsinot1 0xd000 // Instruction modifies SI and not first param
#define _modcxr11 0xe000 // Instruction modifies CX and R11

/////////////////////////////////////////////////
// Operand flags - usOp1, usOp2, usOp3
Expand Down
12 changes: 12 additions & 0 deletions src/backend/ptrntab.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,10 @@ PTRNTAB2 aptb2LDS[] = /* LDS */ {
PTRNTAB2 aptb2LEA[] = /* LEA */ {
{ 0x8d, _r|_16_bit, _r16, _m8 | _m16 | _m32 | _m48 },
{ 0x8d, _r|_32_bit, _r32, _m8 | _m16 | _m32 | _m48 },
{ 0x8d, _r|_64_bit, _r64, _m8 | _m16 | _m32 | _m48 | _m64 },
{ 0x8d, _r|_16_bit, _r16, _rel16 },
{ 0x8d, _r|_32_bit, _r32, _rel32 },
{ 0x8d, _r|_64_bit, _r64, _rel32 },
{ ASM_END, 0, 0, 0 }
};
PTRNTAB2 aptb2LES[] = /* LES */ {
Expand Down Expand Up @@ -1471,6 +1473,14 @@ PTRNTAB0 aptb0PAUSE[] = /* PAUSE */ {
};
#endif

PTRNTAB0 aptb0SYSCALL[] = /* SYSCALL */ {
{ 0x0f05, _modcxr11 }
};

PTRNTAB0 aptb0SYSRET[] = /* SYSRET */ {
{ 0x0f07, 0 }
};

PTRNTAB0 aptb0SYSENTER[] = /* SYSENTER */ {
{ 0x0f34, 0 }
};
Expand Down Expand Up @@ -3122,8 +3132,10 @@ getsec
X("subps", 2, (P) aptb2SUBPS ) \
X("subsd", 2, (P) aptb2SUBSD ) \
X("subss", 2, (P) aptb2SUBSS ) \
X("syscall", 0, aptb0SYSCALL ) \
X("sysenter", 0, aptb0SYSENTER ) \
X("sysexit", 0, aptb0SYSEXIT ) \
X("sysret", 0, aptb0SYSRET ) \
X("test", 2, (P) aptb2TEST ) \
X("ucomisd", 2, (P) aptb2UCOMISD ) \
X("ucomiss", 2, (P) aptb2UCOMISS ) \
Expand Down
8 changes: 8 additions & 0 deletions src/iasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,8 @@ STATIC void asm_make_modrm_byte(
if (aopty == _reg || amod == _rspecial) {
mrmb.modregrm.mod = 0x3;
mrmb.modregrm.rm |= popnd->base->val;
if ( popnd->base->val & NUM_MASKR )
pc->Irex |= REX_B;
}
else if (amod == _addr16 || (amod == _flbl && I16))
{ unsigned rm;
Expand Down Expand Up @@ -2578,6 +2580,8 @@ STATIC void asm_make_modrm_byte(
ASM_GET_amod(popnd2->usFlags) == _rspecial))
{
mrmb.modregrm.reg = popnd2->base->val;
if ( popnd2->base->val & NUM_MASKR )
pc->Irex |= REX_R;
}
#ifdef DEBUG
puchOpcode[ (*pusIdx)++ ] = mrmb.uchOpcode;
Expand Down Expand Up @@ -2691,6 +2695,9 @@ STATIC regm_t asm_modify_regs(PTRNTAB ptb, OPND *popnd1, OPND *popnd2)
usRet |= mSI;
popnd1 = NULL;
break;
case _modcxr11:
usRet |= (mCX | mR11);
break;
}
if (popnd1 && ASM_GET_aopty(popnd1->usFlags) == _reg)
{
Expand Down Expand Up @@ -4050,6 +4057,7 @@ STATIC OPND *asm_primary_exp()
case TOKthis:
strcpy(tok.TKid,cpp_name_this);
#endif
case TOKthis:
case TOKidentifier:
case_ident:
o1 = opnd_calloc();
Expand Down