From patchwork Thu Oct 5 06:26:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1843818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=BLRNrM71; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S1M6L2vhXz1yqD for ; Thu, 5 Oct 2023 17:27:04 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoHoT-0002l3-Nw; Thu, 05 Oct 2023 02:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoHoR-0002jK-LP for qemu-devel@nongnu.org; Thu, 05 Oct 2023 02:26:19 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoHoO-0003BK-6s for qemu-devel@nongnu.org; Thu, 05 Oct 2023 02:26:17 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-405524e6769so3359045e9.1 for ; Wed, 04 Oct 2023 23:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696487172; x=1697091972; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3/r4VZNrsW0ONaI2SQTSA/+I8zRyGoURM6aYaimAEiQ=; b=BLRNrM71LuXeHPJ1K0jOCkx7gTsCr/aDVsQFZZL3aXSDljE0T+Jy3togtGajo4xRkz ZaxDt7XFi1C9kIRIwqcb5Ayg7pj/cNUDxa5w5yBvBOjyE/uiYIPzFLP66FXT1Uc/ShZe MzhfHsH06flMnwQHbPHeHDCKS4MEEDlDIHmnBcH42VSWtDjx5Ze5qpnwtxm+lHmNwcDB 0D9wv+/N97WmHTghYns+NyK3XN5uqhMXwa2txMICDs0s9Bp5tXDcA19L+5rKC1LHkCob SCr4a5G4NqAOeo3hMxG24BVFrs9EHGcEVsXA0VmE+1sTOuiPyxOUkGadVQy8rRaQx2vg FjiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696487172; x=1697091972; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3/r4VZNrsW0ONaI2SQTSA/+I8zRyGoURM6aYaimAEiQ=; b=HnltF0arj44mp/Gbvlox+PIJw2UllUTq6znmKu0VVmdbZX4vewaN3GcMQgrM3xsOaN ydvw8/JN2KowB/2SNw6BUM9rpCc6o/rsk//Eq/BCqOYFbpxyuFnrq+3ckCVi0K2BDlho kNdIZaQIrvPH9RuxKLzjRKrikmg84/JxvYfzpjvy4wIju+YJKJuenGmunGm9ryUb8odm KvX4V4b6jdqVCb/chx2xH57oVEoamOlM046MSRe0bFcYB7xZA18TQb+QCDo/hfopiJOi EQ2wXVMo0KlJBR7eJbeq9HFYVTxI8aDcNzY8mb04QNzCb8jeyYxBRhhqSPGWIUk5gHU/ 2LKA== X-Gm-Message-State: AOJu0YxlCucNMaRqb+xzdplgqUyrHlhXtB8QnYInIT2cHm8XBNyZQFyx XcPS6a+ZPENvreDp1N7Suwuhnurk6WCY2qgxKrM= X-Google-Smtp-Source: AGHT+IF1buY/zVbLlCcd7dSxagx39mIRqdwnPjahjGR+BBM4G5jH5rjt+l/sBYVy6P2yb+vvZixdig== X-Received: by 2002:a7b:cd06:0:b0:406:80ac:3291 with SMTP id f6-20020a7bcd06000000b0040680ac3291mr1201260wmj.13.1696487172569; Wed, 04 Oct 2023 23:26:12 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-211-120.dsl.sta.abo.bbox.fr. [176.171.211.120]) by smtp.gmail.com with ESMTPSA id bd5-20020a05600c1f0500b004030e8ff964sm3028893wmb.34.2023.10.04.23.26.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 23:26:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PATCH] semihosting/arm-compat: Have TARGET_SYS_EXIT[_EXTENDED] return signed Date: Thu, 5 Oct 2023 08:26:10 +0200 Message-ID: <20231005062610.57351-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Per the "Semihosting for AArch32 and AArch64" spec. v2 (2023Q3) [*]: 6.5 SYS_EXIT (0x18) 6.5.2 Entry (64-bit) On entry, the PARAMETER REGISTER contains a pointer to a two-field argument block: . field 1 The exception type, which is one of the set of reason codes in the above tables. . field 2 A subcode, whose meaning depends on the reason code in field 1. In particular, if field 1 is ADP_Stopped_ApplicationExit then field 2 is an exit status code, as passed to the C standard library exit() function. [...] Having libc exit() is declared as: LIBRARY Standard C Library (libc, -lc) SYNOPSIS void exit(int status); the status is expected to be signed. [*] https://github.com/ARM-software/abi-aa/blob/2023q3-release/semihosting/semihosting.rst#652entry-64-bit Fixes: 7446d35e1d ("target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter block") Signed-off-by: Philippe Mathieu-Daudé Acked-by: Alex Bennée Reviewed-by: Richard Henderson --- Based-on: <20231004120019.93101-1-philmd@linaro.org> --- semihosting/arm-compat-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 0033a1e018..c419d0c33a 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -725,7 +725,7 @@ void do_common_semihosting(CPUState *cs) case TARGET_SYS_EXIT: case TARGET_SYS_EXIT_EXTENDED: { - uint32_t ret; + int ret; if (common_semi_sys_exit_extended(cs, nr)) { /*