All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, agraf@suse.de, armbru@redhat.com,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org, afaerber@suse.de,
	rth@twiddle.net
Subject: [Qemu-devel] [PATCH v3 5/9] target-arm: introduce aarch64_compat_sp
Date: Tue, 15 Dec 2015 16:51:14 -0600	[thread overview]
Message-ID: <1450219878-5293-6-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1450219878-5293-1-git-send-email-drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 target-arm/cpu.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 815fef8a30663..9231a9ff3b9c2 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -863,6 +863,51 @@ enum arm_cpu_mode {
 #define ARM_IWMMXT_wCGR2	10
 #define ARM_IWMMXT_wCGR3	11
 
+/* AArch64 to AArch32 register mappings */
+#define compat_fp_usr   xregs[11]
+#define compat_sp_usr   xregs[13]
+#define compat_lr_usr   xregs[14]
+#define compat_sp_hyp   xregs[15]
+#define compat_lr_irq   xregs[16]
+#define compat_sp_irq   xregs[17]
+#define compat_lr_svc   xregs[18]
+#define compat_sp_svc   xregs[19]
+#define compat_lr_abt   xregs[20]
+#define compat_sp_abt   xregs[21]
+#define compat_lr_und   xregs[22]
+#define compat_sp_und   xregs[23]
+#define compat_r8_fiq   xregs[24]
+#define compat_r9_fiq   xregs[25]
+#define compat_r10_fiq  xregs[26]
+#define compat_r11_fiq  xregs[27]
+#define compat_r12_fiq  xregs[28]
+#define compat_sp_fiq   xregs[29]
+#define compat_lr_fiq   xregs[30]
+
+static inline uint64_t aarch64_compat_sp(CPUARMState *env)
+{
+    uint32_t mode = env->uncached_cpsr & CPSR_M;
+
+    switch (mode) {
+    case ARM_CPU_MODE_USR:
+    case ARM_CPU_MODE_SYS:
+        return env->compat_sp_usr;
+    case ARM_CPU_MODE_FIQ:
+        return env->compat_sp_fiq;
+    case ARM_CPU_MODE_IRQ:
+        return env->compat_sp_irq;
+    case ARM_CPU_MODE_SVC:
+        return env->compat_sp_svc;
+    case ARM_CPU_MODE_ABT:
+        return env->compat_sp_abt;
+    case ARM_CPU_MODE_HYP:
+        return env->compat_sp_hyp;
+    case ARM_CPU_MODE_UND:
+        return env->compat_sp_und;
+    }
+    g_assert_not_reached();
+}
+
 /* If adding a feature bit which corresponds to a Linux ELF
  * HWCAP bit, remember to update the feature-bit-to-hwcap
  * mapping in linux-user/elfload.c:get_elf_hwcap().
-- 
2.4.3

  parent reply	other threads:[~2015-12-15 22:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 22:51 [Qemu-devel] [PATCH v3 0/9] target-arm: enable qmp-dump-guest-memory Andrew Jones
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 1/9] qapi-schema: dump-guest-memory: Improve text Andrew Jones
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 2/9] dump: qemunotes aren't commonly needed Andrew Jones
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 3/9] dump: allow target to set the page size Andrew Jones
2015-12-18 12:10   ` Peter Maydell
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 4/9] dump: allow target to set the physical base Andrew Jones
2015-12-15 22:51 ` Andrew Jones [this message]
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 6/9] target-arm: support QMP dump-guest-memory Andrew Jones
2015-12-18 11:59   ` Peter Maydell
2015-12-18 16:05     ` Andrew Jones
2015-12-18 16:31       ` Peter Maydell
2015-12-18 18:05         ` Andrew Jones
2015-12-18 18:46           ` Peter Maydell
2015-12-18 19:57             ` Andrew Jones
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 7/9] target-arm: dump-guest-memory: add prfpreg notes for aarch64 Andrew Jones
2015-12-18 12:06   ` Peter Maydell
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 8/9] elf: add arm note types Andrew Jones
2015-12-18 12:05   ` Peter Maydell
2015-12-15 22:51 ` [Qemu-devel] [PATCH v3 9/9] target-arm: dump-guest-memory: add vfp notes for arm Andrew Jones
2015-12-18 12:05   ` 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=1450219878-5293-6-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.