From: Peter Maydell <peter.maydell@linaro.org>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paul Brook <paul@codesourcery.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 01/10] arm: Fix CP15 FSR (C5) domain setting
Date: Tue, 13 Dec 2011 18:30:08 +0000 [thread overview]
Message-ID: <1323801017-17986-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1323801017-17986-1-git-send-email-peter.maydell@linaro.org>
From: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Return the correct value in the domain field in the cp15 DFSR
(C5) -- bug noticed during Xvisor development.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[Peter Maydell: reworded commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/helper.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 3fe5822..1949202 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -951,13 +951,14 @@ void do_interrupt(CPUARMState *env)
/* Check section/page access permissions.
Returns the page protection flags, or zero if the access is not
permitted. */
-static inline int check_ap(CPUState *env, int ap, int domain, int access_type,
- int is_user)
+static inline int check_ap(CPUState *env, int ap, int domain_prot,
+ int access_type, int is_user)
{
int prot_ro;
- if (domain == 3)
+ if (domain_prot == 3) {
return PAGE_READ | PAGE_WRITE;
+ }
if (access_type == 1)
prot_ro = 0;
@@ -1023,6 +1024,7 @@ static int get_phys_addr_v5(CPUState *env, uint32_t address, int access_type,
int type;
int ap;
int domain;
+ int domain_prot;
uint32_t phys_addr;
/* Pagetable walk. */
@@ -1030,13 +1032,14 @@ static int get_phys_addr_v5(CPUState *env, uint32_t address, int access_type,
table = get_level1_table_address(env, address);
desc = ldl_phys(table);
type = (desc & 3);
- domain = (env->cp15.c3 >> ((desc >> 4) & 0x1e)) & 3;
+ domain = (desc >> 5) & 0x0f;
+ domain_prot = (env->cp15.c3 >> (domain * 2)) & 3;
if (type == 0) {
/* Section translation fault. */
code = 5;
goto do_fault;
}
- if (domain == 0 || domain == 2) {
+ if (domain_prot == 0 || domain_prot == 2) {
if (type == 2)
code = 9; /* Section domain fault. */
else
@@ -1094,7 +1097,7 @@ static int get_phys_addr_v5(CPUState *env, uint32_t address, int access_type,
}
code = 15;
}
- *prot = check_ap(env, ap, domain, access_type, is_user);
+ *prot = check_ap(env, ap, domain_prot, access_type, is_user);
if (!*prot) {
/* Access permission fault. */
goto do_fault;
@@ -1117,6 +1120,7 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type,
int type;
int ap;
int domain;
+ int domain_prot;
uint32_t phys_addr;
/* Pagetable walk. */
@@ -1134,10 +1138,10 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type,
domain = 0;
} else {
/* Section or page. */
- domain = (desc >> 4) & 0x1e;
+ domain = (desc >> 5) & 0x0f;
}
- domain = (env->cp15.c3 >> domain) & 3;
- if (domain == 0 || domain == 2) {
+ domain_prot = (env->cp15.c3 >> (domain * 2)) & 3;
+ if (domain_prot == 0 || domain_prot == 2) {
if (type == 2)
code = 9; /* Section domain fault. */
else
@@ -1182,7 +1186,7 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type,
}
code = 15;
}
- if (domain == 3) {
+ if (domain_prot == 3) {
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
} else {
if (xn && access_type == 2)
@@ -1194,7 +1198,7 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type,
code = (code == 15) ? 6 : 3;
goto do_fault;
}
- *prot = check_ap(env, ap, domain, access_type, is_user);
+ *prot = check_ap(env, ap, domain_prot, access_type, is_user);
if (!*prot) {
/* Access permission fault. */
goto do_fault;
--
1.7.1
next prev parent reply other threads:[~2011-12-13 18:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 18:30 [Qemu-devel] [PULL 00/10] target-arm queue Peter Maydell
2011-12-13 18:30 ` Peter Maydell [this message]
2011-12-13 18:30 ` [Qemu-devel] [PATCH 02/10] target-arm: Infer ARMv4T feature from ARMv5 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 03/10] target-arm: Infer ARMv5 feature from ARMv6 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 04/10] target-arm: Infer ARMv6 feature from v6K Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 05/10] target-arm: Infer ARMv6(K) feature from ARMv7 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 06/10] target-arm: Infer AUXCR feature from ARMv6 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 07/10] target-arm: Infer Thumb2 feature from ARMv7 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 08/10] target-arm: Infer Thumb division feature from M profile Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 09/10] target-arm: Infer VFP feature from VFPv3 Peter Maydell
2011-12-13 18:30 ` [Qemu-devel] [PATCH 10/10] target-arm: Infer VFPv3 feature from VFPv4 Peter Maydell
2011-12-14 20:41 ` [Qemu-devel] [PULL 00/10] target-arm queue andrzej zaborowski
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=1323801017-17986-2-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aliguori@us.ibm.com \
--cc=paul@codesourcery.com \
--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).