qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 11/11] AARCH64: Add 32-bit mode selection paramet


From: Mian M. Hamayun
Subject: [Qemu-devel] [PATCH v3 11/11] AARCH64: Add 32-bit mode selection parameter
Date: Fri, 27 Sep 2013 12:10:14 +0200

From: "Mian M. Hamayun" <address@hidden>

This commit introduces a commandline argument to select the
AARCH64 or AARCH32 mode for processor initilization.

Signed-off-by: Mian M. Hamayun <address@hidden>
---
 qemu-options.hx  | 8 ++++++++
 target-arm/cpu.c | 9 +++++++--
 vl.c             | 4 ++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 5dc8b75..a2dab99 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -72,6 +72,14 @@ STEXI
 Select CPU model (@code{-cpu help} for list and additional feature selection)
 ETEXI
 
+DEF("aarch32-mode", 0, QEMU_OPTION_aarch32_mode, \
+    "-aarch32-mode   enable aarch32 mode support on aarch64\n", QEMU_ARCH_ARM)
+STEXI
address@hidden -aarch32-mode
address@hidden -aarch32-mode
+Enable aarch32 guest support on aarch64.
+ETEXI
+
 DEF("smp", HAS_ARG, QEMU_OPTION_smp,
     "-smp 
[cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets]\n"
     "                set the number of CPUs to 'n' [default=1]\n"
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 5d811b9..56e8e56 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -27,6 +27,8 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 
+extern int aarch32_mode;
+
 static void arm_cpu_set_pc(CPUState *cs, vaddr value)
 {
     ARMCPU *cpu = ARM_CPU(cs);
@@ -85,8 +87,11 @@ static void arm_cpu_reset(CPUState *s)
     }
 
     if (arm_feature(env, ARM_FEATURE_AARCH64)) {
-        /* 64 bit CPUs always start in 64 bit mode */
-        env->aarch64 = 1;
+        if(aarch32_mode) {
+            env->aarch64 = 0;  /* Boot a 32-bit Guest */
+        } else {
+            env->aarch64 = 1;  /* Boot a 64-bit Guest */
+        }
     }
 
 #if defined(CONFIG_USER_ONLY)
diff --git a/vl.c b/vl.c
index 4e709d5..e0f2cf3 100644
--- a/vl.c
+++ b/vl.c
@@ -207,6 +207,7 @@ CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
 CharDriverState *sclp_hds[MAX_SCLP_CONSOLES];
 int win2k_install_hack = 0;
 int singlestep = 0;
+int aarch32_mode = 0;
 int smp_cpus = 1;
 int max_cpus = 0;
 int smp_cores = 1;
@@ -3113,6 +3114,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_dtb:
                 qemu_opts_set(qemu_find_opts("machine"), 0, "dtb", optarg);
                 break;
+            case QEMU_OPTION_aarch32_mode:
+                aarch32_mode = 1;
+                break;
             case QEMU_OPTION_cdrom:
                 drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS);
                 break;
-- 
1.8.1.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]