From d653cb457f118a0e9434b7d1ddf68e14cbf93805 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 12 Nov 2009 16:19:01 +0000 Subject: [PATCH] gas2ack support for rdmsr and wrmsr --- commands/i386/gas2ack/asm86.h | 2 ++ commands/i386/gas2ack/emit_ack.c | 10 ++++++++++ commands/i386/gas2ack/parse_gnu.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/commands/i386/gas2ack/asm86.h b/commands/i386/gas2ack/asm86.h index aae77bdbb..499413312 100644 --- a/commands/i386/gas2ack/asm86.h +++ b/commands/i386/gas2ack/asm86.h @@ -152,6 +152,7 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual. PUSHF, RCL, RCR, ROL, ROR, RET, RETF, /* RETF added */ + RDMSR, SAHF, SAL, SAR, SHL, SHR, SBB, @@ -173,6 +174,7 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual. VERR, VERW, WAIT, WBINVD, + WRMSR, XADD, XCHG, XLAT, diff --git a/commands/i386/gas2ack/emit_ack.c b/commands/i386/gas2ack/emit_ack.c index 5a956e996..8b97d66c1 100644 --- a/commands/i386/gas2ack/emit_ack.c +++ b/commands/i386/gas2ack/emit_ack.c @@ -249,6 +249,7 @@ static mnemonic_t mnemtab[] = { { RCR, "rcr%" }, { RET, "ret" }, { RETF, "retf" }, + { RDMSR, "rdmsr" }, { ROL, "rol%" }, { ROR, "ror%" }, { SAHF, "sahf" }, @@ -291,6 +292,7 @@ static mnemonic_t mnemtab[] = { { VERW, "verw" }, { WAIT, "wait" }, { WBINVD, "wbinvd" }, + { WRMSR, "wrmsr" }, { XADD, "xadd" }, { XCHG, "xchg%" }, { XLAT, "xlat" }, @@ -605,6 +607,14 @@ void ack_emit_instruction(asm86_t *a) 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 */ if (a->args && a->args->operator == ',' /* don't swap ljmp prefixed with segment */ diff --git a/commands/i386/gas2ack/parse_gnu.c b/commands/i386/gas2ack/parse_gnu.c index 56960b51d..98a1f5f43 100644 --- a/commands/i386/gas2ack/parse_gnu.c +++ b/commands/i386/gas2ack/parse_gnu.c @@ -335,6 +335,7 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "rcrw", RCR, OWORD }, { "ret", RET, JUMP }, { "retf", RETF, JUMP }, + { "rdmsr", RDMSR, WORD }, { "rolb", ROL, BYTE }, { "roll", ROL, WORD }, { "rolw", ROL, OWORD }, @@ -407,6 +408,7 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "verw", VERW, WORD }, { "wait", WAIT, WORD }, { "wbinvd", WBINVD, WORD }, + { "wrmsr", WRMSR, WORD }, { "xadd", XADD, WORD }, { "xchgb", XCHG, BYTE }, { "xchgl", XCHG, WORD }, -- 2.44.0