qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Anthony Liguori <aliguori@amazon.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 3/6] target-arm: Add CP15 VBAR support
Date: Fri, 25 Oct 2013 19:07:26 +0100	[thread overview]
Message-ID: <1382724449-11944-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1382724449-11944-1-git-send-email-peter.maydell@linaro.org>

From: Nathan Rossi <nathan.rossi@xilinx.com>

Added Vector Base Address remapping on ARM v7.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[PMM: removed spurious mask of value with 1<<31]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 2c56740..9f110f1 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -176,6 +176,7 @@ typedef struct CPUARMState {
         uint32_t c9_pmxevtyper; /* perf monitor event type */
         uint32_t c9_pmuserenr; /* perf monitor user enable */
         uint32_t c9_pminten; /* perf monitor interrupt enables */
+        uint32_t c12_vbar; /* vector base address register */
         uint32_t c13_fcse; /* FCSE PID.  */
         uint32_t c13_context; /* Context ID.  */
         uint32_t c13_tls1; /* User RW Thread register.  */
diff --git a/target-arm/helper.c b/target-arm/helper.c
index c63bbd7..73476ed 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -537,6 +537,13 @@ static int pmintenclr_write(CPUARMState *env, const ARMCPRegInfo *ri,
     return 0;
 }
 
+static int vbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
+                      uint64_t value)
+{
+    env->cp15.c12_vbar = value & ~0x1Ful;
+    return 0;
+}
+
 static int ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri,
                        uint64_t *value)
 {
@@ -622,6 +629,10 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
       .access = PL1_RW, .type = ARM_CP_NO_MIGRATE,
       .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
       .resetvalue = 0, .writefn = pmintenclr_write, },
+    { .name = "VBAR", .cp = 15, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0,
+      .access = PL1_RW, .writefn = vbar_write,
+      .fieldoffset = offsetof(CPUARMState, cp15.c12_vbar),
+      .resetvalue = 0 },
     { .name = "SCR", .cp = 15, .crn = 1, .crm = 1, .opc1 = 0, .opc2 = 0,
       .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c1_scr),
       .resetvalue = 0, },
@@ -2470,7 +2481,17 @@ void arm_cpu_do_interrupt(CPUState *cs)
     }
     /* High vectors.  */
     if (env->cp15.c1_sys & (1 << 13)) {
+        /* when enabled, base address cannot be remapped.  */
         addr += 0xffff0000;
+    } else {
+        /* ARM v7 architectures provide a vector base address register to remap
+         * the interrupt vector table.
+         * This register is only followed in non-monitor mode, and has a secure
+         * and un-secure copy. Since the cpu is always in a un-secure operation
+         * and is never in monitor mode this feature is always active.
+         * Note: only bits 31:5 are valid.
+         */
+        addr += env->cp15.c12_vbar;
     }
     switch_mode (env, new_mode);
     env->spsr = cpsr_read(env);
-- 
1.7.9.5

  parent reply	other threads:[~2013-10-25 18:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25 18:07 [Qemu-devel] [PULL 0/6] target-arm queue Peter Maydell
2013-10-25 18:07 ` [Qemu-devel] [PULL 1/6] hw/arm/boot: Make user not specifying a kernel not an error Peter Maydell
2013-10-25 18:07 ` [Qemu-devel] [PULL 2/6] hw/arm: Tidy up conditional calls to arm_load_kernel Peter Maydell
2013-10-25 18:07 ` Peter Maydell [this message]
2013-10-25 18:07 ` [Qemu-devel] [PULL 4/6] target-arm: sort TCG cpreg list by KVM-style 64 bit ID number Peter Maydell
2013-10-25 18:07 ` [Qemu-devel] [PULL 5/6] target-arm: fix sorting issue of KVM cpreg list Peter Maydell
2013-10-25 18:07 ` [Qemu-devel] [PULL 6/6] integrator: fix Linux boot failure by emulating dbg region Peter Maydell
2013-10-31 14:02 ` [Qemu-devel] [PULL 0/6] target-arm queue Edgar E. Iglesias
2013-10-31 14:18   ` Andreas Färber
2013-10-31 14:21     ` Anthony Liguori
2013-10-31 14:31     ` Peter Maydell
2013-10-31 14:36       ` Andreas Färber
2013-10-31 14:39         ` Anthony Liguori
2013-10-31 14:45           ` Andreas Färber
2013-10-31 14:54             ` Anthony Liguori
2013-10-31 15:04             ` Anthony Liguori
2013-10-31 16:52               ` Andreas Färber
2013-10-31 16:54                 ` Anthony Liguori
2013-10-31 17:10                   ` Andreas Färber
2013-10-31 17:02                 ` Peter Maydell
2013-10-31 17:15                   ` Peter Maydell
2013-10-31 18:55                 ` Anthony Liguori
2013-10-31 15:16         ` Peter Maydell
2013-10-31 17:14           ` Andreas Färber
2013-10-31 17:18             ` Peter Maydell
2013-10-31 17:27               ` Andreas Färber
2013-10-31 17:51                 ` Peter Maydell
2013-10-31 18:58             ` Anthony Liguori
2013-10-31 22:13     ` Edgar E. Iglesias

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=1382724449-11944-4-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=aliguori@amazon.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).