qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 3/4] semihosting: create SemihostingConfig struct


From: Leon Alrae
Subject: [Qemu-devel] [PATCH 3/4] semihosting: create SemihostingConfig struct
Date: Wed, 6 May 2015 15:57:08 +0100

Group semihosting config related variables in a single structure.

Signed-off-by: Leon Alrae <address@hidden>
---
 vl.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/vl.c b/vl.c
index a42f127..82586c7 100644
--- a/vl.c
+++ b/vl.c
@@ -1227,17 +1227,21 @@ static void configure_msg(QemuOpts *opts)
 /***********************************************************/
 /* Semihosting */
 
-static bool semihosting_allowed;
-static SemihostingTarget semihosting_target;
+typedef struct SemihostingConfig {
+    bool allowed;
+    SemihostingTarget target;
+} SemihostingConfig;
+
+static SemihostingConfig semihosting;
 
 bool semihosting_enabled(void)
 {
-    return semihosting_allowed;
+    return semihosting.allowed;
 }
 
 SemihostingTarget semihosting_get_target(void)
 {
-    return semihosting_target;
+    return semihosting.target;
 }
 
 /***********************************************************/
@@ -3561,24 +3565,24 @@ int main(int argc, char **argv, char **envp)
                 nb_option_roms++;
                 break;
             case QEMU_OPTION_semihosting:
-                semihosting_allowed = true;
-                semihosting_target = SEMIHOSTING_TARGET_AUTO;
+                semihosting.allowed = true;
+                semihosting.target = SEMIHOSTING_TARGET_AUTO;
                 break;
             case QEMU_OPTION_semihosting_config:
-                semihosting_allowed = true;
+                semihosting.allowed = true;
                 opts = qemu_opts_parse(qemu_find_opts("semihosting-config"),
                                            optarg, 0);
                 if (opts != NULL) {
-                    semihosting_allowed = qemu_opt_get_bool(opts, "enable",
+                    semihosting.allowed = qemu_opt_get_bool(opts, "enable",
                                                             true);
                     const char *target = qemu_opt_get(opts, "target");
                     if (target != NULL) {
                         if (strcmp("native", target) == 0) {
-                            semihosting_target = SEMIHOSTING_TARGET_NATIVE;
+                            semihosting.target = SEMIHOSTING_TARGET_NATIVE;
                         } else if (strcmp("gdb", target) == 0) {
-                            semihosting_target = SEMIHOSTING_TARGET_GDB;
+                            semihosting.target = SEMIHOSTING_TARGET_GDB;
                         } else  if (strcmp("auto", target) == 0) {
-                            semihosting_target = SEMIHOSTING_TARGET_AUTO;
+                            semihosting.target = SEMIHOSTING_TARGET_AUTO;
                         } else {
                             fprintf(stderr, "Unsupported semihosting-config"
                                     " %s\n",
@@ -3586,7 +3590,7 @@ int main(int argc, char **argv, char **envp)
                             exit(1);
                         }
                     } else {
-                        semihosting_target = SEMIHOSTING_TARGET_AUTO;
+                        semihosting.target = SEMIHOSTING_TARGET_AUTO;
                     }
                 } else {
                     fprintf(stderr, "Unsupported semihosting-config %s\n",



reply via email to

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