From patchwork Tue Dec 8 16:06:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 40645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EC2F4B6F19 for ; Wed, 9 Dec 2009 03:48:29 +1100 (EST) Received: from localhost ([127.0.0.1]:48303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NI3Eg-0003ld-W5 for incoming@patchwork.ozlabs.org; Tue, 08 Dec 2009 11:48:27 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NI36z-0007pS-Sl for qemu-devel@nongnu.org; Tue, 08 Dec 2009 11:40:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NI36u-0007oY-T8 for qemu-devel@nongnu.org; Tue, 08 Dec 2009 11:40:29 -0500 Received: from [199.232.76.173] (port=37034 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NI36u-0007oV-QH for qemu-devel@nongnu.org; Tue, 08 Dec 2009 11:40:24 -0500 Received: from mx20.gnu.org ([199.232.41.8]:53229) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NI36u-0005O3-Gc for qemu-devel@nongnu.org; Tue, 08 Dec 2009 11:40:24 -0500 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NI36s-0002B9-Nq for qemu-devel@nongnu.org; Tue, 08 Dec 2009 11:40:23 -0500 Received: (qmail 32121 invoked from network); 8 Dec 2009 16:06:35 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Dec 2009 16:06:35 -0000 From: Nathan Froyd To: qemu-devel@nongnu.org Date: Tue, 8 Dec 2009 08:06:22 -0800 Message-Id: <1260288392-20804-2-git-send-email-froydnj@codesourcery.com> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <1260288392-20804-1-git-send-email-froydnj@codesourcery.com> References: <1260288392-20804-1-git-send-email-froydnj@codesourcery.com> X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH 01/11] target-mips: add new HFLAGs for JALX and 16/32-bit delay slots X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We create separate masks for the "basic" branch hflags and the "extended" branch hflags and define MIPS_HFLAG_BMASK as the logical or of those two. This is done to avoid churning the codebase in lots of different places. We also make the execution mode an hflag under MIPS_HFLAG_TMASK Signed-off-by: Nathan Froyd --- target-mips/cpu.h | 47 ++++++++++++++++++++++++++++------------------- 1 files changed, 28 insertions(+), 19 deletions(-) diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 97e106f..b78aec5 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -416,35 +416,44 @@ struct CPUMIPSState { int error_code; uint32_t hflags; /* CPU State */ /* TMASK defines different execution modes */ -#define MIPS_HFLAG_TMASK 0x03FF -#define MIPS_HFLAG_MODE 0x0007 /* execution modes */ +#define MIPS_HFLAG_TMASK 0x007FF +#define MIPS_HFLAG_MODE 0x00007 /* execution modes */ /* The KSU flags must be the lowest bits in hflags. The flag order must be the same as defined for CP0 Status. This allows to use the bits as the value of mmu_idx. */ -#define MIPS_HFLAG_KSU 0x0003 /* kernel/supervisor/user mode mask */ -#define MIPS_HFLAG_UM 0x0002 /* user mode flag */ -#define MIPS_HFLAG_SM 0x0001 /* supervisor mode flag */ -#define MIPS_HFLAG_KM 0x0000 /* kernel mode flag */ -#define MIPS_HFLAG_DM 0x0004 /* Debug mode */ -#define MIPS_HFLAG_64 0x0008 /* 64-bit instructions enabled */ -#define MIPS_HFLAG_CP0 0x0010 /* CP0 enabled */ -#define MIPS_HFLAG_FPU 0x0020 /* FPU enabled */ -#define MIPS_HFLAG_F64 0x0040 /* 64-bit FPU enabled */ +#define MIPS_HFLAG_KSU 0x00003 /* kernel/supervisor/user mode mask */ +#define MIPS_HFLAG_UM 0x00002 /* user mode flag */ +#define MIPS_HFLAG_SM 0x00001 /* supervisor mode flag */ +#define MIPS_HFLAG_KM 0x00000 /* kernel mode flag */ +#define MIPS_HFLAG_DM 0x00004 /* Debug mode */ +#define MIPS_HFLAG_64 0x00008 /* 64-bit instructions enabled */ +#define MIPS_HFLAG_CP0 0x00010 /* CP0 enabled */ +#define MIPS_HFLAG_FPU 0x00020 /* FPU enabled */ +#define MIPS_HFLAG_F64 0x00040 /* 64-bit FPU enabled */ /* True if the MIPS IV COP1X instructions can be used. This also controls the non-COP1X instructions RECIP.S, RECIP.D, RSQRT.S and RSQRT.D. */ -#define MIPS_HFLAG_COP1X 0x0080 /* COP1X instructions enabled */ -#define MIPS_HFLAG_RE 0x0100 /* Reversed endianness */ -#define MIPS_HFLAG_UX 0x0200 /* 64-bit user mode */ +#define MIPS_HFLAG_COP1X 0x00080 /* COP1X instructions enabled */ +#define MIPS_HFLAG_RE 0x00100 /* Reversed endianness */ +#define MIPS_HFLAG_UX 0x00200 /* 64-bit user mode */ +#define MIPS_HFLAG_M16 0x00400 /* MIPS16 mode flag */ +#define MIPS_HFLAG_M16_SHIFT 10 /* If translation is interrupted between the branch instruction and * the delay slot, record what type of branch it is so that we can * resume translation properly. It might be possible to reduce * this from three bits to two. */ -#define MIPS_HFLAG_BMASK 0x1C00 -#define MIPS_HFLAG_B 0x0400 /* Unconditional branch */ -#define MIPS_HFLAG_BC 0x0800 /* Conditional branch */ -#define MIPS_HFLAG_BL 0x0C00 /* Likely branch */ -#define MIPS_HFLAG_BR 0x1000 /* branch to register (can't link TB) */ +#define MIPS_HFLAG_BMASK_BASE 0x03800 +#define MIPS_HFLAG_B 0x00800 /* Unconditional branch */ +#define MIPS_HFLAG_BC 0x01000 /* Conditional branch */ +#define MIPS_HFLAG_BL 0x01800 /* Likely branch */ +#define MIPS_HFLAG_BR 0x02000 /* branch to register (can't link TB) */ + /* Extra flags about the current pending branch. */ +#define MIPS_HFLAG_BMASK_EXT 0x3C000 +#define MIPS_HFLAG_B16 0x04000 /* branch instruction was 16 bits */ +#define MIPS_HFLAG_BDS16 0x08000 /* branch requires 16-bit delay slot */ +#define MIPS_HFLAG_BDS32 0x10000 /* branch requires 32-bit delay slot */ +#define MIPS_HFLAG_BX 0x20000 /* branch exchanges execution mode */ +#define MIPS_HFLAG_BMASK (MIPS_HFLAG_BMASK_BASE | MIPS_HFLAG_BMASK_EXT) target_ulong btarget; /* Jump / branch target */ target_ulong bcond; /* Branch condition (if needed) */