summaryrefslogtreecommitdiffstats
path: root/target/arm
diff options
context:
space:
mode:
authorRichard Henderson2022-10-24 07:18:48 +0200
committerPeter Maydell2022-10-27 11:27:24 +0200
commit34a57faeab62b27c01f008ef08654ca225e46673 (patch)
treec7505e1669349ccb89c5297e32d74f1b6b438afb /target/arm
parenttarget/arm: Consider GP an attribute in get_phys_addr_lpae (diff)
downloadqemu-34a57faeab62b27c01f008ef08654ca225e46673.tar.gz
qemu-34a57faeab62b27c01f008ef08654ca225e46673.tar.xz
qemu-34a57faeab62b27c01f008ef08654ca225e46673.zip
target/arm: Tidy merging of attributes from descriptor and table
Replace some gotos with some nested if statements. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20221024051851.3074715-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm')
-rw-r--r--target/arm/ptw.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 79a0ef45c7..73b3c37b23 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -1322,27 +1322,25 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
page_size = (1ULL << ((stride * (4 - level)) + 3));
descaddr &= ~(hwaddr)(page_size - 1);
descaddr |= (address & (page_size - 1));
- /* Extract attributes from the descriptor */
- attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
- if (regime_is_stage2(mmu_idx)) {
- /* Stage 2 table descriptors do not include any attribute fields */
- goto skip_attrs;
- }
- /* Merge in attributes from table descriptors */
- attrs |= nstable << 5; /* NS */
- if (param.hpd) {
- /* HPD disables all the table attributes except NSTable. */
- goto skip_attrs;
- }
- attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
/*
- * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
- * means "force PL1 access only", which means forcing AP[1] to 0.
+ * Extract attributes from the descriptor, and apply table descriptors.
+ * Stage 2 table descriptors do not include any attribute fields.
+ * HPD disables all the table attributes except NSTable.
*/
- attrs &= ~(extract64(tableattrs, 2, 1) << 6); /* !APT[0] => AP[1] */
- attrs |= extract32(tableattrs, 3, 1) << 7; /* APT[1] => AP[2] */
- skip_attrs:
+ attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
+ if (!regime_is_stage2(mmu_idx)) {
+ attrs |= nstable << 5; /* NS */
+ if (!param.hpd) {
+ attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
+ /*
+ * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
+ * means "force PL1 access only", which means forcing AP[1] to 0.
+ */
+ attrs &= ~(extract64(tableattrs, 2, 1) << 6); /* !APT[0] => AP[1] */
+ attrs |= extract32(tableattrs, 3, 1) << 7; /* APT[1] => AP[2] */
+ }
+ }
/*
* Here descaddr is the final physical address, and attributes