From patchwork Tue Sep 10 14:44:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 173528 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp5903630ilq; Tue, 10 Sep 2019 07:49:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkBBjImvfaHGLYSSj1PTCs/hu0DIaCkj1ZhxiIL7V2c4hfl4Ogoy7jZ2wQrFAfHafwV+Fj X-Received: by 2002:ac8:5458:: with SMTP id d24mr28543762qtq.54.1568126974166; Tue, 10 Sep 2019 07:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568126974; cv=none; d=google.com; s=arc-20160816; b=YuDHn3KA2+3USgIkgLx9PGxBEBk8CJ4/FJSA17dT5ydfNgDO7V1oyN5y26P16KYSyi AaJ2aZvI0gbkc20hIivcOeoQCT05agpvVCPNvSFSYyJ25HmJwYXqo5T181ztdhNjFr8d M2toLV/p/4+edal3CBDncc4LyraDV/XB1nTzkvsGi2P7jtwXFS8yyWU+mrYioESjP9wX KpgVzWCCVc7ElmuSw5UF/6fZAS7XwuvsaCZmOrSIdfgQbq5qQzIMHs5fgh4nqdnzjptU MK3eANFBrrHhFESX4U8f/8kD+F4N9lmqz/Fop0rREoPwAXo+7Vge7Ri4hXBBfShTGw3k LedQ== 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:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature; bh=xTjf3hmMk5rbmJgPO5PWGWbjlNL8080SfY7U6rGODTo=; b=w0aXIJFGhM+KcMy5qE0XSjnZKLttGafaUymbDKcOS2AFZF9w1hsV1g/+pMcT6PTE8K ymnp7qCXhJtjQdC8w5sHPwZg1DCeCOAVPRWMcrc6X/j4vsvsoX4DjzNb8k/w2i1fIF+Q SLL7UJQw7MbLfQiyQmXaE4RH9SatgFGWpt8qjSf1vYV07+65xkpGes15SSAr1oqYOIwj DRbsRSjY8xDtDveCMVOpDGE9I0sADh5Xxq+VT2aA5a+gOk2ftCKtdfpoAbUU7wVA5rK2 IK1RzMYcGknXVyZPyNQ5cP/ppcOSccE64YxuPz9EAXVXEGApm85NkXU7yledJAxJ1/tv 7R5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bUqpQ6K5; 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 l25si12649959qvc.124.2019.09.10.07.49.34 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Sep 2019 07:49:34 -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=fail header.i=@linaro.org header.s=google header.b=bUqpQ6K5; 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]:40850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7hSW-00011a-NH for patch@linaro.org; Tue, 10 Sep 2019 10:49:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53878) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7hNi-0005Ku-CW for qemu-devel@nongnu.org; Tue, 10 Sep 2019 10:44:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7hNg-0004xP-UT for qemu-devel@nongnu.org; Tue, 10 Sep 2019 10:44:34 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7hNg-0004wn-Ku for qemu-devel@nongnu.org; Tue, 10 Sep 2019 10:44:32 -0400 Received: by mail-wr1-x42b.google.com with SMTP id y19so20838250wrd.3 for ; Tue, 10 Sep 2019 07:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=xTjf3hmMk5rbmJgPO5PWGWbjlNL8080SfY7U6rGODTo=; b=bUqpQ6K5odLPzxzHikD/LNM/4ehLGw8tz+HBXQ0FQgvStfMhmDKDw6wucYPtuA6b7d zGolzHBXoKBxsjjwtTwGFC8Lvp40WGguivRLGy5FLcETEC3s6It/ln/p9jlpORdW7rSP uTdudX+i8cuT5qcLNC5MYrneALDOYc943GcHHU/6YrHiVlUZFxD7z340hcyvSJtmETE9 IK/NRc5hA0Cl3aJXA/2a6WUPAii3gS/VlLJHyxJOZ500ZJ1vpM0fcKyhBfapeEZjtIPh z1Cu00+Qi0T5cLrzcNfr8f++HZdLToAvDZeBtVfKXBWdR4YFIyIPaHQ6Y1Sh2xqLQHK+ ylGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=xTjf3hmMk5rbmJgPO5PWGWbjlNL8080SfY7U6rGODTo=; b=Gp7AW8ovZ0pNTRwA/BDM/OC+CBRr/3fu5a2entQPRdHcyw7Oox3D/FfAaUhs8U/smb XicULdj1d5X/vJnzE7YkRMAlQRmf8FmNkApS1f0tW1kLYtUX7NUlKHaZLt6m2kyoGl0D Tq8KMTwwsILYW4qAjAlZOif26U1TqpStMwjG4mbGUBAwGmA3X0Nci5pf+jSJiICMV2O4 rpVoWU+Itj3yP/1F3XiiD+dD2QNSrHEhp16sWXr+8JIA9hIbJOQdBRZ54nvQC2ehgKM2 mgXYsWadPup3kaO2rSz9Lfg9hMeQm+1IGJ4Jw4z/PSVnNuhhUQMLMZXchPzgCf/49SLa ilIw== X-Gm-Message-State: APjAAAU3m+6IoWpN2sYU74ZmLn4YNDD3FhW68yYRnVnqkSdh+d028ixP vPNFxJ32Sz2V4MSFZ3uUdZOCZQ== X-Received: by 2002:adf:e2d0:: with SMTP id d16mr15254677wrj.245.1568126671179; Tue, 10 Sep 2019 07:44:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id a192sm5703814wma.1.2019.09.10.07.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 07:44:30 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 15:44:15 +0100 Message-Id: <20190910144428.32597-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 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::42b Subject: [Qemu-devel] [PATCH 00/13] target/arm: Implement semihosting v2.0 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This patchset implements support in QEMU for v2.0 of the Arm semihosting specification: https://developer.arm.com/docs/100863/latest/preface Specifically, v2.0 has: * a mechanism for detection of optional extra features, which works by allowing the guest to open a magic file named ":semihosting-features" and read some feature flags from it * two defined extensions: - STDOUT_STDERR lets the guest separately open stdout and stderr via the ":tt" magic filename (v1.0 only allowed access to stdout) - EXIT_EXTENDED lets A32/T32 guests exit with a specified exit status (otherwise only available to A64 guests). This is something that people have been complaining about for a long time. (Technically some of the things we already support, like having an A64 semihosting interface at all, are also part of the v2.0 spec.) This patchset: * fixes some bugs relating to errnos in some cases * makes semihosting hand out its own filedescriptors rather than just passing out host fd numbers * abstracts out the fd-related semihosting calls so they indirect via a function table based on the type of the fd * adds a new type of fd representing the magic file ":semihosting-features" which is used for feature-detection * implements both of the extensions defined by the v2.0 spec I've tested this by improving my semihosting test suite: https://git.linaro.org/people/peter.maydell/semihosting-tests.git/ (if people have other guest binaries that make much use of semihosting then testing would certainly be welcome.) thanks -- PMM Peter Maydell (13): target/arm/arm-semi: Capture errno in softmmu version of set_swi_errno() target/arm/arm-semi: Always set some kind of errno for failed calls target/arm/arm-semi: Make semihosting code hand out its own file descriptors target/arm/arm-semi: clean up TaskState* usage in non-user-only code target/arm/arm-semi: Factor out implementation of SYS_CLOSE target/arm/arm-semi: Factor out implementation of SYS_WRITE target/arm/arm-semi: Factor out implementation of SYS_READ target/arm/arm-semi: Factor out implementation of SYS_ISTTY target/arm/arm-semi: Factor out implementation of SYS_SEEK target/arm/arm-semi: Factor out implementation of SYS_FLEN target/arm/arm-semi: Implement support for semihosting feature detection target/arm/arm-semi: Implement SH_EXT_STDOUT_STDERR extension target/arm/arm-semi: Implement SH_EXT_EXIT_EXTENDED extension target/arm/arm-semi.c | 613 +++++++++++++++++++++++++++++++++++------- 1 file changed, 513 insertions(+), 100 deletions(-) -- 2.20.1