From patchwork Wed Apr 14 19:08:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [20/22] tcg-i386: Tidy lea. Date: Wed, 14 Apr 2010 09:08:28 -0000 From: Richard Henderson X-Patchwork-Id: 51200 Message-Id: To: qemu-devel@nongnu.org Cc: aurelien@aurel32.net Implement full modrm+sib addressing mode processing. Use that in qemu_ld/st to output the LEA. Signed-off-by: Richard Henderson Acked-by: Aurelien Jarno --- tcg/i386/tcg-target.c | 91 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 60 insertions(+), 31 deletions(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index bf3c0d6..755d46d 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -176,6 +176,7 @@ static inline int tcg_target_const_match(tcg_target_long val, #define OPC_JCC_short (0x70) /* ... plus condition code */ #define OPC_JMP_long (0xe9) #define OPC_JMP_short (0xeb) +#define OPC_LEA (0x8d) #define OPC_MOVB_EvGv (0x88) /* stores, more or less */ #define OPC_MOVL_EvGv (0x89) /* stores, more or less */ #define OPC_MOVL_GvEv (0x8b) /* loads, more or less */ @@ -277,40 +278,70 @@ static inline void tcg_out_modrm(TCGContext *s, int opc, int r, int rm) tcg_out8(s, 0xc0 | (r << 3) | rm); } -/* rm == -1 means no register index */ -static inline void tcg_out_modrm_offset(TCGContext *s, int opc, int r, int rm, - int32_t offset) +/* Output an opcode with a full "rm + (index<