From patchwork Sat Dec 21 16:43:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 304417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0F8C62C00AD for ; Sun, 22 Dec 2013 03:44:44 +1100 (EST) Received: from localhost ([::1]:54767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPfN-00075X-7Z for incoming@patchwork.ozlabs.org; Sat, 21 Dec 2013 11:44:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPeo-0006vk-2Q for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:44:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuPef-0006Md-L2 for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:44:06 -0500 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:46495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPef-0006LQ-EF for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:43:57 -0500 Received: from pc-97-206-86-200.cm.vtr.net ([200.86.206.97] helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VuPed-0004oh-3R; Sat, 21 Dec 2013 17:43:55 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.80) (envelope-from ) id 1VuPeT-0000e2-E8; Sat, 21 Dec 2013 17:43:45 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sat, 21 Dec 2013 17:43:42 +0100 Message-Id: <1387644224-2404-4-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387644224-2404-1-git-send-email-aurelien@aurel32.net> References: <1387644224-2404-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:bc8:30d7:101::1 Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 3/5] tcg/i386: add support for three-byte opcodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add support for three-byte opcodes, starting with the 0x0f 0x38 prefix. Use P_EXT2 as the new constant, and shift all other constants so that P_EXT and P_EXT2 have neighbouring values. Signed-off-by: Aurelien Jarno --- tcg/i386/tcg-target.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 753b3a1..e247829 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -240,13 +240,14 @@ static inline int tcg_target_const_match(tcg_target_long val, #endif #define P_EXT 0x100 /* 0x0f opcode prefix */ -#define P_DATA16 0x200 /* 0x66 opcode prefix */ +#define P_EXT2 0x200 /* 0x0f 0x38 opcode prefix */ +#define P_DATA16 0x400 /* 0x66 opcode prefix */ #if TCG_TARGET_REG_BITS == 64 -# define P_ADDR32 0x400 /* 0x67 opcode prefix */ -# define P_REXW 0x800 /* Set REX.W = 1 */ -# define P_REXB_R 0x1000 /* REG field as byte register */ -# define P_REXB_RM 0x2000 /* R/M field as byte register */ -# define P_GS 0x4000 /* gs segment override */ +# define P_ADDR32 0x800 /* 0x67 opcode prefix */ +# define P_REXW 0x1000 /* Set REX.W = 1 */ +# define P_REXB_R 0x2000 /* REG field as byte register */ +# define P_REXB_RM 0x4000 /* R/M field as byte register */ +# define P_GS 0x8000 /* gs segment override */ #else # define P_ADDR32 0 # define P_REXW 0 @@ -401,6 +402,11 @@ static void tcg_out_opc(TCGContext *s, int opc, int r, int rm, int x) if (opc & P_EXT) { tcg_out8(s, 0x0f); } + + if (opc & P_EXT2) { + tcg_out8(s, 0x0f); + tcg_out8(s, 0x38); + } tcg_out8(s, opc); } #else @@ -412,6 +418,10 @@ static void tcg_out_opc(TCGContext *s, int opc) if (opc & P_EXT) { tcg_out8(s, 0x0f); } + if (opc & P_EXT2) { + tcg_out8(s, 0x0f); + tcg_out8(s, 0x38); + } tcg_out8(s, opc); } /* Discard the register arguments to tcg_out_opc early, so as not to penalize