From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0mR-0006cR-LS for qemu-devel@nongnu.org; Wed, 06 May 2015 10:58:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq0mO-0005vV-EX for qemu-devel@nongnu.org; Wed, 06 May 2015 10:58:35 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:61593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0mO-0005v6-9V for qemu-devel@nongnu.org; Wed, 06 May 2015 10:58:32 -0400 From: Leon Alrae Date: Wed, 6 May 2015 15:57:08 +0100 Message-ID: <1430924229-20469-4-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1430924229-20469-1-git-send-email-leon.alrae@imgtec.com> References: <1430924229-20469-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 3/4] semihosting: create SemihostingConfig struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, christopher.covington@linaro.org, matthew.fortune@imgtec.com, ilg@livius.net Group semihosting config related variables in a single structure. Signed-off-by: Leon Alrae --- 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",