From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-devel] [PATCH 1/7] target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
Date: Mon, 11 Sep 2017 14:52:04 +0100 [thread overview]
Message-ID: <1505137930-13255-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1505137930-13255-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>
---
Philippe suggested this in review on the last round of
patches but I forgot about it :-(
---
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-11 13:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 13:52 [Qemu-devel] [PATCH 0/7] ARMv8M: some bugfixes and prep. cleanup Peter Maydell
2017-09-11 13:52 ` Peter Maydell [this message]
2017-09-11 14:59 ` [Qemu-devel] [Qemu-arm] [PATCH 1/7] target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2 Philippe Mathieu-Daudé
2017-09-11 17:32 ` Alistair Francis
2017-09-11 13:52 ` [Qemu-devel] [PATCH 2/7] target/arm: Clear exclusive monitor on v7M reset, exception entry/exit Peter Maydell
2017-09-11 17:33 ` Alistair Francis
2017-09-13 15:55 ` Richard Henderson
2017-09-11 13:52 ` [Qemu-devel] [PATCH 3/7] target/arm: Get PRECISERR and IBUSERR the right way round Peter Maydell
2017-09-11 17:38 ` Alistair Francis
2017-09-13 15:57 ` Richard Henderson
2017-09-11 13:52 ` [Qemu-devel] [PATCH 4/7] nvic: Don't apply group priority mask to negative priorities Peter Maydell
2017-09-13 15:58 ` Richard Henderson
2017-09-11 13:52 ` [Qemu-devel] [PATCH 5/7] target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit() Peter Maydell
2017-09-11 17:41 ` Alistair Francis
2017-09-13 16:36 ` Richard Henderson
2017-09-11 13:52 ` [Qemu-devel] [PATCH 6/7] target/arm: Add and use defines for EXCRET constants Peter Maydell
2017-09-11 17:43 ` Alistair Francis
2017-09-11 13:52 ` [Qemu-devel] [PATCH 7/7] target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit() Peter Maydell
2017-09-11 15:03 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-09-11 17:45 ` Alistair Francis
2017-09-13 16:41 ` [Qemu-devel] " Richard Henderson
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=1505137930-13255-2-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=qemu-arm@nongnu.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).