From nobody Tue Feb 10 06:26:37 2026 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1576848300; cv=none; d=zohomail.com; s=zohoarc; b=EhWOCIS9WDol1oof9e+SANsORcTQMbBGjiXPc0dP3wL7aWny6C2eF4o3HWAy6M/DmCIsxbU79Mp5OspnGOSHhCnQCIJhm82aeOtMd/3hRmRjpaiJLK56doK4JtS+PBZK/8x8UfUptoGYOT8GFa2S4NUqraVpM8yOYBYRBIgmWj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576848300; 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; bh=06XcrWFNlcIoXvMNfQG79LGFIvgNsdfFUwprXyUXHHk=; b=d0uF58hKeHiBIVpnW+MrSz0M4s2z5uHsMU39HEk06wy4RHd3Jr4Ur044RzrdH/5NVjcHuTDjeJF9sJ1yQkp0cK/+/UsXqmyulkY/3BvWpFGajNr3zo2MU5W3G3kWXLWp+AJlWyDBExDvOgTfM2F7DKXH5htwtQYRovN1MuFmATQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1576848300617697.9326128775666; Fri, 20 Dec 2019 05:25:00 -0800 (PST) Received: from localhost ([::1]:55404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIH5-0001mQ-4e for importer@patchew.org; Fri, 20 Dec 2019 08:24:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIF8-0007aP-O4 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIF7-0005jj-EP for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:58 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:51079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iiIF6-0005fe-Ta for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:57 -0500 Received: by mail-wm1-x332.google.com with SMTP id a5so8924090wmb.0 for ; Fri, 20 Dec 2019 05:22:56 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x132sm13756583wmg.0.2019.12.20.05.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 05:22:53 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 259591FF92; Fri, 20 Dec 2019 13:22:47 +0000 (GMT) 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=06XcrWFNlcIoXvMNfQG79LGFIvgNsdfFUwprXyUXHHk=; b=BJZ6TIXhZiMuci54F//kmtNJyI9a8Qfq7aXKUYE2HiTdFLJ5SQyge6LGDKSo76ka/I +gyflGd0LltpF4bcNJ4YAAOcliYbDN+JytvtbNFy/MlcfhgQ+g0f+yLYzqwdH7YWinC8 1sqN3hJ6MmWWgP5OKItYdamq8eOq2MhUIttW5x9yJ8QEIwqxGbHOWnj9jJIE/vugj93+ fWW7BqSSYgfu62Ube+TKCr2LnsdICrIUypUOsCX05j9XptDJtn74NKGko+fY5Q500lvd Ar7BP5ZeTtIc5aHdnh18+0Jx6SGWMfT2VVoSc4CNjzAlMFpHfVYtVA5Pl6rAwRODJ1A/ mtjQ== 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=06XcrWFNlcIoXvMNfQG79LGFIvgNsdfFUwprXyUXHHk=; b=KomLBhV0X+AuqZqyjx4Okm9rAPe8Yajq5LdGTRHZ3T8KN1gHauzc9EYZGyC/gH0sn/ dFrMZNuqHMYdZ8oE6Ju5BQRIF5cczVCb2iUAn27LrVzs3/Xvfd/2PbX6oEVayt6nFzR+ lJNtNHpFThyP2X1yRmrS7Hy6V3SPFb4QfJeQonMDT1/gEarxFPWF4DRRjTzsowkpGsnP 61vqvrL2SCDY2jBteEBG80+2TDw/FWd2vB92CTywaZma40Ff+lL8OVe5HaSaNRVuWl3P c9dXAo6aeJhXM0YXxIQkuU+7qeffErfwObRs6mC4Kx3W3xckZ0/SLfnf+YjMCGwiWcAh P2Yw== X-Gm-Message-State: APjAAAWuB3afo2LgWg7Jvk4ac4IoJ6kxfkCBVXlEYnJMBwU5NtJ5gSGN s8aw2AR9w5NWgE7y2x4rZlW6fA== X-Google-Smtp-Source: APXvYqy+imwWgoxl3NSahuYuepF+nQFzo3osPvHv/D3n6Kviu43fMGBRDuHPwFxE7PBMUNXvZNC7FA== X-Received: by 2002:a7b:c001:: with SMTP id c1mr16623663wmb.96.1576848175612; Fri, 20 Dec 2019 05:22:55 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/5] tests/tcg: add user version of dumb-as-bricks semiconsole test Date: Fri, 20 Dec 2019 13:22:46 +0000 Message-Id: <20191220132246.6759-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220132246.6759-1-alex.bennee@linaro.org> References: <20191220132246.6759-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::332 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: Peter Maydell , keithp@keithp.com, "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There are linux-user users of semihosting so we'd better check things work for them as well. Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/arm/semiconsole.c | 47 +++++++++++++++++++++++++++++++++++ tests/tcg/arm/Makefile.target | 7 ++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/tcg/arm/semiconsole.c diff --git a/tests/tcg/arm/semiconsole.c b/tests/tcg/arm/semiconsole.c new file mode 100644 index 00000000000..cc9266b87df --- /dev/null +++ b/tests/tcg/arm/semiconsole.c @@ -0,0 +1,47 @@ +/* + * linux-user semihosting console + * + * Copyright (c) 2019 + * Written by Alex Benn=C3=A9e + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +#define SYS_READC 0x7 + +uintptr_t __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" + : "=3Dr" (t) + : "r" (t), "r" (a0)); +#else + register uintptr_t t asm("x0") =3D type; + register uintptr_t a0 asm("x1") =3D arg0; + asm("hlt 0xf000" + : "=3Dr" (t) + : "r" (t), "r" (a0)); +#endif + + return t; +} + +int main(void) +{ + char c; + + printf("Semihosting Console Test\n"); + printf("hit X to exit:"); + + do { + c =3D __semi_call(SYS_READC, 0); + printf("got '%c'\n", c); + } while (c !=3D 'X'); + + return 0; +} diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 0765f37ff04..997e6e78ed9 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -40,6 +40,13 @@ run-plugin-semihosting-with-%: $(call strip-plugin,$<) 2> $<.err, \ "$< on $(TARGET_NAME) with $*") =20 +ARM_TESTS +=3D semiconsole +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") + +run-semiconsole-with-%: + $(call skip-test, $<, "MANUAL ONLY") + TESTS +=3D $(ARM_TESTS) =20 # On ARM Linux only supports 4k pages --=20 2.20.1