From patchwork Wed May 6 14:57:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Alrae X-Patchwork-Id: 468986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3DC73140295 for ; Thu, 7 May 2015 00:59:41 +1000 (AEST) Received: from localhost ([::1]:45620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0nT-0007ub-Jm for incoming@patchwork.ozlabs.org; Wed, 06 May 2015 10:59:39 -0400 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 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id A9A64FF97E99A; Wed, 6 May 2015 15:58:28 +0100 (IST) Received: from lalrae-linux.kl.imgtec.org (192.168.14.163) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 6 May 2015 15:57:29 +0100 From: Leon Alrae To: Date: Wed, 6 May 2015 15:57:08 +0100 Message-ID: <1430924229-20469-4-git-send-email-leon.alrae@imgtec.com> X-Mailer: git-send-email 1.7.9.5 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 X-Originating-IP: [192.168.14.163] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Cc: peter.maydell@linaro.org, christopher.covington@linaro.org, matthew.fortune@imgtec.com, ilg@livius.net Subject: [Qemu-devel] [PATCH 3/4] semihosting: create SemihostingConfig struct X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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",