[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",
- [Qemu-devel] [PATCH 0/4] semihosting: clean up and add --semihosting-config arg, Leon Alrae, 2015/05/06
- [Qemu-devel] [PATCH 1/4] semihosting: remove semihosting_enabled declaration from sysemu.h, Leon Alrae, 2015/05/06
- [Qemu-devel] [PATCH 3/4] semihosting: create SemihostingConfig struct,
Leon Alrae <=
- [Qemu-devel] [PATCH 2/4] semihosting: remove semihosting_target declaration from gdbstub.h, Leon Alrae, 2015/05/06
- [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Leon Alrae, 2015/05/06
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Liviu Ionescu, 2015/05/07
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Leon Alrae, 2015/05/07
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Liviu Ionescu, 2015/05/07
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Leon Alrae, 2015/05/07
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Liviu Ionescu, 2015/05/07
- Re: [Qemu-devel] [PATCH 4/4] semihosting: add --semihosting-config arg sub-argument, Leon Alrae, 2015/05/07
Re: [Qemu-devel] [PATCH 0/4] semihosting: clean up and add --semihosting-config arg, Liviu Ionescu, 2015/05/06