From nobody Tue Feb 10 02:54:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1568388190; cv=none; d=zoho.com; s=zohoarc; b=VR0qeS8hJxyant71AXS+4KtCsq8tHr/NkhPwOj1AYd4ntPRyKaWSqm1/oaR927Ar4V0TTbn5YLeVxA25RbjPi+xi8YL2u1NacRdMQXk/sIUJNkCpioksBiwae077CWCd4y8I4QOMp29FPGs9tTfqbI6oIAtl3NoIpW0k2lNuSME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568388190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=oUGBFAHXbEtLB6rKz0bX2N4c3TgTMSpFBwXxOPwbThM=; b=BqNKUoEBb65c8FI3y5UjiJsw4yXSyZBoi9/6Cn8q5ppGqQ9DakpNcFsAcPYHZUb0NmfZ3cZTrzJIU2+zfP9qo7t1rHsrXxZaEsc21MN7I3NYle1b9nCYnLv1YoeKmox61N/ZvKncSqHorQMSLN81N1BTPrKgDihn8UURTnVCmQ8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568388190741173.86440025001002; Fri, 13 Sep 2019 08:23:10 -0700 (PDT) Received: from localhost ([::1]:45132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8nPh-00031b-3I for importer@patchew.org; Fri, 13 Sep 2019 11:23:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52173) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8nLZ-0007iX-Pi for qemu-devel@nongnu.org; Fri, 13 Sep 2019 11:18:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8nLY-0000MB-Cn for qemu-devel@nongnu.org; Fri, 13 Sep 2019 11:18:53 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:46746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i8nLY-0000LO-5a for qemu-devel@nongnu.org; Fri, 13 Sep 2019 11:18:52 -0400 Received: by mail-wr1-x42e.google.com with SMTP id o18so1267440wrv.13 for ; Fri, 13 Sep 2019 08:18:52 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m2sm1504574wmi.30.2019.09.13.08.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2019 08:18:48 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0017C1FF93; Fri, 13 Sep 2019 16:18:46 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oUGBFAHXbEtLB6rKz0bX2N4c3TgTMSpFBwXxOPwbThM=; b=dDRaEnPgqbmDrdt7FbnpQcCI9+WKLDBCb7Gh9JurDGqmrK7pJ9UD9PB+GiY/oyO23j fjxhqYoRXUa3tO0CYEa/Bz4mAuX2Z63blTQU6fyOgNC+dyY4pCI7Gz6YKP3qyNAZx/tJ oVJ7lqhqYBa5XAoi/2EgX7+/FcgoA+ZW0atZcMYzqtCj2uyhNE7JHAN14ccF0+h9FOi6 4tbic3OpnOOZsrbGiesT0/+ztpyrA7B4B2Zd4Og3BoRJgPu6aIElWmUFykaNdO0cfism esKqUkGpbjLV5DkS5H7NuS35GKiKL0AxOamhT4JHIVbiqarqA+QTcaotvMXTdYoxyvw4 sz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oUGBFAHXbEtLB6rKz0bX2N4c3TgTMSpFBwXxOPwbThM=; b=npylfsmo4Is2f//nt/pC9HBbdMH5+hFJlCLSKeVA5fQbGoo5cPHQXNjIAOt91XbJK8 cXRJ21W4Yn+uRxJnqVk+mcTuUXEh6Ne5HnucntZULVzHGG+IeIYVieCG/K7WmG4+f8Vr +d/JHNdPji647z2JuWjW+zPevXxS5OyxPGndqkAsugEpWH2PDmSng+8xUh7G4s4u4TCH 8Fp6YSWMmlH4rpbVCdXFrcbPqc6XKYOG3V2YyyUgWTIrQsgX2mNgoVn/i/NcUmnU/6zE z91swNrLtmVGUsOj/5gCg/jyPA1AwBsQsCdLVqhEOg82EKQP5XQ2owcGmK0RaIkf0BKL n5Ig== X-Gm-Message-State: APjAAAUpzc60OXZekUDaYiQnBRGb5Aqb1WmNNbs5T+kdaU/NztLZ2xpW b0fNue8SnHYsMkLQRzG0SasbkQ== X-Google-Smtp-Source: APXvYqx4MnzRpeuPlR/9YnDCpz0suKthBB7vhm5lYjuHTMrPXa738rHNg5CkwuhTyb3GUyZaEXdAQA== X-Received: by 2002:adf:de0d:: with SMTP id b13mr10723070wrm.140.1568387930984; Fri, 13 Sep 2019 08:18:50 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 13 Sep 2019 16:18:45 +0100 Message-Id: <20190913151845.12582-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913151845.12582-1-alex.bennee@linaro.org> References: <20190913151845.12582-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PATCH v6 6/6] tests/tcg: add linux-user semihosting smoke test for ARM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We already use semihosting for the system stuff so this is a simple smoke test to ensure we are working OK on linux-user. Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/aarch64/Makefile.target | 5 ++++ tests/tcg/arm/Makefile.target | 5 ++++ tests/tcg/arm/semihosting.c | 45 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/tcg/arm/semihosting.c diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 9758f89f905..509f1afa93d 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -21,4 +21,9 @@ run-fcvt: fcvt AARCH64_TESTS +=3D pauth-1 pauth-2 run-pauth-%: QEMU_OPTS +=3D -cpu max =20 +# Semihosting smoke test for linux-user +AARCH64_TESTS +=3D semihosting +run-semihosting: semihosting + $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + TESTS +=3D $(AARCH64_TESTS) diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 7347d3d0adb..3b7fc9a64be 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -27,6 +27,11 @@ run-fcvt: fcvt $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) =20 +# Semihosting smoke test for linux-user +ARM_TESTS +=3D semihosting +run-semihosting: semihosting + $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") + TESTS +=3D $(ARM_TESTS) =20 # On ARM Linux only supports 4k pages diff --git a/tests/tcg/arm/semihosting.c b/tests/tcg/arm/semihosting.c new file mode 100644 index 00000000000..09c89cb481a --- /dev/null +++ b/tests/tcg/arm/semihosting.c @@ -0,0 +1,45 @@ +/* + * linux-user semihosting checks + * + * Copyright (c) 2019 + * Written by Alex Benn=C3=A9e + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include + +#define SYS_WRITE0 0x04 +#define SYS_REPORTEXC 0x18 + +void __semi_call(uintptr_t type, uintptr_t arg0) +{ +#if defined(__arm__) + register uintptr_t t asm("r0") =3D type; + register uintptr_t a0 asm("r1") =3D arg0; + asm("svc 0xab" + : /* no return */ + : "r" (t), "r" (a0)); +#else + register uintptr_t t asm("x0") =3D type; + register uintptr_t a0 asm("x1") =3D arg0; + asm("hlt 0xf000" + : /* no return */ + : "r" (t), "r" (a0)); +#endif +} + +int main(int argc, char *argv[argc]) +{ +#if defined(__arm__) + uintptr_t exit_code =3D 0x20026; +#else + uintptr_t exit_block[2] =3D {0x20026, 0}; + uintptr_t exit_code =3D (uintptr_t) &exit_block; +#endif + + __semi_call(SYS_WRITE0, (uintptr_t) "Hello World"); + __semi_call(SYS_REPORTEXC, exit_code); + /* if we get here we failed */ + return -1; +} --=20 2.20.1