From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 01/18] target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
Date: Thu, 14 Sep 2017 18:52:36 +0100 [thread overview]
Message-ID: <1505411573-27848-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1505411573-27848-1-git-send-email-peter.maydell@linaro.org>
Use a symbolic constant M_REG_NUM_BANKS for the array size for
registers which are banked by M profile security state, rather
than hardcoding lots of 2s.
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 1505137930-13255-2-git-send-email-peter.maydell@linaro.org
---
target/arm/cpu.h | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 98b9b26..5a1f957 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -81,8 +81,11 @@
* accessed via env->registerfield[env->v7m.secure] (whether the security
* extension is implemented or not).
*/
-#define M_REG_NS 0
-#define M_REG_S 1
+enum {
+ M_REG_NS = 0,
+ M_REG_S = 1,
+ M_REG_NUM_BANKS = 2,
+};
/* ARM-specific interrupt pending bits. */
#define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
@@ -433,19 +436,19 @@ typedef struct CPUARMState {
uint32_t other_sp;
uint32_t other_ss_msp;
uint32_t other_ss_psp;
- uint32_t vecbase[2];
- uint32_t basepri[2];
- uint32_t control[2];
- uint32_t ccr[2]; /* Configuration and Control */
- uint32_t cfsr[2]; /* Configurable Fault Status */
+ uint32_t vecbase[M_REG_NUM_BANKS];
+ uint32_t basepri[M_REG_NUM_BANKS];
+ uint32_t control[M_REG_NUM_BANKS];
+ uint32_t ccr[M_REG_NUM_BANKS]; /* Configuration and Control */
+ uint32_t cfsr[M_REG_NUM_BANKS]; /* Configurable Fault Status */
uint32_t hfsr; /* HardFault Status */
uint32_t dfsr; /* Debug Fault Status Register */
- uint32_t mmfar[2]; /* MemManage Fault Address */
+ uint32_t mmfar[M_REG_NUM_BANKS]; /* MemManage Fault Address */
uint32_t bfar; /* BusFault Address */
- unsigned mpu_ctrl[2]; /* MPU_CTRL */
+ unsigned mpu_ctrl[M_REG_NUM_BANKS]; /* MPU_CTRL */
int exception;
- uint32_t primask[2];
- uint32_t faultmask[2];
+ uint32_t primask[M_REG_NUM_BANKS];
+ uint32_t faultmask[M_REG_NUM_BANKS];
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
} v7m;
@@ -546,7 +549,7 @@ typedef struct CPUARMState {
uint32_t *drbar;
uint32_t *drsr;
uint32_t *dracr;
- uint32_t rnr[2];
+ uint32_t rnr[M_REG_NUM_BANKS];
} pmsav7;
/* PMSAv8 MPU */
@@ -556,10 +559,10 @@ typedef struct CPUARMState {
* pmsav7.rnr (region number register)
* pmsav7_dregion (number of configured regions)
*/
- uint32_t *rbar[2];
- uint32_t *rlar[2];
- uint32_t mair0[2];
- uint32_t mair1[2];
+ uint32_t *rbar[M_REG_NUM_BANKS];
+ uint32_t *rlar[M_REG_NUM_BANKS];
+ uint32_t mair0[M_REG_NUM_BANKS];
+ uint32_t mair1[M_REG_NUM_BANKS];
} pmsav8;
void *nvic;
--
2.7.4
next prev parent reply other threads:[~2017-09-14 17:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 17:52 [Qemu-devel] [PULL 00/18] target-arm queue Peter Maydell
2017-09-14 17:52 ` Peter Maydell [this message]
2017-09-14 17:52 ` [Qemu-devel] [PULL 02/18] target/arm: Clear exclusive monitor on v7M reset, exception entry/exit Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 03/18] target/arm: Get PRECISERR and IBUSERR the right way round Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 04/18] nvic: Don't apply group priority mask to negative priorities Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 05/18] target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit() Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 06/18] target/arm: Add and use defines for EXCRET constants Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 07/18] target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit() Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 08/18] xlnx-ep108: Rename to ZCU102 Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 09/18] xlnx-zcu102: Manually create the machines Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 10/18] xlnx-zcu102: Add a machine level secure property Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 11/18] xlnx-zcu102: Add a machine level virtualization property Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 12/18] xlnx-zcu102: Mark the EP108 machine as deprecated Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 13/18] AArch64: Fix single stepping of ERET instruction Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 14/18] target/arm: Avoid an extra temporary for store_exclusive Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 15/18] hw/pci-host/gpex: Set INTx index/gsi mapping Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 16/18] hw/arm/virt: Set INTx/gsi mapping Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 17/18] hw/pci-host/gpex: Implement PCI INTx routing Peter Maydell
2017-09-14 17:52 ` [Qemu-devel] [PULL 18/18] mps2-an511: Fix wiring of UART overflow interrupt lines Peter Maydell
2017-09-15 17:59 ` [Qemu-devel] [PULL 00/18] target-arm queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505411573-27848-2-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).