From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735620; cv=none; d=zohomail.com; s=zohoarc; b=K7W5HDJJnahHWyo3AK5PPbaWYSVjPRzdyS+zqXUrDUIUZIEhfg7nS2tXSXzXb2ozVmeIpbfMA8RhzcBR/UO+YDLNexPm+4Rhk8sDmeqngSHv8M9CPUnJq2whxDvzzN5gEtxGJY0xYVjIdUhdqC3chE3Nr7vfaImY5dKY8zU9DKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735620; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=QgH8wZqo2/2TxGhCDC/6naM/dZWNtRHlDBEDvIF5y6w=; b=A2YQrS+yzV9z0MKAC8kwVisEAGpPf3i8Jy+5X9LFjUzsqNSIK/dOe0YU2JslFZAXwhuiAw2GMWaeR7I7qDnQ+tF3s1eAkWZAD43p8AdXw26WnP7d4MWwdPtB3FqQI28BAg0m3j5QRZFNeZ0TVA+YldSOoZpCVktOrBTBjpQ8PEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16557356209071009.561773233131; Mon, 20 Jun 2022 07:33:40 -0700 (PDT) Received: from localhost ([::1]:52928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3ITD-0008U8-Sk for importer@patchew.org; Mon, 20 Jun 2022 10:33:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL8-0005iN-Rg for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from mxout.security-mail.net ([85.31.212.42]:33892) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL5-0001SA-Ot for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 2D7363D3B139 for ; Mon, 20 Jun 2022 16:25:12 +0200 (CEST) Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 409193D3B11A; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx302.security-mail.net (Postfix) with ESMTPS id ACB0C3D3B11B; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 7B75D27E04E7; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 556CD27E04EC; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0y3QulsaVkGf; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 272D027E04D7; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735112; bh=CpDmm89i98qrl33cB4lpGWbeQuoLpTjJMK52jQ1/8e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=55cHmQv6WJINO+McaW+ZPZg2WmY2pp3kBWhbO4sGwVOwC+OT/J2LTbaMN96uXHJAW iORfiImr476DrR1B7XiiY70di1dg5FQfnSgnhkM7oQIkgzpkmPcu9Yf5aHua45saMV VJYOqVR/gxH1ZhlXCo5ZtzsFad+1Nj6crKw8QYo4= X-Virus-Scanned: E-securemail Secumail-id: <2be4.62b08345.ac348.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 556CD27E04EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=QgH8wZqo2/2TxGhCDC/6naM/dZWNtRHlDBEDvIF5y6w=; h=From:To:Date:Message-Id; b=ba3UHBY2rhhQo35ox7cSOl6YTm26Gf70dgl+SgVx720LowwjZzSOoX9iHEYj0ZOPR N3rrQFLYxLvibgys+lbO/YP+MCFFhRfPHjg5+BbhOUb9AaNEsFmgjx+hF0D2Bzd39F GicohCDg0ozt/6NpoNiuOlV5GfFd4lzpidTtj23k= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 1/7] softmmu: add qemu_[set|get]_exit_status functions Date: Mon, 20 Jun 2022 16:24:20 +0200 Message-Id: <20220620142426.15040-3-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.42; envelope-from=lmichel@kalray.eu; helo=mxout.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735621841100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add the two function qemu_set_exit_status() and qemu_get_exit_status(). Use qemu_get_exit_status() in main instead of 0 as the return value. This is in preparation for the semihosting exit request implementation. Signed-off-by: Luc Michel --- include/sysemu/sysemu.h | 2 ++ softmmu/main.c | 2 +- softmmu/runstate.c | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 812f66a31a..49b6970d0e 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -103,10 +103,12 @@ void qemu_boot_set(const char *boot_order, Error **er= rp); bool defaults_enabled(void); =20 void qemu_init(int argc, char **argv, char **envp); void qemu_main_loop(void); void qemu_cleanup(void); +void qemu_set_exit_status(int status); +int qemu_get_exit_status(void); =20 extern QemuOptsList qemu_legacy_drive_opts; extern QemuOptsList qemu_common_drive_opts; extern QemuOptsList qemu_drive_opts; extern QemuOptsList bdrv_runtime_opts; diff --git a/softmmu/main.c b/softmmu/main.c index c00432ff09..67b4bb111e 100644 --- a/softmmu/main.c +++ b/softmmu/main.c @@ -34,11 +34,11 @@ int qemu_main(int argc, char **argv, char **envp) { qemu_init(argc, argv, envp); qemu_main_loop(); qemu_cleanup(); =20 - return 0; + return qemu_get_exit_status(); } =20 #ifndef CONFIG_COCOA int main(int argc, char **argv) { diff --git a/softmmu/runstate.c b/softmmu/runstate.c index fac7b63259..d2491b8a59 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -336,10 +336,11 @@ void vm_state_notify(bool running, RunState state) } =20 static ShutdownCause reset_requested; static ShutdownCause shutdown_requested; static int shutdown_signal; +static int exit_status; static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; static WakeupReason wakeup_reason; @@ -351,10 +352,20 @@ static NotifierList wakeup_notifiers =3D NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); static NotifierList shutdown_notifiers =3D NOTIFIER_LIST_INITIALIZER(shutdown_notifiers); static uint32_t wakeup_reason_mask =3D ~(1 << QEMU_WAKEUP_REASON_NONE); =20 +void qemu_set_exit_status(int status) +{ + exit_status =3D status; +} + +int qemu_get_exit_status(void) +{ + return exit_status; +} + ShutdownCause qemu_shutdown_requested_get(void) { return shutdown_requested; } =20 --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735592; cv=none; d=zohomail.com; s=zohoarc; b=AJVJzBmR2B1+V/CD8E0PENm7KdF9sqmwOgf2oB1rozWi+jUBe8VvRs8VVEFSP/93+3d4D31YVgTRZLEJEFldSyyfkDpYM6Z8idqkCZZPJT/Dux1xW6ML/x7EJYY3OTNrdfW9weC4HBoLZmpGJdpsxZZsPkOVCodE9t0f8PFKhRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735592; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4+cDIWbGM7mzrvRHCeSgPwxY5vp5EgRm8yefmeNSXao=; b=TldxQNRUv5yx0bIVQ9OrlvijyoIyOb0z59XrrySfrPCZThw6xiwfBN3qyPoQMGD8HfLNdZ8qTh2HBUeDb1euedb8L35JOh6AIanSl/XyxUn9XF4YHuqaN6Yp+NpuYZfCFv40ULj85KBqGBX3H+AfM0lzWCMzaMAaAnvchcbdI0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655735592524437.04291340324687; Mon, 20 Jun 2022 07:33:12 -0700 (PDT) Received: from localhost ([::1]:50874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3ISk-000793-QN for importer@patchew.org; Mon, 20 Jun 2022 10:33:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL7-0005eu-Qq for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:17 -0400 Received: from smtpout30.security-mail.net ([85.31.212.36]:12602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL5-0001SH-Mh for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:17 -0400 Received: from localhost (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 185B124BD0D7 for ; Mon, 20 Jun 2022 16:25:13 +0200 (CEST) Received: from fx301 (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 4188424BD0DB; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx301.security-mail.net (Postfix) with ESMTPS id 92B2224BD0CA; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 6EA8A27E04DA; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 5510027E04E7; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X3PTdYkmX7tw; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 38F0327E04DA; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735113; bh=u/lIOm00bNErb9bvAE44lqv3tXUVGVmSakhfbg9cgco=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1rETEw849RCiG+wzD1NMDZ8nlRrKlcAfORcH5My2VMwzBnCuTS3m4gNqYbp7XvrHs QX24/HKacu8T2tD9NCDk2FtIt2VbsZseEOym/rt1GiUOX9U12LxmgI6A/nYkK/VKYx /kFXxygfq844ljxVAGN8No0MZ99NYImAISwF/mUQ= X-Virus-Scanned: E-securemail Secumail-id: DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 5510027E04E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=4+cDIWbGM7mzrvRHCeSgPwxY5vp5EgRm8yefmeNSXao=; h=From:To:Date:Message-Id; b=obDS7aLbQ/eMHD3cYxFyYEqhk5UEqojAk9CcTUddAqb7FGhukEUI0SvfMTUFCN6Mm mgsZ/B09tpE60bQOr5yVSoSz2GFltRtHcEs13XEFWgHHZnUZj+ufFMBXfp2UI4zWxW KjEaJb+L4oRwJUrRlrcfP+Wx66EkkThfF5aKsFZQ= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 2/7] semihosting: add the semihosting_exit_request function Date: Mon, 20 Jun 2022 16:24:21 +0200 Message-Id: <20220620142426.15040-4-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.36; envelope-from=lmichel@kalray.eu; helo=smtpout30.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735594023100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add the semihosting_exit_request function to be used by targets when handling an `exit' semihosted syscall. This function calls gdb_exit to close existing GDB connections, and qemu_system_shutdown_request with the new `guest-semi-exit' exit reason. It sets the QEMU exit status given by the exit syscall parameter. Finally it stops the CPU to prevent further execution, and exit the CPU loop as the syscall caller expects this syscall to not return. This function is meant to be used in place of a raw exit() call when handling semihosted `exit' syscalls. Such a call is not safe because it does not allow other CPU threads to exit properly, leading to e.g. at_exit callbacks being called while other CPUs still run. This can lead to strange bugs, especially in plugins with a registered at_exit function. Signed-off-by: Luc Michel --- qapi/run-state.json | 4 +++- include/semihosting/semihost.h | 4 ++++ semihosting/config.c | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/qapi/run-state.json b/qapi/run-state.json index 6e2162d7b3..a4f08dd32e 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -80,20 +80,22 @@ # @guest-reset: Guest reset request, and command line turns that into # a shutdown # # @guest-panic: Guest panicked, and command line turns that into a shutdown # +# @guest-semi-exit: Guest exit request via a semi-hosted exit syscall +# # @subsystem-reset: Partial guest reset that does not trigger QMP events a= nd # ignores --no-reboot. This is useful for sanitizing # hypercalls on s390 that are used during kexec/kdump/bo= ot # ## { 'enum': 'ShutdownCause', # Beware, shutdown_caused_by_guest() depends on enumeration order 'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset', 'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset', - 'guest-panic', 'subsystem-reset'] } + 'guest-panic', 'guest-semi-exit', 'subsystem-reset'] } =20 ## # @StatusInfo: # # Information about VCPU run state diff --git a/include/semihosting/semihost.h b/include/semihosting/semihost.h index 0c55ade3ac..9a3214a0c8 100644 --- a/include/semihosting/semihost.h +++ b/include/semihosting/semihost.h @@ -54,10 +54,13 @@ static inline const char *semihosting_get_cmdline(void) =20 static inline Chardev *semihosting_get_chardev(void) { return NULL; } +void semihosting_exit_request(int status) +{ +} static inline void qemu_semihosting_console_init(void) { } #else /* !CONFIG_USER_ONLY */ bool semihosting_enabled(void); @@ -65,10 +68,11 @@ SemihostingTarget semihosting_get_target(void); const char *semihosting_get_arg(int i); int semihosting_get_argc(void); const char *semihosting_get_cmdline(void); void semihosting_arg_fallback(const char *file, const char *cmd); Chardev *semihosting_get_chardev(void); +G_NORETURN void semihosting_exit_request(int status); /* for vl.c hooks */ void qemu_semihosting_enable(void); int qemu_semihosting_config_options(const char *opt); void qemu_semihosting_connect_chardevs(void); void qemu_semihosting_console_init(void); diff --git a/semihosting/config.c b/semihosting/config.c index 3afacf54ab..7913c83033 100644 --- a/semihosting/config.c +++ b/semihosting/config.c @@ -22,10 +22,15 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/error-report.h" #include "semihosting/semihost.h" #include "chardev/char.h" +#include "sysemu/sysemu.h" +#include "sysemu/runstate.h" +#include "sysemu/cpus.h" +#include "exec/exec-all.h" +#include "exec/gdbstub.h" =20 QemuOptsList qemu_semihosting_config_opts =3D { .name =3D "semihosting-config", .merge_lists =3D true, .implied_opt_name =3D "enable", @@ -183,5 +188,17 @@ void qemu_semihosting_connect_chardevs(void) exit(1); } semihosting.chardev =3D chr; } } + +void semihosting_exit_request(int status) +{ + gdb_exit(status); + qemu_set_exit_status(status); + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SEMI_EXIT); + cpu_stop_current(); + + current_cpu->exception_index =3D EXCP_HLT; + current_cpu->halted =3D 1; + cpu_loop_exit(current_cpu); +} --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735862; cv=none; d=zohomail.com; s=zohoarc; b=g3gPoVXM2yTRmJAtGim91xoOPE0FvSg/BaSjHmC7O3oKYpctAl1+y0LHmM5fiFpZYQ/6YymZc2EbRkFeQoObuqRtQpNY+OZ47pXuwVBBBpk+CxNjNHylyz1ssij5Mesi+2UVRDJFxwsSuDRPmsalTjEpHe+jVGjeBnQGAycJR4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735862; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=lXnnbnuAZ1izT8Grm0O8SSDegE9ud6CZeXY6J795CTc=; b=Kkq971m/JcURvrYWG3K3mhxRkr/DHJOH1moTfabGjJV5WzkyxnHH3IyghaBUk+ciQBC3Hzhx+IcX1cKdSYA7tm6nwg8FEWbMjgndIGnWFTW7i6WO7NQYLJM8TqIwAVjuGYyfFCosTnBVox1lJfW/THPbsffts19DFSGRiXELXE0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655735862303515.4336026990555; Mon, 20 Jun 2022 07:37:42 -0700 (PDT) Received: from localhost ([::1]:34900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IX6-000700-Hg for importer@patchew.org; Mon, 20 Jun 2022 10:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL8-0005hn-NU for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from smtpout140.security-mail.net ([85.31.212.148]:38379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL5-0001SC-Ms for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from localhost (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 74D1A1B7B1BD for ; Mon, 20 Jun 2022 16:25:12 +0200 (CEST) Received: from fx408 (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 2BD371B7B075; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx408.security-mail.net (Postfix) with ESMTPS id AD76B1B7B194; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 8362427E04D6; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 6D11927E04D9; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BGWdhZ2Bgw3e; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 47E6F27E04B5; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735112; bh=Vi1A8wBnLovlrTEdXogPrB/Mx/jPqmMzAtBqZuqPZn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lWw7ZzpNUTJjYg7BBnU8Ecumf9lnucAb+vs7iV/fBeiZnqTJX38Cdb7X1ljprnJyn OjANauefCHxr0dyGGXj+ZeAwPXm2JVeWGLHOaAnWB0EEMqSygF08NzbSbh5zUK2tSc WJZADNStikFD3gM1KW9ab1hAkKY/nXboaC6Jf6hk= X-Virus-Scanned: E-securemail Secumail-id: <76b9.62b08345.acbad.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 6D11927E04D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=lXnnbnuAZ1izT8Grm0O8SSDegE9ud6CZeXY6J795CTc=; h=From:To:Date:Message-Id; b=NfhTAwoIsCWF+FbsJAoOswBkjqQTaiAnYXw4JDsBLnUrLmfShle8/q//G/iOa7KBc TNgw0ISAjxaCWi4B9QexfQAmXb1g1zLbVR8zvE08OpOaYDCDAk1Qn4C11O4CnF/+qH 92j4q9m4O439DktjbxQWbCokcfnVJ0cgWp4mFlV4= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 3/7] semihosting/arm-compat-semi: use semihosting_exit_request Date: Mon, 20 Jun 2022 16:24:22 +0200 Message-Id: <20220620142426.15040-5-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.148; envelope-from=lmichel@kalray.eu; helo=smtpout140.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735862821100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new semihosting_exit_request instead of a call to exit when handling a semihosted exit syscall. Signed-off-by: Luc Michel --- semihosting/arm-compat-semi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index b6ddaf863a..fad5116f3c 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -1253,12 +1253,11 @@ target_ulong do_common_semihosting(CPUState *cs) * allow the guest to specify the exit status code. * Everything else is considered an error. */ ret =3D (args =3D=3D ADP_Stopped_ApplicationExit) ? 0 : 1; } - gdb_exit(ret); - exit(ret); + semihosting_exit_request(ret); case TARGET_SYS_ELAPSED: elapsed =3D get_clock() - clock_start; if (sizeof(target_ulong) =3D=3D 8) { SET_ARG(0, elapsed); } else { --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735762; cv=none; d=zohomail.com; s=zohoarc; b=BP5Zuxc9E9/xhB28/cKxFGDlxewNMOoYswtOF2msIc0MBSolzrxksTBD6bJWb/sfXfmIG+n87msw7IwuQ4Ev1D+AAFXg0Q7X5OVbwt0Or1kVBIbmdKPikE8wFQWGBWGDi0cTkSYmBVKeaDrD24CYrZjNvk11C5rbJZfmk7jEIYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735762; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=pqO+2rhibMGYfEqFI+8R0ermok68nZKn3dLnJ/SKXcM=; b=lD6noU69mmPo443x6qqveBtXsVdQf/anR4Ad/udiNrdtPwsyLGzsqPISCgK9nR6D99sA2w8CQ2LMl3WXJezFqIEDivza0ClNHTaShDVm30q+5M7Lg603dhDddWetmbeQtTsEPDVR/hJ6o3xNGl3BccPb9pSnYFn+XlkOgQY2WTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655735762206115.6548576165834; Mon, 20 Jun 2022 07:36:02 -0700 (PDT) Received: from localhost ([::1]:57928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IVV-0003RJ-6F for importer@patchew.org; Mon, 20 Jun 2022 10:36:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL9-0005jB-1J for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:19 -0400 Received: from mxout.security-mail.net ([85.31.212.42]:34069) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL6-0001Sd-IT for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 483693D3B108 for ; Mon, 20 Jun 2022 16:25:15 +0200 (CEST) Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 527693D3B11B; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx302.security-mail.net (Postfix) with ESMTPS id C0E003D3B13A; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 9D19E27E04DD; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 793DD27E04D7; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Sb7X1iJqwTtQ; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 5F96D27E04D8; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735115; bh=T95sWA5zxe4fWS53roiVVcEs3JYFnRvZjn+m8zQR/+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=5OeM9K3LjoHF0qEKE55kLdCQZLzU7zVa1XeqoJVsADw7ScbZqD/geut6ZKqL6QMJa +gPAdWbFkoLUY2m2NZXSA1Y7Vx7vcFGR6ZCdgNwvjaxQ2kHOsn0q7eTH5EA7Tugf4y 3C0OPsEyqA1pDreNdo3k316kyD1Fj+VYWGe75QAM= X-Virus-Scanned: E-securemail Secumail-id: <9b0e.62b08345.c01cf.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 793DD27E04D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=pqO+2rhibMGYfEqFI+8R0ermok68nZKn3dLnJ/SKXcM=; h=From:To:Date:Message-Id; b=liwULzCxnJjZ1m2AEasAr6ym0hX31FqIQGDprC66mv+5to/Xfc79fYxMyyPyOlcZl KSk207ua3FciEKpL0ek58m10V1LZaP+LSdAvVvNVkvLrTjDX5G4F1dSXSZI+jIaFL5 w5c/5Ol+WAC4kEHg1XR2hKGyuYlnmZveqIw8q1w4= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 4/7] target/m68k: use semihosting_exit_request on semihosted exit syscall Date: Mon, 20 Jun 2022 16:24:23 +0200 Message-Id: <20220620142426.15040-6-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.42; envelope-from=lmichel@kalray.eu; helo=mxout.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735762893100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new semihosting_exit_request instead of a call to exit when handling a semihosted exit syscall. Signed-off-by: Luc Michel --- target/m68k/m68k-semi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index 37343d47e2..b3de3c6874 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -27,10 +27,11 @@ #else #include "exec/softmmu-semi.h" #include "hw/boards.h" #endif #include "qemu/log.h" +#include "semihosting/semihost.h" =20 #define HOSTED_EXIT 0 #define HOSTED_INIT_SIM 1 #define HOSTED_OPEN 2 #define HOSTED_CLOSE 3 @@ -193,12 +194,11 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) uint32_t result; =20 args =3D env->dregs[1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env->dregs[0]); - exit(env->dregs[0]); + semihosting_exit_request(env->dregs[0]); case HOSTED_OPEN: GET_ARG(0); GET_ARG(1); GET_ARG(2); GET_ARG(3); --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735311; cv=none; d=zohomail.com; s=zohoarc; b=MEr26daQsiNkQXxJ+p5BfOgQRN7I/g+8YtpqXiO5Kt9nJj8WBEewZM3trHA2Uj38ZHDdEbcfb4dd8RCL2klN/zlI54g+31mxKMH+8ScwEX5bAvgH0InfnJdfDk+0UDGMyhMigK5Nxgr3qW5/RtJnIHuESHGho1uCG3XcPcr9Sxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735311; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=noDv+i8A3nUMntl+CKPUJTHI8Qi4mLZXGmf4EwFwLlc=; b=CBtflajuDckH4pD7uMhfqV2+RF048NNoYB7ZP2D1qdhBZ4qP71F6CX/tPTWKZ5ccZlh91EielGxeNeq+SpSSQnIKQpnaau8yFIaegjsBeutdbd5ERHFkw4gidi+My8MFpg0LRT6EfLxKzYaDddOJcBDxBRZhidw2hDatjjeeOtU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165573531143740.60185492008145; Mon, 20 Jun 2022 07:28:31 -0700 (PDT) Received: from localhost ([::1]:43710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IOD-0001py-Fp for importer@patchew.org; Mon, 20 Jun 2022 10:28:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3ILA-0005mm-2y for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:20 -0400 Received: from smtpout140.security-mail.net ([85.31.212.148]:38550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL8-0001TA-DD for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:19 -0400 Received: from localhost (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 28C041B7B1EC for ; Mon, 20 Jun 2022 16:25:17 +0200 (CEST) Received: from fx408 (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 843A11B7AC88; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx408.security-mail.net (Postfix) with ESMTPS id 0B0751B7B1FA; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id A895027E04DA; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 89F8F27E04B5; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3xdtOcjnUa1w; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 698F527E04ED; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735117; bh=XVWQIrqLfbq44o7nhRpky02WJ56xIVfQPbtuiuuMCOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=3tr+0L5YqyNpWLGw5gwpz6I/Ep5raljrQFXIi2VAC7GR1Hu/5e/FA5/JclfqysZEM LR6mSAVHfMtfkSqZdryH5EXuN7ZJE6bB+Ipa7bhD0Dn8ZSyhxtv+a5hvUfoK24ek0Z 9kNFFWZkfvv/QmRg8UoCzRf7CwtnATOBHWx/Uga0= X-Virus-Scanned: E-securemail Secumail-id: <6381.62b08345.c81a6.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 89F8F27E04B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=noDv+i8A3nUMntl+CKPUJTHI8Qi4mLZXGmf4EwFwLlc=; h=From:To:Date:Message-Id; b=EPLXpF+2Cr5+sh8NW1WoYT+4hyJgJtd31f+gySyT9Iwa/aIYhoNw5a1jKfL4OB6td +6AoE6Jsh+uSbUTusF1QqssE5zsUD7FBEp78w8dK+6kFqNJ1Pd3wqnyqTFQsLpJxqP M8v0t7K7/DptRCnjbTDI5m4SXF1+AfnR8z9C9pbE= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 5/7] target/mips: use semihosting_exit_request on semihosted exit syscall Date: Mon, 20 Jun 2022 16:24:24 +0200 Message-Id: <20220620142426.15040-7-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.148; envelope-from=lmichel@kalray.eu; helo=smtpout140.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735313699100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new semihosting_exit_request instead of a call to exit when handling a semihosted exit syscall. Signed-off-by: Luc Michel --- target/mips/tcg/sysemu/mips-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/mips/tcg/sysemu/mips-semi.c b/target/mips/tcg/sysemu/mi= ps-semi.c index b4a383ae90..94be486925 100644 --- a/target/mips/tcg/sysemu/mips-semi.c +++ b/target/mips/tcg/sysemu/mips-semi.c @@ -245,11 +245,11 @@ void helper_do_semihosting(CPUMIPSState *env) char *p, *p2; =20 switch (op) { case UHI_exit: qemu_log("UHI(%d): exit(%d)\n", op, (int)gpr[4]); - exit(gpr[4]); + semihosting_exit_request(gpr[4]); case UHI_open: GET_TARGET_STRING(p, gpr[4]); if (!strcmp("/dev/stdin", p)) { gpr[2] =3D 0; } else if (!strcmp("/dev/stdout", p)) { --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655736055; cv=none; d=zohomail.com; s=zohoarc; b=AR9js9Wb9o5hBK9oj/cWR+SRpb6kdHeu/ZnsPDzjFj3FNcgGuF5z4WdBGu8Iy6zt7FS8wxm5ZEDoTzhQly3mcdMZrl+kl6jMXmkFKiOtMWxBCEoSQqjSXKVSlavPJTOu1qhvAusQb9wYplaloWGu8c62ZXef45eQL8BQh7Omqzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655736055; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Wjr9hLCi68aBpSzJANk0E0vII78adVAOp9ndS9oOkGM=; b=EhrcM1XONIWQg9bdUfkkGomGcSaD9mVGNousYqs8g2jw/e3lJhXu6Ufm8wyhVyxtAzKFFXWn46dOXh0uUQUvtCeRMcdaD8iiV1Dve8lGK96muLICjftBK2o2rku/jv+1ozL2+8c2PsGM5Pm6uDK10ZDBgk645SEDGog5oncaEQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655736055193350.41643281449603; Mon, 20 Jun 2022 07:40:55 -0700 (PDT) Received: from localhost ([::1]:40274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IaE-0002Bl-5Z for importer@patchew.org; Mon, 20 Jun 2022 10:40:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3ILA-0005mX-0t for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:20 -0400 Received: from smtpout30.security-mail.net ([85.31.212.36]:12760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL7-0001Sn-Ep for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:19 -0400 Received: from localhost (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 00AE624BD0F6 for ; Mon, 20 Jun 2022 16:25:16 +0200 (CEST) Received: from fx301 (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 6DAD124BD0E4; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx301.security-mail.net (Postfix) with ESMTPS id DE5E024BD0B4; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id BFEC127E04B5; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id A4C0A27E04D8; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vKe8QagV8cWs; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 7DB8327E04EE; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735116; bh=nsKkUaK2EK93OxjIqiHJcl/VbHmAJCurFQv5cCOIbOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H6uABi9+nqrocT7TCsXVWg4Ndi51hAh5Ra4Aw3d6U90AmFDTHZWTH2D/GKwDVeZvv 1Aj9CRkGAH65lQC3Eo9Wav/jApcXrG4THx94c7GHSRoOef9NIGl9bwHpMDLHJPEIxO dt8kqAFjLStrK/Mm58ZGjhnj3Qh7Jshv9Dh62dGg= X-Virus-Scanned: E-securemail Secumail-id: DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu A4C0A27E04D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=Wjr9hLCi68aBpSzJANk0E0vII78adVAOp9ndS9oOkGM=; h=From:To:Date:Message-Id; b=BNzPpbadGJWFHx9VOASnElCQp/yZIeqbb/yjPJTJxVixCrwXwqWk+YZPcwElLgxR0 8TPWyAMyxAVTjLy6jzppp1yRxKCbsvH/+AsXE1+oJfKPJIa0JUKwCIg0iBn+8xUrqj BGkI8+GK3Zqhzh3xG39dfxGG0htE6mmzYFDGV4jc= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 6/7] target/nios2: use semihosting_exit_request on semihosted exit syscall Date: Mon, 20 Jun 2022 16:24:25 +0200 Message-Id: <20220620142426.15040-8-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.36; envelope-from=lmichel@kalray.eu; helo=smtpout30.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655736056702100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new semihosting_exit_request instead of a call to exit when handling a semihosted exit syscall. Signed-off-by: Luc Michel --- target/nios2/nios2-semi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index ec88474a73..2624ef1539 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -29,10 +29,11 @@ #include "qemu.h" #else #include "exec/softmmu-semi.h" #endif #include "qemu/log.h" +#include "semihosting/semihost.h" =20 #define HOSTED_EXIT 0 #define HOSTED_INIT_SIM 1 #define HOSTED_OPEN 2 #define HOSTED_CLOSE 3 @@ -212,12 +213,11 @@ void do_nios2_semihosting(CPUNios2State *env) =20 nr =3D env->regs[R_ARG0]; args =3D env->regs[R_ARG1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env->regs[R_ARG0]); - exit(env->regs[R_ARG0]); + semihosting_exit_request(env->regs[R_ARG0]); case HOSTED_OPEN: GET_ARG(0); GET_ARG(1); GET_ARG(2); GET_ARG(3); --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735421; cv=none; d=zohomail.com; s=zohoarc; b=h8mpXFkwxoHpkUaIgVSy2LlHrA8lnkqF3WiyRWWUYaihwtp2N1/nqPc2xLsOgeA+wLOjdVJ3PHgpKZt1IVjIDH7Pn1xWywe76ZivYK62813Py0L3h5LJTF8FBvVBKLpv08g1/xRUAz9/r8V20AMURu1SuDaPWhRBh5x0Z0/7MFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735421; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=UFtLVozgBS0dkS8J4BPcVSnxdpIL2DB03Lqlu1GZWG8=; b=Zw7/WxcZetqCI++whImcyKJJJipjjKPh0CN+Fjclekroz6LbE8W/PLGyhhdjfeALRqsC9yYixNQXMbFAwUAtaj26LkO+8T89a9mQFxiQDQ+abxnwYKQo8sr22luILl1p1k9uLbAQd2eYNitKNBK0oTEspEGUbnG4V2zHuRCEVhA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655735421511593.4850877468411; Mon, 20 Jun 2022 07:30:21 -0700 (PDT) Received: from localhost ([::1]:46356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IPz-0003dW-CY for importer@patchew.org; Mon, 20 Jun 2022 10:30:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL8-0005hg-MD for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from smtpout140.security-mail.net ([85.31.212.148]:38461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL6-0001SZ-8c for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:18 -0400 Received: from localhost (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id C51661B7B1DB for ; Mon, 20 Jun 2022 16:25:14 +0200 (CEST) Received: from fx408 (localhost [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 7774C1B7AC12; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx408.security-mail.net (Postfix) with ESMTPS id EBDC91B7B1C3; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id C9F6427E04D6; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id AE0C127E04D7; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fUvX48rpraVI; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 8F66E27E04D9; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735114; bh=GqCxVep9Y9SCs6OZcP2iHKSUNelMjkOtHmZ+WaLY0Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DivXsuVTPkW/5JVFpjY+VXL6HNMCVU5bYl3P36XwmUeo+5F1jnRRpntBQ5JOl/+82 YccsES1jR73IScbxDLEjmvufKRm6lJj7U7h8bGnjU5aFFEiEY2ZP1QI1GtJjflKzo+ r9AsIx8YsyQk19M/jIjAGCg9jYZXMZwiJEYyj+HE= X-Virus-Scanned: E-securemail Secumail-id: <7c74.62b08345.eac1c.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu AE0C127E04D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=UFtLVozgBS0dkS8J4BPcVSnxdpIL2DB03Lqlu1GZWG8=; h=From:To:Date:Message-Id; b=j35s1cGmF3/2swmqRibOUH66+R/22OLVsTE3i61jjfRxIvOGmimzJCO5iLPTdMKAs Cp/8vTNEg+rSQ4YYC2zhj7vqDkJuox2GxOYovYUaqHzPupO67h0XnQVx5+a/0W2RJP 0sMaxJ5OLdFpygK11y+KuDHT9CFCVXuFO+dgVj4M= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Markus Armbruster , Laurent Vivier , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Max Filippov Subject: [PATCH 7/7] target/xtensa: use semihosting_exit_request on semihosted exit syscall Date: Mon, 20 Jun 2022 16:24:26 +0200 Message-Id: <20220620142426.15040-9-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.148; envelope-from=lmichel@kalray.eu; helo=smtpout140.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735424390100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new semihosting_exit_request instead of a call to exit when handling a semihosted exit syscall. Signed-off-by: Luc Michel --- target/xtensa/xtensa-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index fa21b7e11f..0e9a9edc16 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -193,11 +193,11 @@ void HELPER(simcall)(CPUXtensaState *env) CPUState *cs =3D env_cpu(env); uint32_t *regs =3D env->regs; =20 switch (regs[2]) { case TARGET_SYS_exit: - exit(regs[3]); + semihosting_exit_request(regs[3]); break; =20 case TARGET_SYS_read: case TARGET_SYS_write: { --=20 2.17.1 From nobody Wed May 15 18:22:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kalray.eu ARC-Seal: i=1; a=rsa-sha256; t=1655735341; cv=none; d=zohomail.com; s=zohoarc; b=EKE0mPV7agD4H9Ik5UAzXFD5j3HZ6FBh6R6NDtF0snRf8Y39ZXjXfj5JhAgZjLekN21MQzmbBTrgQhWe/0iucVE4FHxnuc7CLpWRYt5w8qTFeZDbzEN8+8MyBTejQmXZbRMN2UOOnc+DMxqk+b+2OSr5q8grmsZX0N++ZufIdDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655735341; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=avs1+E3HdP016j80CtHlqh8NCWuNNIFczqLikOUjyro=; b=DuwCZDelNkZqDqBbxiI3F84m8mPfigxFZKT6W18CUa4c4UWpJg1qjLo3zExkykq1AN7f46OMX9Zn85ONOixOlZtq+I1obdmswcQdit+2Xvaz3uZ4sEQsT91kyNo9cOHtKv+NhOxKOGBZmyYGO7z6Lq9M6yZnuF0q7RqDQuB01bM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655735341051103.13327238341321; Mon, 20 Jun 2022 07:29:01 -0700 (PDT) Received: from localhost ([::1]:44402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3IOh-0002I5-EF for importer@patchew.org; Mon, 20 Jun 2022 10:28:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL7-0005dK-Bk for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:17 -0400 Received: from mxout.security-mail.net ([85.31.212.42]:33824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3IL4-0001Rv-Vx for qemu-devel@nongnu.org; Mon, 20 Jun 2022 10:25:16 -0400 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 65AAB3D3B147 for ; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 10DD93D3B13B; Mon, 20 Jun 2022 16:25:10 +0200 (CEST) Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx302.security-mail.net (Postfix) with ESMTPS id 735353D3B11A; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 4CBEB27E04D6; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 329F227E04D9; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X93LYCqijcKB; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) Received: from ws2101.lin.mbt.kalray.eu (unknown [192.168.36.68]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 185E027E04D6; Mon, 20 Jun 2022 16:25:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1655735110; bh=Z0LiL7ZtsJtzmKHmhv7FK1DekcDf7qm2jfvY9Bmun1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HXOegg5bXUe/aVNYRVa2tZPmkLUpERgupWRfGH+waXI3SlJ8n5rMtwJWyfEBt0vg5 vxSGDlHlirdkefdwmVGd6rxthoYfq4utdHg6UsMrQc7dX0jFU8Ei388cbatg5se7XD 1SQIvDDM5jcZHw6XvvV7nqxo25h6uA01pr2sIHjA= X-Virus-Scanned: E-securemail Secumail-id: <9b0b.62b08345.729f0.0> DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 329F227E04D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1655735109; bh=avs1+E3HdP016j80CtHlqh8NCWuNNIFczqLikOUjyro=; h=From:To:Date:Message-Id; b=E71zSYL1T/dWvdQrddN/jUOv/C2/y1sn5xx2GnGUr73/8cAI9gW85JcyQ1R9m5qzD EjwAV5yTvoNm7BuLa7I77wEFq5l5KHJiybDOekR7QAQkkMngncJRjfcMftrcrcH5aj 1JrT1TH47AEEjguwimbFHJxkeDqEgUyQds2HPa2Y= From: Luc Michel To: qemu-devel@nongnu.org Cc: Luc Michel , Richard Henderson , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PATCH] accel/tcg/cpu-exec: fix precise single-stepping after interrupt Date: Mon, 20 Jun 2022 16:24:19 +0200 Message-Id: <20220620142426.15040-2-lmichel@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220620142426.15040-1-lmichel@kalray.eu> References: <20220620142426.15040-1-lmichel@kalray.eu> X-Virus-Scanned: by Secumail Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.31.212.42; envelope-from=lmichel@kalray.eu; helo=mxout.security-mail.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @kalray.eu) X-ZM-MESSAGEID: 1655735341832100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In some cases, cpu->exit_request can be false after handling the interrupt, leading to another TB being executed instead of returning to the main loop. Fix this by returning true unconditionally when in single-step mode. Fixes: ba3c35d9c4026361fd380b269dc6def9510b7166 Signed-off-by: Luc Michel --- Coming back on this issue I worked on with Richard in 2020. The issue is that when debugging the guest with GDB, the first instruction of the IRQ handler is missed by GDB (it's still executed though). It happened to me again in TCG RR mode (but not in MTTCG). It seems that cpu->exit_request can be false in RR mode when returning from cc->tcg_ops->cpu_exec_interrupt, leading to cpu_handle_interrupt returning false and the next TB being executed, instead of the EXCP_DEBUG being handled. --- accel/tcg/cpu-exec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 8b4cd6c59d..74d7f83f34 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -796,13 +796,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* * After processing the interrupt, ensure an EXCP_DEBUG is * raised when single-stepping so that GDB doesn't miss the * next instruction. */ - cpu->exception_index =3D - (cpu->singlestep_enabled ? EXCP_DEBUG : -1); - *last_tb =3D NULL; + if (unlikely(cpu->singlestep_enabled)) { + cpu->exception_index =3D EXCP_DEBUG; + return true; + } else { + cpu->exception_index =3D -1; + *last_tb =3D NULL; + } } /* The target hook may have updated the 'cpu->interrupt_reques= t'; * reload the 'interrupt_request' value */ interrupt_request =3D cpu->interrupt_request; } --=20 2.17.1