Message ID | 20220607204557.658541-11-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp5543754max; Tue, 7 Jun 2022 14:55:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsVgOMe3MZ3ruKWx1BaJ0NlzpytKzQPFhrn0BYclQrpQkpheabSwAFNWPu8D/AUBRMH1SB X-Received: by 2002:ac8:5943:0:b0:304:b749:fb40 with SMTP id 3-20020ac85943000000b00304b749fb40mr25101597qtz.591.1654638935522; Tue, 07 Jun 2022 14:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654638935; cv=none; d=google.com; s=arc-20160816; b=DUR5eOYxpL8fKcjMPSr0OuhZF0PnlvAL/ebWTK9b31Y1Wqp1PYQD54pJGlUOp8TCOF Oo67o29L8eJ7ZrK8hiVgydq7hwUd3axJoPWzcNSPmbI0tFOIQo/WZ+cLp1qbKT72MlC0 4gI9P0s+riCNSSlHqhrXhfWu4A0ezeFr2XiG1d/YuRAqgyEz8x7ZBRiUdOZLfiD3aa8K vHrhFRlxRzFyoJgIGsQwWEYs94/gBaOQr4VJIXaNJ5X3PWQVBDR+RYXgow0P0eelvo6k ufc/bDCkyWzer2bR5NFcRaM0ovKfCIbRcZKon2ng4wpW0+xOUgeu+D252VCAkkcPfDaJ UxMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=p/ByxHSH2cGT1rev+93zutWkxBbbXGRHAxNMtlkHM9g=; b=EIPkX4Bl83NDaqmIKjjrDwOun4JxecuDwVMHBW9v94Rd/XCjUfRKwYm6V6CXVA2xKF T995VWI6xcvD4qk2Nzr1QDpk7gpPgSN0urbbFnYD8kOEmaqcI+GYLRGUleylCTKnlE22 OAgfkFGNj4MilqwCer8q3BEoP8EeFT893qiLauqG6W/x8Ze/xW/QQotRjUtWLZ7kllN+ WlZIgxGSbzx7AORBIvSedqLm/4Wbvx9+ai3eyfh5tU+82BjPPV7FiVCeGYaImu4kVGaM sfbfg2/RfC5oiq7pB3x4XB6hQhLOMnDqFGxf89O2byX453JViHnVhzPBu+bFC9qo5grV O0rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NHJKBzLD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f23-20020ae9ea17000000b006a5edac52f9si9015120qkg.79.2022.06.07.14.55.35 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jun 2022 14:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NHJKBzLD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1nyhAl-0000HF-4X for patch@linaro.org; Tue, 07 Jun 2022 17:55:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nyg5c-0007Cr-2P for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:46:13 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:43805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nyg5Z-0001K7-LA for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:46:10 -0400 Received: by mail-pl1-x62b.google.com with SMTP id b5so15803937plx.10 for <qemu-devel@nongnu.org>; Tue, 07 Jun 2022 13:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=p/ByxHSH2cGT1rev+93zutWkxBbbXGRHAxNMtlkHM9g=; b=NHJKBzLDihWDNWaYOr2MWXQCAGxmIS/LjaAL+dkaPpmGIAGSSa/wN4m6J0A3EJ+T01 ygxYDgxIBZjtoJFjZH/VdmehIxPNnSar2B0F3uefz/q5YfID0/QEE4kGhyLXZusefuXv J21h+8pYzljyavTwdvC5qloljBsxaDiBMIzCpoqoHXUZo7YfMBWD1UFmzvhn0LTZtMdc +iD0UejCKfzQWAQgWVuLVpdVVmUEUkRXvVazmDWuoQ2WL80B+Q50lhwmEcYsolFja8ow CRTBVdPD68SVFGM0EZdg3lW+sUZPq9emNujXqRoVPWJmml4+Ga6p7h/a4ZOuE7etbnJC dBCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p/ByxHSH2cGT1rev+93zutWkxBbbXGRHAxNMtlkHM9g=; b=s3Qf/y7K3nybcRXPQ2Wy414EbzQtRegiFeF3y1DVeHyJToIWcWRV9jzxd6JzSh/YLp 3t3gl1PNMYGVjcBquIkqYmmxqhoKAF2xtWuWHJlVD8DZvbNHiByoGk9ZnU3AmbSb2Eb8 0xu0mINZjTVRlL+AI9FJqg7vJ9e9qpcx2+iritAz7Vurk681i+umN0CvuezvRw2s0qOM 51t5MltsxpVdyyS+OUKrWx7M22mbkWig+008q4OCvQt+8EXqmlAW31qyeviDKLxMJ70U 91RdLKg0eKsBUvI8BUbu/qm4Tmc0chc1aaGk1NE5wuqpEVCFeW4L3KK+zd4xGT7lGdJm qwLw== X-Gm-Message-State: AOAM5327rnMAZkGmbQNvO3bPa1vEYfcMl3TL2kaWWw1DmNf23bqDGFP4 ikkZXWLEK5YPQ2cNs+4ldXSjiX1LP1PXqg== X-Received: by 2002:a17:903:4049:b0:167:515b:3efa with SMTP id n9-20020a170903404900b00167515b3efamr21558026pla.41.1654634768230; Tue, 07 Jun 2022 13:46:08 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:3cf2:c634:5b19:25f6]) by smtp.gmail.com with ESMTPSA id r6-20020a170902be0600b00162037fbacdsm12971279pls.187.2022.06.07.13.46.07 for <qemu-devel@nongnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 13:46:07 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Subject: [PATCH v4 10/53] semihosting: Adjust error checking in common_semi_cb Date: Tue, 7 Jun 2022 13:45:14 -0700 Message-Id: <20220607204557.658541-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607204557.658541-1-richard.henderson@linaro.org> References: <20220607204557.658541-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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, 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
semihosting cleanup
|
expand
|
Richard Henderson <richard.henderson@linaro.org> writes: > The err parameter is non-zero if and only if an error occured. > Use this instead of ret == -1 for determining if we need to > update the saved errno. > > This fixes the errno setting of SYS_ISTTY, which returns 0 on > error, not -1. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 9d1f13ea8b..88d6bdeaf2 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -290,7 +290,7 @@ static target_ulong common_semi_syscall_len; static void common_semi_cb(CPUState *cs, target_ulong ret, target_ulong err) { - if (ret == (target_ulong)-1) { + if (err) { #ifdef CONFIG_USER_ONLY TaskState *ts = cs->opaque; ts->swi_errno = err;
The err parameter is non-zero if and only if an error occured. Use this instead of ret == -1 for determining if we need to update the saved errno. This fixes the errno setting of SYS_ISTTY, which returns 0 on error, not -1. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- semihosting/arm-compat-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)