From patchwork Fri Aug 30 10:20:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1978895 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; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=K40NujNv; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=dW9FSb6Y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WwDgC6D87z1ydy for ; Fri, 30 Aug 2024 20:20:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cg8fDsm+NrvYlqwq0DAf50cY6HX1Vcl8x2kjljbDWF8=; b=K40NujNvETR39j IPnLc0N4LZHoYOEmRU7DCt8876Hj1NcX8DqoeYBJ/Ra9n3exMkIP6BkUGXI7JWO8MCuv3EtQcMSmq zuEWBjlgxBdIwOhSgxXvT2xCLLUs35EaJ70YsSeSDCd4MoUk5rX8mDCEQjAVUFTlSS+0NRI2Jc/XQ JYdKjKOER6xsokD2z4sw9Z+JPKZp9mYTbiHGUtJQx6X7iIYhu66Tk0KRF3DQmTt0X6Uq6kKnyhtVs gvf4KHXzlVBPBeulZGOByxShNPTTpFwckZYosVY9HpC/XhzzF3lhWEOT3P4SMU43BuonJplxhtXvF p/T3cxLNmGO5w6EmFCXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjyju-00000005mI3-2P2O; Fri, 30 Aug 2024 10:20:22 +0000 Received: from out-172.mta1.migadu.com ([2001:41d0:203:375::ac]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjyjr-00000005mEa-0dwL for kvm-riscv@lists.infradead.org; Fri, 30 Aug 2024 10:20:20 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725013215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VNlTMG8ioFiMVQlBQ0UifO06mEmD/pnexSO9HRcQeyg=; b=dW9FSb6YxtLvmnGVUuXvF0btInw1rhr5odcTNKz2FUOp7pJUTJckQ6AMHR4BUdMSuEv/rr 3hL6R8CedsBl0FnbeCCg+kfofSx3l7L9Fjgm6NUfkHwIM4M+KTBdbMiLP/t7V2PJooS1xG lAYv7kXQ6eYfQcjOHcQjphpn0MKsjW4= From: Andrew Jones To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: atishp@rivosinc.com, cade.richard@berkeley.edu, jamestiotio@gmail.com Subject: [kvm-unit-tests PATCH] riscv: Fix argc Date: Fri, 30 Aug 2024 12:20:08 +0200 Message-ID: <20240830102007.2206384-2-andrew.jones@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240830_032019_427956_B08D83E1 X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: __argc is 32 bits so even rv64 should load it with lw, not just rv32. This fixes odd behavior such as getting false when testing argc < 2 even though we know argc should be 1. argc < 2 being false com [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org __argc is 32 bits so even rv64 should load it with lw, not just rv32. This fixes odd behavior such as getting false when testing argc < 2 even though we know argc should be 1. argc < 2 being false comes from the register comparison using the full register width and the upper 32 bits being loaded with junk. Fixes: bd744d465910 ("riscv: Initial port, hello world") Signed-off-by: Andrew Jones --- riscv/cstart.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv/cstart.S b/riscv/cstart.S index d5d8ad253748..a9ac72df4dd2 100644 --- a/riscv/cstart.S +++ b/riscv/cstart.S @@ -93,7 +93,7 @@ start: /* run the test */ la a0, __argc - REG_L a0, 0(a0) + lw a0, 0(a0) la a1, __argv la a2, __environ call main