From patchwork Fri Dec 20 13:22:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 182273 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp531082ilf; Fri, 20 Dec 2019 05:29:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzZC/z3tj0k/pDIcv4FHrgdsp8OeRKyRIBY+hZhmWdt5tPW2irH8WWKM/KRay9fQdXcMfP6 X-Received: by 2002:ac8:7b24:: with SMTP id l4mr11539636qtu.3.1576848549869; Fri, 20 Dec 2019 05:29:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576848549; cv=none; d=google.com; s=arc-20160816; b=Xey3dH+DQ9jNPWe8vDV14oYqkoRA7Fvo9kXVhBoa+iRb6PSd+Kws8Rjk0S3SErXiO8 0HOnrLnWQBaAWe3i1BHYqBmbQ31Vki3FNTHSox3VDCuqhHdIMuW548BKjbdLTHoWSNZZ BlY6oXxyfpGNUz085ZW5jGxkFKoFzFrXLhBzRKeD3YdvzTggclry/TiFGxXopZYcP/yC vNXG5b6db4k7umaoIR8NTYkbC4kgyj6Zv9SImGXHPsqY2Mzx89wH/syzQAuoefaXFeva WJFTl5Fmz28fXpOQgHnYbY+APCBVb3YFT23vFoa3gIwtdU6NiKG8Eql2Xx4s9rUDth6y 0HPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=tWCHuSggB5szQdLA+HidJI7cGodm3lgcmToLZIxmHFk=; b=DGXkdGJ3d+GHBtY/A4egij3I8ixKTtOhSWoWondgVNBWsysaQdk81ul3mO+4soSITz rEWGWKzZAcZOcHqMaGwu47PMTniu/oVhYxk1aKrMQaWP+LzWVUFpgWmSo68ZqvjF+fvj y6FGfXklVESwsKjIFPpyiSyCxDlXwUpSJ0cLq31b+/JjcObKkfFOyvR3bCvYuVyNe/54 ZZuDrELg7A9RcWSRoirC93+uUV+wZ7uv858nYhG7UX9mN9I11oDP3g2J6HCSrRPjDU7j 5Szpb3foGKRrP+6AgjgsDLTj7cWwCW4ovtWWrVKWtPv0ZfuHrai6WxsibbLGs7Gi96Xt fjBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V3ktwIJC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 72si5176279qkk.155.2019.12.20.05.29.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Dec 2019 05:29:09 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=V3ktwIJC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIL7-0007gj-CF for patch@linaro.org; Fri, 20 Dec 2019 08:29:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42995) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIF7-0007Wz-2w for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIF5-0005dH-Hx for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:56 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:46275) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iiIF5-0005Yf-58 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:22:55 -0500 Received: by mail-wr1-x442.google.com with SMTP id z7so9361041wrl.13 for ; Fri, 20 Dec 2019 05:22:55 -0800 (PST) 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=tWCHuSggB5szQdLA+HidJI7cGodm3lgcmToLZIxmHFk=; b=V3ktwIJCtO2n9oJK7KwaYijwukdLxDfE24R88UvTsU3NDWkbMn/So8kJg0gq3Q0fMD /QN4lV9GaKWwd5Z8h5qR3gZ2Qr8xGQVDHRXIMKbomug9YfrwqP+YVy8a1O3plJYTTxZL 9PPf3cfWhxH2VLSq6g171VNZSK7ZzXSD5CNvM60CN4vVc05sLiHgrT7j9ri7GKklgY0p xM4p51wo1VwTpLKxluqGfIrPcVbTYLWuwFjnV2RiOf5ZX+0EFSl/lSfKRKIEHdFpfzso B0rPP95jSvsZDi22kfoQdTXjmEU4K7Fq3uKsMG3F+TVvx4ZwtQoWfPLRg+G4b/6a15JF Obaw== 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=tWCHuSggB5szQdLA+HidJI7cGodm3lgcmToLZIxmHFk=; b=m9sApvWawVKWCo0taqzbW3ceiYBinSZ/Sg0W8++OKj6CyyoJKc28ujagxwybKWGXav wC8YvJmqRWo8gSqC3Tv9GtucKpoENBJ1vY8HMc+U3sl9MQVvKUX6eeIz4XfZ/Mu3JJTK 2Kdn4ipCVszW92pNpBdZ7lzhpabmsxjeO7PgYHDjDsNwUstz/ACACFmz4zltfYo+aN7R 0r05zS7wp4ZqZM9mqQ1m7HngftfGT58u2HLIMwzao0T+nF7Vn5aIHtpe7Y/oHpmS+Jy+ OGpYMqBy6U37mS4nx2hfK8DEqI1B/isPunuJbz+t4EU3z88etpjGsIs9Ubp7CICTQ+W7 659Q== X-Gm-Message-State: APjAAAUq5BxAYcVVmoHKha0bcxyjzbd/9rZFVqXMKxE4zSmy8bqh6LtP UD6RBr2q9Kl9fCAlb1n7nDxVwQ== X-Received: by 2002:a5d:5091:: with SMTP id a17mr15166170wrt.362.1576848173831; Fri, 20 Dec 2019 05:22:53 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n16sm9986070wro.88.2019.12.20.05.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 05:22:47 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0C7811FF91; Fri, 20 Dec 2019 13:22:47 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/5] tests/tcg: add a dumb-as-bricks semihosting console test Date: Fri, 20 Dec 2019 13:22:45 +0000 Message-Id: <20191220132246.6759-5-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: Richard Henderson , keithp@keithp.com, "open list:ARM TCG CPUs" , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't run this during check-tcg as we would need to check stuff is echoed back. However we can still build the binary so people can test it manually. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v8 - actually return the result! --- tests/tcg/aarch64/system/semiconsole.c | 38 +++++++++++++++++++++++ tests/tcg/aarch64/Makefile.softmmu-target | 9 +++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/system/semiconsole.c -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/tests/tcg/aarch64/system/semiconsole.c b/tests/tcg/aarch64/system/semiconsole.c new file mode 100644 index 00000000000..bfe7c9e26b4 --- /dev/null +++ b/tests/tcg/aarch64/system/semiconsole.c @@ -0,0 +1,38 @@ +/* + * Semihosting Console Test + * + * Copyright (c) 2019 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include + +#define SYS_READC 0x7 + +uintptr_t __semi_call(uintptr_t type, uintptr_t arg0) +{ + register uintptr_t t asm("x0") = type; + register uintptr_t a0 asm("x1") = arg0; + asm("hlt 0xf000" + : "=r" (t) + : "r" (t), "r" (a0)); + + return t; +} + +int main(void) +{ + char c; + + ml_printf("Semihosting Console Test\n"); + ml_printf("hit X to exit:"); + + do { + c = __semi_call(SYS_READC, 0); + __sys_outc(c); + } while (c != 'X'); + + return 0; +} diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index 950dbb4bac2..9bdcfd9e7e4 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -31,7 +31,14 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc memory: CFLAGS+=-DCHECK_UNALIGNED=1 # Running -QEMU_OPTS+=-M virt -cpu max -display none -semihosting-config enable=on,target=native,chardev=output -kernel +QEMU_BASE_MACHINE=-M virt -cpu max -display none +QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel + +# console test is manual only +QEMU_SEMIHOST=-chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline +run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel +run-semiconsole: semiconsole + $(call skip-test, $<, "MANUAL ONLY") # Simple Record/Replay Test .PHONY: memory-record