New instructions in gas2ack

pause
mfence
rdtsc
rdpmc
This commit is contained in:
Tomas Hruby 2009-11-16 21:32:48 +00:00
parent 2dc9e354f7
commit 6515c93ecf
3 changed files with 16 additions and 12 deletions

View file

@ -129,6 +129,7 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual.
LOOP, LOOPE, LOOPNE, LOOP, LOOPE, LOOPNE,
LSL, LSL,
LTR, LTR,
MFENCE,
MOV, MOV,
MOVS, MOVS,
MOVSX, MOVSX,
@ -142,6 +143,7 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual.
OR, OR,
OUT, OUT,
OUTS, OUTS,
PAUSE,
POP, POP,
POPA, POPA,
POPAD, POPAD,
@ -151,8 +153,10 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual.
PUSHAD, PUSHAD,
PUSHF, PUSHF,
RCL, RCR, ROL, ROR, RCL, RCR, ROL, ROR,
RET, RETF, /* RETF added */
RDMSR, RDMSR,
RDPMC,
RDTSC,
RET, RETF, /* RETF added */
SAHF, SAHF,
SAL, SAR, SHL, SHR, SAL, SAR, SHL, SHR,
SBB, SBB,

View file

@ -224,6 +224,7 @@ static mnemonic_t mnemtab[] = {
{ LSL, "lsl" }, { LSL, "lsl" },
{ LSS, "lss" }, { LSS, "lss" },
{ LTR, "ltr" }, { LTR, "ltr" },
{ MFENCE, ".data1 0x0f, 0xae, 0x0f"},
{ MOV, "mov%" }, { MOV, "mov%" },
{ MOVS, "movs%" }, { MOVS, "movs%" },
{ MOVSX, "movsx" }, { MOVSX, "movsx" },
@ -237,6 +238,7 @@ static mnemonic_t mnemtab[] = {
{ OR, "or%" }, { OR, "or%" },
{ OUT, "out%" }, { OUT, "out%" },
{ OUTS, "outs%" }, { OUTS, "outs%" },
{ PAUSE, ".data1 0xf3, 0x90"},
{ POP, "pop" }, { POP, "pop" },
{ POPA, "popa" }, { POPA, "popa" },
{ POPAD, "popad" }, { POPAD, "popad" },
@ -249,7 +251,9 @@ static mnemonic_t mnemtab[] = {
{ RCR, "rcr%" }, { RCR, "rcr%" },
{ RET, "ret" }, { RET, "ret" },
{ RETF, "retf" }, { RETF, "retf" },
{ RDMSR, "rdmsr" }, { RDMSR, ".data1 0x0f, 0x32"},
{ RDPMC, ".data1 0x0f, 0x33"},
{ RDTSC, ".data1 0x0f, 0x31"},
{ ROL, "rol%" }, { ROL, "rol%" },
{ ROR, "ror%" }, { ROR, "ror%" },
{ SAHF, "sahf" }, { SAHF, "sahf" },
@ -292,7 +296,7 @@ static mnemonic_t mnemtab[] = {
{ VERW, "verw" }, { VERW, "verw" },
{ WAIT, "wait" }, { WAIT, "wait" },
{ WBINVD, "wbinvd" }, { WBINVD, "wbinvd" },
{ WRMSR, "wrmsr" }, { WRMSR, ".data1 0x0f, 0x30"},
{ XADD, "xadd" }, { XADD, "xadd" },
{ XCHG, "xchg%" }, { XCHG, "xchg%" },
{ XLAT, "xlat" }, { XLAT, "xlat" },
@ -607,14 +611,6 @@ void ack_emit_instruction(asm86_t *a)
return; return;
} }
} }
if (a->opcode == RDMSR) {
ack_printf(".data1 0x0f, 0x32\n");
return;
}
if (a->opcode == WRMSR) {
ack_printf(".data1 0x0f, 0x30\n");
return;
}
/* we are translating from GNU */ /* we are translating from GNU */
if (a->args && a->args->operator == ',' if (a->args && a->args->operator == ','
/* don't swap ljmp prefixed with segment */ /* don't swap ljmp prefixed with segment */

View file

@ -282,6 +282,7 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */
{ "lsl", LSL, WORD }, { "lsl", LSL, WORD },
{ "lss", LSS, WORD }, { "lss", LSS, WORD },
{ "ltr", LTR, WORD }, { "ltr", LTR, WORD },
{ "mfence", MFENCE, WORD },
{ "movb", MOV, BYTE }, { "movb", MOV, BYTE },
{ "movl", MOV, WORD }, { "movl", MOV, WORD },
{ "movsb", MOVS, BYTE }, { "movsb", MOVS, BYTE },
@ -313,6 +314,7 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */
{ "outsl", OUTS, WORD }, { "outsl", OUTS, WORD },
{ "outsw", OUTS, OWORD }, { "outsw", OUTS, OWORD },
{ "outw", OUT, OWORD }, { "outw", OUT, OWORD },
{ "pause", PAUSE, WORD },
{ "pop", POP, WORD }, { "pop", POP, WORD },
{ "popa", POPA, WORD }, { "popa", POPA, WORD },
{ "popal", POPAD, WORD }, { "popal", POPAD, WORD },
@ -332,9 +334,11 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */
{ "rcrb", RCR, BYTE }, { "rcrb", RCR, BYTE },
{ "rcrl", RCR, WORD }, { "rcrl", RCR, WORD },
{ "rcrw", RCR, OWORD }, { "rcrw", RCR, OWORD },
{ "rdmsr", RDMSR, WORD },
{ "rdpmc", RDPMC, WORD },
{ "rdtsc", RDTSC, WORD },
{ "ret", RET, JUMP }, { "ret", RET, JUMP },
{ "retf", RETF, JUMP }, { "retf", RETF, JUMP },
{ "rdmsr", RDMSR, WORD },
{ "rolb", ROL, BYTE }, { "rolb", ROL, BYTE },
{ "roll", ROL, WORD }, { "roll", ROL, WORD },
{ "rolw", ROL, OWORD }, { "rolw", ROL, OWORD },