From patchwork Thu Nov 15 22:34:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998570 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="VPRYLPcM"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ExPAfU4G"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx4t6fHWz9s3q for ; Fri, 16 Nov 2018 09:34:54 +1100 (AEDT) Received: from localhost ([::1]:41069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDs-0005I3-FR for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:34:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQD9-0005Fo-5Y for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQD6-0003Ov-0w for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:07 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:36324) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQD5-0003O5-PX; Thu, 15 Nov 2018 17:34:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321244; x=1573857244; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=PwZxPJD9UejMCEKVCOMM+JvEncUmV7a5caZhNGTj4fM=; b=VPRYLPcM6Vn3iNiNcvH03LXHAWDNYYZudAc7cVtkP3h82HsPoM7ke2YN 1cwNXF1P8fnb5RnKZToLsNnOnil99aD8fieVKFXAa5o0OBvU+xoE9cJlA 968+7mv+tA3R1JVVeImJIfICta27OhD5hOqf7O7U3GIzSmMoLlMIJkxZw j1Wnq424ZcDnefXN/tF2jDKFHO9GLSiTkMnLf+nRGr81Id5fVhidgzYML UjXJd/anIacdhG571GC7qi7NA+qao78PVO4nqOJxu9BuoSTKbR+yTo2yF XlOBaqlLsF65m6vFlSLs0PBgG+uO9NjElEPiNDm6clW4LhJQG/5RFEQlA w==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="96079232" Received: from mail-cys01nam02lp0056.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.56]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:03 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C33DIgrfUEXmtA63NtUWu+YJX1vfvn8OOwWolmktfzQ=; b=ExPAfU4GN+dH01gskRQjXUE2qjs4Gp+bSSBTWCpKH0QDoeK0HWQVCwzRKbkC6PyVBS+tl6gmC/L873n97LuB1d+qy+i7pRtsOQujLrUhsI7XSLac6znUfOJe45+XEmUIKtn23pCBQvkS4vsiCcyEQuhbQhr/00YYsOPb/EYFRiw= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0673.namprd04.prod.outlook.com (10.172.166.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 22:34:00 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:00 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 01/23] elf.h: Add the RISCV ELF magic numbers Thread-Index: AQHUfTNObs31E0Jdnkef9iAuMiaJ+w== Date: Thu, 15 Nov 2018 22:34:00 +0000 Message-ID: <35d983dbea36b3d8af70cc0055fc4136b476ace5.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR11CA0043.namprd11.prod.outlook.com (2603:10b6:a03:80::20) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0673; 6:9UeATVvNhxdFjlwAoiaNRKRyVTwYRtiNTrQKSpesLi3Q+91T9d42CSSniWtNVaiR8Rq3KHrUGVq83M/+gInSy7g8KPf+vUa+S4VHO6Px2z+WQN52LIH6lPwNakUk7CMUod3JGVP0Gx1IkCeQ4yHpRord/jYaxeMD82h/B8AZlsIh0Stre26N24pM/hmdxxX7OyVaMGd7OXqyY/hyBTX44x0QeeXhzDpb/xnbWYXsEO/s2Wss/H/vArDmSJmBi3HfhZFrFG1yiFSaIWVGIAZ6ga3NUeADkbg8UhgezTgSU/ub8i6N3CdbUe83Gt2U8Bj5TrPJRTylFGSLfamiQ/V3hnkafC3yYs0klznndAQ+ehay+uI/9f7Sp7kQWlYSAPacFMmoHgcTX7+2lC7jNvMQNNcIspaMXQN1XLMBA9ajxLMrxDpZmdG9R4f98a4xufmzPsAO+zBFjhtfX0GHK91VbA==; 5:OztzPSp9nq5AfFmjCxpjwWaNu1gOCdzV6MNno91lf0N2Cl6ddhtJZlAOwIstOop7laIolThMKjbabKZfcqufK1xdvwUNaeFdha0rgOQweF2cqDoiuXYYMRkYGA6TeUSmTf0ontztvpRd10gGlt3gsFagFwK5baTYZMuuGgi+1PI=; 7:0k2/Ybr0gNOw4oWvD4/5zh5plkqR8RD9LJldgECiTkeCAcCh3qsFT7vJrorHuhwPsGXDfOcll1UsrbxtX9YUpqrBsvaThZknScocWl3s2FUFsRw4Jml1YM/s+EuVlkJygRT/YHZ8ZpnWZvZ8RQDgMQ== x-ms-office365-filtering-correlation-id: cc002423-41de-4ac6-7e10-08d64b4a706d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0673; x-ms-traffictypediagnostic: MWHPR04MB0673: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0673; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0673; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(66066001)(217873002)(256004)(81166006)(71200400001)(71190400001)(8676002)(81156014)(316002)(2501003)(305945005)(7736002)(50226002)(110136005)(54906003)(2900100001)(44832011)(486006)(6486002)(8936002)(11346002)(446003)(2906002)(97736004)(476003)(2616005)(6116002)(3846002)(39060400002)(53936002)(4326008)(386003)(52116002)(76176011)(6506007)(26005)(102836004)(478600001)(186003)(72206003)(105586002)(106356001)(99286004)(6512007)(5660300001)(68736007)(118296001)(25786009)(575784001)(86362001)(36756003)(14454004)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0673; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: /MpvLB1XBPfaJMQmkNNbPA30UavG9KEY/ent3sAAJZa3iarE8AIdzq4g0C/JSEUarNsT44N+leXxCS6auso349PUq+04Bo7mawrwktylj/+ex7+soSCVktBkg2ZjHuTT3/i1bI6f5s7lkWlpCQ4Ryb/+mcAnEWhgOfrzWavFf412GOlKoYAhnSx9is31biOIr7wonUJe3LV/Ir+IDrF5cm3N9dpXtjGqcLH634Y2Z0ixYhmQUIm4dlCLGPSwoZfQJPvGnMYG/0/v3NsLTXUj800iM1ptow96NXPDeFoL7bbWxyA+oc/BVwKCxU48bDcigJeTJ1uxmMaPQtVYL4kFNgxFj5yvk+NwmInKyknvwYU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc002423-41de-4ac6-7e10-08d64b4a706d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:00.8633 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0673 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.154.45 Subject: [Qemu-devel] [RFC v1 01/23] elf.h: Add the RISCV ELF magic numbers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- include/elf.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/include/elf.h b/include/elf.h index c151164b63..0ac7911b7b 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1338,6 +1338,61 @@ typedef struct { #define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ #define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ +/* RISC-V relocations. */ +#define R_RISCV_NONE 0 +#define R_RISCV_32 1 +#define R_RISCV_64 2 +#define R_RISCV_RELATIVE 3 +#define R_RISCV_COPY 4 +#define R_RISCV_JUMP_SLOT 5 +#define R_RISCV_TLS_DTPMOD32 6 +#define R_RISCV_TLS_DTPMOD64 7 +#define R_RISCV_TLS_DTPREL32 8 +#define R_RISCV_TLS_DTPREL64 9 +#define R_RISCV_TLS_TPREL32 10 +#define R_RISCV_TLS_TPREL64 11 +#define R_RISCV_BRANCH 16 +#define R_RISCV_JAL 17 +#define R_RISCV_CALL 18 +#define R_RISCV_CALL_PLT 19 +#define R_RISCV_GOT_HI20 20 +#define R_RISCV_TLS_GOT_HI20 21 +#define R_RISCV_TLS_GD_HI20 22 +#define R_RISCV_PCREL_HI20 23 +#define R_RISCV_PCREL_LO12_I 24 +#define R_RISCV_PCREL_LO12_S 25 +#define R_RISCV_HI20 26 +#define R_RISCV_LO12_I 27 +#define R_RISCV_LO12_S 28 +#define R_RISCV_TPREL_HI20 29 +#define R_RISCV_TPREL_LO12_I 30 +#define R_RISCV_TPREL_LO12_S 31 +#define R_RISCV_TPREL_ADD 32 +#define R_RISCV_ADD8 33 +#define R_RISCV_ADD16 34 +#define R_RISCV_ADD32 35 +#define R_RISCV_ADD64 36 +#define R_RISCV_SUB8 37 +#define R_RISCV_SUB16 38 +#define R_RISCV_SUB32 39 +#define R_RISCV_SUB64 40 +#define R_RISCV_GNU_VTINHERIT 41 +#define R_RISCV_GNU_VTENTRY 42 +#define R_RISCV_ALIGN 43 +#define R_RISCV_RVC_BRANCH 44 +#define R_RISCV_RVC_JUMP 45 +#define R_RISCV_RVC_LUI 46 +#define R_RISCV_GPREL_I 47 +#define R_RISCV_GPREL_S 48 +#define R_RISCV_TPREL_I 49 +#define R_RISCV_TPREL_S 50 +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 + typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; From patchwork Thu Nov 15 22:34:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="T6iPXgXH"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="MDsb3BLs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx8V5C3xz9s3Z for ; Fri, 16 Nov 2018 09:38:02 +1100 (AEDT) Received: from localhost ([::1]:41092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQGu-0007oE-6u for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:38:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDI-0005KH-Gw for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDF-0003T9-CY for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:16 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50484) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDF-0003Si-2o; Thu, 15 Nov 2018 17:34:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321253; x=1573857253; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=EtlsQTNgEZS/hhMmB0E8Eq7wOPJ44rAOJmH814d4WFo=; b=T6iPXgXHxWAcPYexsIJLqgUHm9Xh6Z7EwNmUVDu5QMoloyOWxTUA2s5U 1LBE0o7oxlkHeNKbmpttYk+quFqi1wLdVeO7TzOj7mSTJ0KsqlCsE4aCv cqpGxD7xKqaOlQ21BB4maEqGMDRwy5zKflQRi78Yqjhy85l9iMKUyJEw+ P3odNhcE9R1qH+NXDotI4qybAGvRSoFaTm6zNMpAfpLKDzZEoppIwGRCc Cs/gRSzhGZaSBZCseVoE74MtRZAehaFjd/8Uvx408Nj5d2Km0vxoLUuT1 yqWswcO6H79ENsJ9lGmdW1Me7zErZEKbuw9MNHd1FLY6yli90DvMHyuEr A==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523271" Received: from mail-bn3nam04lp0112.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([216.32.180.112]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:11 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EtlsQTNgEZS/hhMmB0E8Eq7wOPJ44rAOJmH814d4WFo=; b=MDsb3BLsa1LvQZ/AIwAmWs8+vmSFu/TU9UhCHoOXTqluPa5ddHmGNgesPJZD2ufnig7isqIlPp2tOGGsDzFKYI53TTeWjRlsbraW+DRo0Vey+ZGZNrNulrWrqiQCZEBzXUiNfvAdOis9fiQ74lLyy1KHgkuxxdKyHE2mx3X1vnU= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0673.namprd04.prod.outlook.com (10.172.166.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 22:34:10 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:10 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 02/23] linux-user: Add host dependency for RISC-V 32-bit Thread-Index: AQHUfTNT1K9MbvF2EU+5L2mhsvhhQg== Date: Thu, 15 Nov 2018 22:34:10 +0000 Message-ID: <765fe28a07d96b0fbd642e5d5f01c123118db4f4.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR11CA0060.namprd11.prod.outlook.com (2603:10b6:a03:80::37) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0673; 6:RQJrozP2qzyLSdntUAEUPCLj923Me8+AD7AnByb3JwSXri9SSs6j8VsAKmgAgbINTezkTQ+m1l9sBuoRLrqHqZ/bllextQHBaasFP2JwR8zSK6DGSM6K8znRRQtqfktg7u9D1IP+iM0YDK/37uVO3gsPaljaTEFNUbZoYEUfwkARShgEw+kdsqPTy5l1WgZ8dnqUcuwaFP6mq/GMbRdz1416eInvx+8cpD0hHKbmku6tkXzGcFo0ULS4UQsO0BH/Evd3Vu7INZGRnGRzI3D+M9pcgxiWo7uVuBhR7uIeNGhsS2r8DIJC1FTys8wfwp/sJ0OBnWLV5JlPuqTS6o5abJUMMG55PfRAGqeJqLeYv+i31G7pbjOlpA+Dt8kaukZ6+yVewKZ394CO46mzF8psp04DtLdBC4Jc2K2DFiUzAmWxcTUyH3RwSZCrMzBRWSwYkRes+z+bKu3ysrzDAbLQog==; 5:4VCWkGybLx6UyCY5Phnbt4/Bj5vzIPc6XIo5g2OPTm4dcedv4jhU8DWKb4xxrq25XTINXdby5Cmlf+lud39FJFaW7KwGNRfNaX7As4aBaNCsouKbYkahqP41/0okcSq02pn7ang53vwQPbyRvFDvGJznUQRyFBydhdwvxwn/Hlk=; 7:ljoVmiK623QEZDxDfUmwkQbJANVqdxYRlWs51xo2mBOeru/3Gr7aRZiMjY7Om5wheNnazeKxuBG/N1SrqidCdNBsxruTLNSDfqXbApPcYiCS/QTqMfGEwQ2wWH4SGO4R5vTsYFaASSUr4rX825TF+A== x-ms-office365-filtering-correlation-id: 1ef21884-57b8-4e8c-34b9-08d64b4a7607 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0673; x-ms-traffictypediagnostic: MWHPR04MB0673: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0673; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0673; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(66066001)(256004)(81166006)(71200400001)(71190400001)(8676002)(81156014)(316002)(2501003)(305945005)(7736002)(50226002)(110136005)(54906003)(2900100001)(44832011)(486006)(6486002)(8936002)(11346002)(446003)(2906002)(97736004)(476003)(2616005)(6116002)(3846002)(39060400002)(53936002)(4326008)(386003)(52116002)(76176011)(6506007)(26005)(102836004)(478600001)(186003)(72206003)(105586002)(106356001)(99286004)(6512007)(5660300001)(68736007)(118296001)(25786009)(86362001)(36756003)(14454004)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0673; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: WEnivex60YOLjceJMI5kcylmVNRdVhRhMIKgTvJg1LhNMBSIwcKyLWyroBo9m5r1nHO9qzfceoyM4Zx2wDhG0NPvG1x7iSHOO3Dzr3gx/WbfP+OmDA2mxgIYmL4vYNj1L8l/aT5WtwGddIvvmQVfurITNc/HNPs2B5cdJ9p1XvhTXXBEJt88lztEd2/ARNjw/bN++fHbd9BrfVISQngc2SRC60h6SJ1prASx5DCI+ql6XgYU2LGm+LJgt3ZppefjdIgk2ThgTkgKoh2g3W6xTOCIfJ8Y2EvBK01MrKfFa0gKMZ0/ylvq0JekukFng2k+H1U0foz3rMj45v8/4SY6SD66Vl0lnKsizuV8JgMmOgE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ef21884-57b8-4e8c-34b9-08d64b4a7607 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:10.3053 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0673 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 02/23] linux-user: Add host dependency for RISC-V 32-bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson Reviewed-by: Richard Henderson --- linux-user/host/riscv32/hostdep.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 linux-user/host/riscv32/hostdep.h diff --git a/linux-user/host/riscv32/hostdep.h b/linux-user/host/riscv32/hostdep.h new file mode 100644 index 0000000000..adf9edbf2d --- /dev/null +++ b/linux-user/host/riscv32/hostdep.h @@ -0,0 +1,11 @@ +/* + * hostdep.h : things which are dependent on the host architecture + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef RISCV32_HOSTDEP_H +#define RISCV32_HOSTDEP_H + +#endif From patchwork Thu Nov 15 22:34:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="YlIujyCK"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="VtL+QSA4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx8C0wJ8z9s3Z for ; Fri, 16 Nov 2018 09:37:47 +1100 (AEDT) Received: from localhost ([::1]:41088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQGd-0007U8-T3 for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:37:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDd-0005Xo-Rn for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDY-0003YI-Cx for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:35 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:39993) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDU-0003Vd-1P; Thu, 15 Nov 2018 17:34:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321267; x=1573857267; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+Q/68XbiRgy5O8qXW4yXg0CB7h8NSHcOkAcnF2zuJAo=; b=YlIujyCK5U5FZPWyTg98TPSKeQc7iPfPl/SzFp174yWMbOgIDVUCBjFA BnzeuaD1pvsp0VLXdHcvFtmnjizm4Adntegs26rXHDrd0jBksQFzJ40hP DZWKSPn3CDkpiJ6VZLbSz8HtX1SHO5JC42Z3/cWLhEZvbJxBU/sy5PltS qC6HvgessqvwB0FVp105bQSds2eqnP28Jczd6agN4z0D6uxAxhkutSEfC wnUsh3Ev26L0/aU/8aYsyHwIwGW3AHFQub5olKaPN9lmuJcSofVzPS0Db CpxJW9P7QNvfnBrUomcOSO/lt+NTCoO4DsXJ6YzIX7t1xNkJelolwQK9z Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884174" Received: from mail-cys01nam02lp0054.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.54]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:20 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+Q/68XbiRgy5O8qXW4yXg0CB7h8NSHcOkAcnF2zuJAo=; b=VtL+QSA4q6uFvGyjPVI5E3H1kcZw1RNuUwjBTKuu9BOkSSPGsP9yAcG3THeA9WqMHNLVI725CidpsaOiwITHXc3uXt6FwZBwe9HvXER2J6FNEr4ghLadHExGbo72454FoCEE+gFB47JL+Af/OjwA+rP0dmuWH0U27lOBsTZdQkw= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0673.namprd04.prod.outlook.com (10.172.166.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 22:34:19 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:19 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 03/23] linux-user: Add host dependency for RISC-V 64-bit Thread-Index: AQHUfTNZ9CJCtfJYR0G9g6gknVs0VQ== Date: Thu, 15 Nov 2018 22:34:19 +0000 Message-ID: <0f62035eb86da24f03b9980f086d6df268105986.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR11CA0047.namprd11.prod.outlook.com (2603:10b6:a03:80::24) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0673; 6:GydPR02Q3BdsaePn9oeDeODTPwF6meLpxX6jk9x7U0eB4XOF8eVPF/fwmjz81Slkf+BdqJgnr8iyl78tWFYUF5KDkOtSr9Ia5N4vd1X+TJ3KUohR6mOCJThZStIGnmX/zB5INio03pJk5Qv3p77naJUusS27vfUwLzAX3slVS5D1//EZ1vRMgTZTP2uW7wBJZTmHQ/A1/uY1wStRymh3Bi/+0RgSLcFaG47Hwbn+PRcPsJI2sp4ZJpKX4smbZHVJjh8WGNX7s6ydp7Q80aGTu+DEr8lS3261456eCwulMkjkDnKBt/ZJveDHS0o5slCYnKEeJF7pmcuASGynoEajseolPT6Z4L4Hb9kSUN7LGowrgQcU+QII2w9TyCTYxQ2dMfQhBFYu+zdjG6qmEPOpYz0vF2efvfpX/OPIl0OJPRnXdOrJoMYuMGB2tkUbsooOIKIe04JBo3T4HmQ2EmKxHQ==; 5:GP04Tw1ttNGXD65X1GHBoQrOkoeWaRh8PDqCZ/gEBd6b2uSs2g0Leobgg6b0Xoo6dd1MCrpmN0RWLr4c9z18MKMxhhLGpIwG3HzOtSYc1/OBJjnWDFkfbngTqwbxq5ggawPdFMo53WDRYuPO7+jOtXgGwOEz3tr2bE2RMuyN4K0=; 7:HaUP21VoUkULpb8AODSkOZwGgXsS53/pVNUDQqEetJHFhdATGfTTxf+ARSAKYJnQ+3xp2bdatQq3jB+TZZobJHFabTms7LD9K5xoYW0kvC2fNPNZwjdSEJ0Hwq7r4tz410PYBcn7IZWsnH/JEBzj9A== x-ms-office365-filtering-correlation-id: 91cd3c22-80b0-4881-6b7c-08d64b4a7b7c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0673; x-ms-traffictypediagnostic: MWHPR04MB0673: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0673; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0673; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(66066001)(256004)(81166006)(71200400001)(71190400001)(8676002)(81156014)(316002)(2501003)(305945005)(7736002)(50226002)(110136005)(54906003)(2900100001)(44832011)(486006)(6486002)(8936002)(11346002)(446003)(2906002)(97736004)(476003)(2616005)(6116002)(3846002)(39060400002)(53936002)(4326008)(386003)(52116002)(76176011)(6506007)(26005)(102836004)(478600001)(186003)(72206003)(105586002)(106356001)(99286004)(6512007)(5660300001)(68736007)(118296001)(25786009)(86362001)(36756003)(14454004)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0673; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: fbi3jVGav634sL0+kMmcM4uOceTal+pznZ2rLuQhoR+TCxd77vKa4fwNY1+pzdYTbng4d4YFJulErFWJw0Hfk7Tx72FnjzQqTnYSV8Qo6p5JPayDZQpmizWH+E6wShuCVqKc/sy+mHWfgv1HDO/hs2zqIYk/7n3VNLLp+ciBGeeOmAe+aIPht5HeBXlDXxc3SMz+musfaKowObT0vDq9WQo0owbqSN7PDV3h8lcum2fdjBU9uqYpotHA5q58SiYV70VbXKJtNXRLDddjRfXMdNgPLCJ1sZvJgyjOw+cRYx5vnSs5txHAOzTaD7B4gom/8dCMb7qMwka+62uE1oDefKQ5H1ynrHyzpUNGOb5b4zs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91cd3c22-80b0-4881-6b7c-08d64b4a7b7c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:19.4851 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0673 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 03/23] linux-user: Add host dependency for RISC-V 64-bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- linux-user/host/riscv64/hostdep.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 linux-user/host/riscv64/hostdep.h diff --git a/linux-user/host/riscv64/hostdep.h b/linux-user/host/riscv64/hostdep.h new file mode 100644 index 0000000000..28467ba00b --- /dev/null +++ b/linux-user/host/riscv64/hostdep.h @@ -0,0 +1,11 @@ +/* + * hostdep.h : things which are dependent on the host architecture + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef RISCV64_HOSTDEP_H +#define RISCV64_HOSTDEP_H + +#endif From patchwork Thu Nov 15 22:34:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="J/NNBDn/"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="D+qWNO0r"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx9n6J6sz9s9G for ; Fri, 16 Nov 2018 09:39:09 +1100 (AEDT) Received: from localhost ([::1]:41096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQHz-0000Ow-Ct for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:39:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDj-0005cW-L8 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDg-0003b8-FY for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:43 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:40007) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDb-0003Xo-St; Thu, 15 Nov 2018 17:34:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321275; x=1573857275; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=8XuyCNM4UeQJHsY2OiKRcmAQLJvDhaz/9/Mfz8Md8rk=; b=J/NNBDn/w+ny86vGAtFcMvyRZQWfou1N03i73GkraPT7xbXOpmnoKYsG ADHFyW/0whuebhwMBAa+DCn7HQh7Q0jLWG6yVsQVORHsVKX2rCNquFVIx Z7K7xt/8C/56NKW+RXIwBApSUYMZtQNxk9tGz1olrb9Qbq5eP2IvB43HE gxfishRHfLooJy1R45OOUHgxTWM2efh6YBEwHm6TwkL+p9cKYn+OOh/0j SvS8p0Vmr0GXPNJWloJGFIo44HQaJQ0oiX6Ac9HQBb4K9zvtWFpRTKw4O LqkZSBylhX91owTKth7W4qAASvMd6Vd5LXnblrlUDHX4v1gC5YJxQHu0g g==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884208" Received: from mail-sn1nam02lp0018.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.18]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:29 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8XuyCNM4UeQJHsY2OiKRcmAQLJvDhaz/9/Mfz8Md8rk=; b=D+qWNO0rqEHA2RkQCyqaC65E9+VZjxwIF9IOXVL+SFgKgJ/DSM8GoJT+Fdg9IHuxj3NBnaN6Xw6z7Fb7D4QT9d7vYQ8lJ9P5drJoHvYdzukqN4FpDEcNFA9Ue29fqgULX5nrFtxLavy49yTfVQTbA9+o5hOk4OSInygui+AiaO8= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0910.namprd04.prod.outlook.com (10.174.174.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.25; Thu, 15 Nov 2018 22:34:28 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:28 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 04/23] exec: Add RISC-V GCC poison macro Thread-Index: AQHUfTNeup70yBQNgkC919p+jgPyyA== Date: Thu, 15 Nov 2018 22:34:28 +0000 Message-ID: <970c4b6a1b54c1976c8d36261f18678072dc1c54.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR11CA0048.namprd11.prod.outlook.com (2603:10b6:a03:80::25) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0910; 6:Lbcxk9Jj25NodGYzKona2eI7lRRocjhTR7LbcK/S82IO//1S1tHEyD/e/gq1RwyTYCGZy+EoVU3QdnuN8pAlbD5IaKUr5VjFoFS7LrbuXbxXiMtKHN1InZRKofbQ7BStQoDg4maRs+KWuF5O6xDproqpzDVskMlGJoZ9mLPzrM0qJo+duookzSBK5OEftljU5yT7aL9Of3iR3GlghTKCJaICoYOOtgSTb8BVF+UMI9kuQGnm8InjwmLjci1YMzVdRrDqoHNV9QHnR1qlmHYZEZbMpGlAXXjb61cwW2Y3pfhifaZUahS/17+HekhKo8wVO3cC0Euwi1afPL1bs9AQTdn5jOLyRzpprdriNF9ektW96xxh03WDGVjltxGO7X2+lB8RefMKR0l1L9hPeuCLEOIVCfKCbg7hupvA2Es2ypYYvM5juFnsLxVHSL7aSzwPtGC8FXwaSffg5iYgPLna9w==; 5:7f0dvRmyXFG2ghtnYAROWP7RR7ydr/QIKLCtdbfXO2qhwF03RVbIMOfy2xSlm2svry+0qjBf51Bc9z5HPeJeN4JsJgxICGEdu78TynI+Aj5Bc7W8jg+tiSn9Ye34V+aKQ3M+YKTU1spK5HI82Kc14Yqh+oGlR4pMigv0D/BevHQ=; 7:VI5gUmZEgWuxgb136wkvCeQiAdbpdXOfQuPTeYnyQBrmX3XzeHdt4OmlXyNlXFJuJkOOdrMNlyP92AnuhA/kmdFqXZ3diY+JnnOV4KIcwAIdWUoh9RZPfiY7Ozmx9wpL0sn1BUJI+iaaJ3LNcz8d2A== x-ms-office365-filtering-correlation-id: 82124d42-5a11-4b8c-c408-08d64b4a80df x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0910; x-ms-traffictypediagnostic: MWHPR04MB0910: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231415)(944501410)(52105112)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0910; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0910; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(346002)(376002)(396003)(39860400002)(199004)(189003)(76176011)(486006)(50226002)(8676002)(4326008)(44832011)(446003)(2616005)(14454004)(52116002)(476003)(6486002)(2501003)(6506007)(11346002)(256004)(478600001)(26005)(39060400002)(53936002)(102836004)(6512007)(2900100001)(6436002)(186003)(8936002)(2906002)(386003)(72206003)(81166006)(66066001)(25786009)(81156014)(105586002)(54906003)(110136005)(316002)(86362001)(5660300001)(118296001)(97736004)(106356001)(7736002)(6116002)(68736007)(99286004)(36756003)(3846002)(305945005)(71190400001)(71200400001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0910; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-microsoft-antispam-message-info: 7tdGbnOJSPq0W7JynO/hirwtCkcucx1G3IYsnE1uYhWM2w1mN7LTqC/h4LIe5oSOgGnP2oqLb2jR9gLkb8epJs0ERYiW6CDXTcElOOsSkJQ9TkVHMq4kLMUOc6zyynwA8hcoXX4n+dGnfKTpT/H/EJ0PrvhwgWAJ7SUzfSRXdU8gUC3T2iAmnfhroWYjJPHvaNHnHPkG/+qRKsZWsTEtsvnjQg9l/2Xoruldx5+0fX0aXvsSjMxwFXopuGZXvTYB6WVkcjgVgG3ZmpR+Igzq4M3JZOaA4ZocE/zI4sY8NxeCb5aBXeeGqFslwwGNfaOiaMklV6C04CeZ16Hfcw9D/BCHQc/Ez9gutAgjkMYtkek= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82124d42-5a11-4b8c-c408-08d64b4a80df X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:28.5528 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0910 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 04/23] exec: Add RISC-V GCC poison macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- include/exec/poison.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/poison.h b/include/exec/poison.h index 32d53789f8..ecdc83c147 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -79,6 +79,7 @@ #pragma GCC poison CONFIG_MOXIE_DIS #pragma GCC poison CONFIG_NIOS2_DIS #pragma GCC poison CONFIG_PPC_DIS +#pragma GCC poison CONFIG_RISCV_DIS #pragma GCC poison CONFIG_S390_DIS #pragma GCC poison CONFIG_SH4_DIS #pragma GCC poison CONFIG_SPARC_DIS From patchwork Thu Nov 15 22:34:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="iBtfN6Ww"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="al9/gVXr"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxCq4YXRz9s47 for ; Fri, 16 Nov 2018 09:40:55 +1100 (AEDT) Received: from localhost ([::1]:41112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQJh-00022W-Ak for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:40:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDp-0005gL-M0 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDl-0003dM-Nf for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:49 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:40007) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDj-0003Xo-IF; Thu, 15 Nov 2018 17:34:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321283; x=1573857283; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ARp5sQsUd1VRryIDuNXvYHrptUhDXsjhzQu5OXI00Nk=; b=iBtfN6WwWYyyJzvoF0LmumdtO4S3/aHsVVQl7fMAiFErGN+nHg/U0fDb 5AnDF4EPzbmVWvlnW9mJAU2FKfymTk/cS6fLdEdqVBU20HZyrbrF1xje1 lTNg+dCE4RX9xkPBJKgtop4pmtufCfbCzX6+0vs9KqF1Gz6qtf8xoeEVN d/kHaVcAzUaOcd4V3rvwuZZswczTE6aM3Qy5sTPdp6qce8n5JLH79OHla 1kY2nMuKTBnOIp1yEzpruKz2ulDJt2zmKuyHN442JON5FCZBuMkjOI1dB tPwiDYtXLi8XJh9OmgWVPI5rhfEhz9WbBzq+NpLSjfU0yeOLd0JQi5YaC g==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884241" Received: from mail-bn3nam04lp0112.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([216.32.180.112]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:39 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aQUXaXEdPeoOVuXzS3Efhi4OwkQ6puQ1XpahEMqWPFk=; b=al9/gVXrB0jrr/iENMWmseXvVjAurnnHHYIxiN1CXyI+J9HQ84xrxCavk78ojsOPDcuyIt5wxrfVJBPw3mVppo/EAZy51wX+BsDLflDvbo4cxpmndj5rv+JW81AwVGUYs23oOKFAas6siHpl7begwR0Xn/emRT8JiMnpxDEpZeo= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0673.namprd04.prod.outlook.com (10.172.166.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 22:34:37 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:37 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 05/23] riscv: Add the tcg-target header file Thread-Index: AQHUfTNkFVyD05bjnEi15QF4k9U3mQ== Date: Thu, 15 Nov 2018 22:34:37 +0000 Message-ID: <1c17c37965dcd1b579a58af168892818b33453fe.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0051.prod.exchangelabs.com (2603:10b6:a03:94::28) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0673; 6:X0VlW0b0Z7G1l7OaunDTZwCWy38Z5uyyQzfsVmX0m9WcPKoAC4LJlbT7A8u585c8+D/IaoDOnOaWXalm3UCKt7RZMx6Pn4EURpvHJW7a0jd1NxyhzwRdr7KSi6WM3oK4ErIW5KfHvilFn6m9oTBe8Y8Q0D4PYpZ/3khqqnXrHIjKNSyoWfen81pQ0ZtQoIiXW0XfxwuwRJau7aW577gc6rPjFMmab3U1ti7v77Ft/h9wwbwAOWUUM2icSdXtgVJm9h+ZvDfU89Jd6gIzunXF/a5tLXimr1nOo6rwpPisXjbWwutGgbjgjL7ES3ItE3WSnvkIksAx2p02OPj56iJSu12cpCndOEd3Ml1AP78glwYnVZ0TgeV2+794s5VKdrt+dAT46Iuuq2/P5dKsFzFkJ9/ROILSyiSVHRX1fb1M9Pe7wWZXWsTuSqrlw1jsXuENSV1QxhVsOU6ZMH+sXMjGqw==; 5:66DKzLRgirXPMBoVYsICtT72+cXnzD4qUq06G9BeSf8Mh1ob4zh23FZaoDrzfBn0fKDx1qHYMtDAYDXjzqo6HT0MUPZYIpD3/wGJTRTqW4w47TfUM74ikS780C30nRdHDuOgCbvS2L2tJ6ufVRs0hLDT+8WEmHjKPxQIzuFxvE8=; 7:jxhXssLUQzgWCgq+jGsEZNWOUI7tGEyQgAk75jDkSdNgThI81jmDP0lRM3oGyZ0SHj+LBFlHN3mPKe2M9ymQ7Ly85rBPcZiTOFMthGBLVDdUsOTQCZQdUXZ8DTnfK0/hHN13zhkCNnDiMQAcFGwH7w== x-ms-office365-filtering-correlation-id: b0766ec6-c0b7-4692-c9fc-08d64b4a866e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0673; x-ms-traffictypediagnostic: MWHPR04MB0673: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0673; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0673; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(66066001)(256004)(14444005)(81166006)(71200400001)(71190400001)(8676002)(81156014)(316002)(2501003)(305945005)(7736002)(50226002)(110136005)(54906003)(2900100001)(44832011)(486006)(6486002)(8936002)(11346002)(446003)(2906002)(97736004)(476003)(2616005)(6116002)(3846002)(39060400002)(53936002)(4326008)(386003)(52116002)(76176011)(6506007)(26005)(102836004)(478600001)(186003)(72206003)(105586002)(106356001)(99286004)(6512007)(5660300001)(68736007)(118296001)(25786009)(86362001)(36756003)(14454004)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0673; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: t5vM4/mlTcpIbB15O2gubXic6SdfolnrwU7WuYlBkv5tO2HLeAw97t7z1zi0Lfe3UsDOQv4NEITpExvS+Du1qJ2mYwugz11EiNQSBTHl7A30XdENLVF3N9HfPqM6eJN2Cjded9Tqp4VzkjBhKt+mAROXEn5Fkm7oTu9JQaJ8JrMi/K2lwQNhA4NdxrrpdQdtR++8wfKf7V4Y2V3aix6n+bjyadctUAcmfp6nQI4hLh4xQ0fFZSvGh8ektebx1XRoyaAqOtL/1pyKSS5/vXrXH1prRMLAG7L50nF2YkVhmNmdU/QRhN9hstaOfeqLlJSv4DqaL4x3zEFFhrJ2T/7TvEZwY+nOlkLKbNZIsrYSwcU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0766ec6-c0b7-4692-c9fc-08d64b4a866e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:37.8487 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0673 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 05/23] riscv: Add the tcg-target header file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.h | 173 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 tcg/riscv/tcg-target.h diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h new file mode 100644 index 0000000000..53ab485983 --- /dev/null +++ b/tcg/riscv/tcg-target.h @@ -0,0 +1,173 @@ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2018 SiFive, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef RISCV_TCG_TARGET_H +#define RISCV_TCG_TARGET_H + +#if __riscv_xlen == 32 +# define TCG_TARGET_REG_BITS 32 +#elif __riscv_xlen == 64 +# define TCG_TARGET_REG_BITS 64 +#endif + +#define TCG_TARGET_INSN_UNIT_SIZE 4 +#define TCG_TARGET_TLB_DISPLACEMENT_BITS 20 +#define TCG_TARGET_NB_REGS 32 + +typedef enum { + TCG_REG_ZERO, + TCG_REG_RA, + TCG_REG_SP, + TCG_REG_GP, + TCG_REG_TP, + TCG_REG_T0, + TCG_REG_T1, + TCG_REG_T2, + TCG_REG_S0, + TCG_REG_S1, + TCG_REG_A0, + TCG_REG_A1, + TCG_REG_A2, + TCG_REG_A3, + TCG_REG_A4, + TCG_REG_A5, + TCG_REG_A6, + TCG_REG_A7, + TCG_REG_S2, + TCG_REG_S3, + TCG_REG_S4, + TCG_REG_S5, + TCG_REG_S6, + TCG_REG_S7, + TCG_REG_S8, + TCG_REG_S9, + TCG_REG_S10, + TCG_REG_S11, + TCG_REG_T3, + TCG_REG_T4, + TCG_REG_T5, + TCG_REG_T6, + + /* aliases */ + TCG_AREG0 = TCG_REG_S0, + TCG_GUEST_BASE_REG = TCG_REG_S1, + TCG_REG_TMP0 = TCG_REG_T6, + TCG_REG_TMP1 = TCG_REG_T5, + TCG_REG_TMP2 = TCG_REG_T4, + TCG_REG_L0 = TCG_REG_A6, + TCG_REG_L1 = TCG_REG_A7, +} TCGReg; + +/* used for function call generation */ +#define TCG_REG_CALL_STACK TCG_REG_SP +#define TCG_TARGET_STACK_ALIGN 16 +#define TCG_TARGET_CALL_ALIGN_ARGS 1 +#define TCG_TARGET_CALL_STACK_OFFSET 0 + +/* optional instructions */ +#define TCG_TARGET_HAS_goto_ptr 1 +#define TCG_TARGET_HAS_movcond_i32 0 +#define TCG_TARGET_HAS_div_i32 1 +#define TCG_TARGET_HAS_rem_i32 1 +#define TCG_TARGET_HAS_div2_i32 0 +#define TCG_TARGET_HAS_rot_i32 0 +#define TCG_TARGET_HAS_deposit_i32 0 +#define TCG_TARGET_HAS_extract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_add2_i32 0 +#define TCG_TARGET_HAS_sub2_i32 0 +#define TCG_TARGET_HAS_mulu2_i32 0 +#define TCG_TARGET_HAS_muls2_i32 0 +#define TCG_TARGET_HAS_muluh_i32 (TCG_TARGET_REG_BITS == 32) +#define TCG_TARGET_HAS_mulsh_i32 (TCG_TARGET_REG_BITS == 32) +#define TCG_TARGET_HAS_ext8s_i32 1 +#define TCG_TARGET_HAS_ext16s_i32 1 +#define TCG_TARGET_HAS_ext8u_i32 1 +#define TCG_TARGET_HAS_ext16u_i32 1 +#define TCG_TARGET_HAS_bswap16_i32 0 +#define TCG_TARGET_HAS_bswap32_i32 0 +#define TCG_TARGET_HAS_not_i32 1 +#define TCG_TARGET_HAS_neg_i32 1 +#define TCG_TARGET_HAS_andc_i32 0 +#define TCG_TARGET_HAS_orc_i32 0 +#define TCG_TARGET_HAS_eqv_i32 0 +#define TCG_TARGET_HAS_nand_i32 0 +#define TCG_TARGET_HAS_nor_i32 0 +#define TCG_TARGET_HAS_clz_i32 0 +#define TCG_TARGET_HAS_ctz_i32 0 +#define TCG_TARGET_HAS_ctpop_i32 0 +#define TCG_TARGET_HAS_direct_jump 1 + +#if TCG_TARGET_REG_BITS == 64 +#define TCG_TARGET_HAS_movcond_i64 0 +#define TCG_TARGET_HAS_div_i64 1 +#define TCG_TARGET_HAS_rem_i64 1 +#define TCG_TARGET_HAS_div2_i64 0 +#define TCG_TARGET_HAS_rot_i64 0 +#define TCG_TARGET_HAS_deposit_i64 0 +#define TCG_TARGET_HAS_extract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_extrl_i64_i32 0 +#define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_ext8s_i64 1 +#define TCG_TARGET_HAS_ext16s_i64 1 +#define TCG_TARGET_HAS_ext32s_i64 1 +#define TCG_TARGET_HAS_ext8u_i64 1 +#define TCG_TARGET_HAS_ext16u_i64 1 +#define TCG_TARGET_HAS_ext32u_i64 1 +#define TCG_TARGET_HAS_bswap16_i64 0 +#define TCG_TARGET_HAS_bswap32_i64 0 +#define TCG_TARGET_HAS_bswap64_i64 0 +#define TCG_TARGET_HAS_not_i64 1 +#define TCG_TARGET_HAS_neg_i64 1 +#define TCG_TARGET_HAS_andc_i64 0 +#define TCG_TARGET_HAS_orc_i64 0 +#define TCG_TARGET_HAS_eqv_i64 0 +#define TCG_TARGET_HAS_nand_i64 0 +#define TCG_TARGET_HAS_nor_i64 0 +#define TCG_TARGET_HAS_clz_i64 0 +#define TCG_TARGET_HAS_ctz_i64 0 +#define TCG_TARGET_HAS_ctpop_i64 0 +#define TCG_TARGET_HAS_add2_i64 0 +#define TCG_TARGET_HAS_sub2_i64 0 +#define TCG_TARGET_HAS_mulu2_i64 0 +#define TCG_TARGET_HAS_muls2_i64 0 +#define TCG_TARGET_HAS_muluh_i64 1 +#define TCG_TARGET_HAS_mulsh_i64 1 +#endif + +static inline void flush_icache_range(uintptr_t start, uintptr_t stop) +{ + __builtin___clear_cache((char *)start, (char *)stop); +} + +void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t); + +#define TCG_TARGET_DEFAULT_MO (0) + +#ifdef CONFIG_SOFTMMU +#define TCG_TARGET_NEED_LDST_LABELS +#endif + +#endif From patchwork Thu Nov 15 22:34:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="JBBLdBPn"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="Vz0ZA8+p"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxH329LMz9s47 for ; Fri, 16 Nov 2018 09:43:43 +1100 (AEDT) Received: from localhost ([::1]:41133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQMO-0004VB-S6 for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:43:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQDv-0005lp-Kt for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDs-0003g8-E9 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:34:55 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:40036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDp-0003ec-Rl; Thu, 15 Nov 2018 17:34:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321289; x=1573857289; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=bbp2pEDTp9KHO1cEG/nmi7NDwFZEAo6P2XVJ2xp2dfU=; b=JBBLdBPnHZeFqxf/bYboge7D7UzWWhRIHK56p6ZTHi7hbhq3CWxfT4PC 4VbBFAj7HXZVTvy90cyLZNQ9LAaEB/qb5i9WwxpGAr/nrL/z2eBXkkOmh wjgcglVGgRVu4loE9Rn8PD1+5Y/jrOJaPfdxH7eUL2H+iIvQnfKG41afl NWJI6MAey/n5N6JDLr3Pg6LoB5vFFoAMr6+0JAx4nW6Smk6UHxbTWjhfz K5qNyOBf9sCbjSJ1w0vLZxbdAZ1Z/QZCE7NuEN5DwUMWsm8qQE/hwRZCX YBFCSul+JbnDx06jOG6IYCB/fC+NnbGVJHaFddOkzPwkInmAvBVGN/sM5 Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884273" Received: from mail-cys01nam02lp0049.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.49]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:34:48 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YiqzDg8UxYCM1y7gJY7TAMw1IGKoCRjZwANqYQiSn20=; b=Vz0ZA8+prJPZcmyUBd4GpqFMrTL0wYGeZXYojO2W0SsamYIpsL/MnFndV0WQll9qn9LzsqQvcLZy9N45rSlr1w6YTTs1ZFO5uxlxk133nT9Xq3valJzysQ71O0LbywVY6SDjLcB62OSyadQPBiFa8e6Q6xTzxrX3EpPC5YT4pN0= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0673.namprd04.prod.outlook.com (10.172.166.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 15 Nov 2018 22:34:47 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:47 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 06/23] riscv: Add the tcg target registers Thread-Index: AQHUfTNpwj+c8cU4XUuVw5+jHziYwA== Date: Thu, 15 Nov 2018 22:34:47 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0057.prod.exchangelabs.com (2603:10b6:a03:94::34) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0673; 6:vyGq0X8la/zKX7wK4mJxUOGa24sDJmPbIeEbTUfdpPYJFQAEkCfnRAYkK50UAFp8A33k+oF2eYKyndkYAbvXz8pCXIbHkXkb/WMrmTlZFfVgEH8CE0r62fukOg1bvO7Ep2Ra978WjWav5V1koDZK5SJP0emcRrhCnM134f40vRgV8ITuZ+rz6+QRSh3h8umpHqk9h0kBnf2wDHMThR/awyzs6sH5V29LCcw4409AdKNhtP7gz5qoOXmJp0XIzcEighNAMoHR5SK6zbUPm+XGPpPact0dz5RR98SouOu3Ym+M1bpJvsdvlcZfmtBpl1W0uckoBcMMAMSXWGPvb/aSzEjKEKnN99RBH+/2gn53P2k4XHQUlOwEHvonpAGioIudWH+8NhVZ6ayGcz/wf/2ViMFZkayg6VFUdkG7Jh+r3w6VpXeMv9R33+A/KGzGIwNv8gV+NzDkwAXxMz4ZA9qSJQ==; 5:THeD+/CUIukHEkAibi9ile0G9LAKrBYHexxMIm8Fv2PBFk3OxxCbAKId+l7Y0HvlejWDOhlauNathN9FBaa4ixPQD3/9Y6Z04HYOl0MdC9LXwWuQcN9HDojdqBcMfXWufLBo8qA33m8JdhRBPnnUmapahQQZSiUP1M1EeTKgiqE=; 7:4/kF21FctstXRNjmYc5Dt6LkHkyKHY44xOw6rUyvrxt02gWUprkLVlCLlFh5+eyHBl+fhL6Q+dZbvfREfKyxqTRgGNAfflqnWx2IcHzJoMpbDqMF8H2PH5PYy+/b5c0KujlfXpgz5VfL8PfF8WCavw== x-ms-office365-filtering-correlation-id: de14c9b3-4b38-491c-9fc7-08d64b4a8bed x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0673; x-ms-traffictypediagnostic: MWHPR04MB0673: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0673; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0673; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(66066001)(256004)(14444005)(81166006)(71200400001)(71190400001)(8676002)(81156014)(316002)(2501003)(305945005)(7736002)(50226002)(110136005)(54906003)(2900100001)(44832011)(486006)(6486002)(8936002)(11346002)(446003)(2906002)(97736004)(476003)(2616005)(6116002)(3846002)(39060400002)(53936002)(4326008)(386003)(52116002)(76176011)(6506007)(26005)(102836004)(478600001)(186003)(72206003)(105586002)(106356001)(99286004)(6512007)(5660300001)(68736007)(118296001)(25786009)(86362001)(36756003)(14454004)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0673; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: bYEBhSneNK34c2tDR6yxyY2dSnqLmArRcUFruOMqMZlrZ1fjXiEhvM1eEKz9q/t8fptRuQ9Gt5lIlqB2FSs8E/sqqd/MICHJtT9OI3h5Xeeh1VIyY6MO/tY+PZ/JZziHGdk4ds6ErOSDH9bsw3tnC7KaPVGx8itQ/WF7btFVtd6lJp4LfQdXEo3M7tlwwWHFsAUHHaE1/Rz+rJycGf082j1o/++RmwxFcsi2UrGcwRa+dx0f9E+CZIsBYqMpbT1EG26mDhTWSI5xIjsxZbhr/sM9FJbuwG5QGbIbKeIEagmpmcyBmDIHNMrjwgvBuVxYpLrYOIyoOdD1PeDXNQ3jPbZcLvjkz5rG10N3l/Ck6FI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: de14c9b3-4b38-491c-9fc7-08d64b4a8bed X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:47.0255 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0673 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 06/23] riscv: Add the tcg target registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 tcg/riscv/tcg-target.inc.c diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c new file mode 100644 index 0000000000..e5eca4bbbe --- /dev/null +++ b/tcg/riscv/tcg-target.inc.c @@ -0,0 +1,120 @@ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2018 SiFive, Inc + * Copyright (c) 2008-2009 Arnaud Patard + * Copyright (c) 2009 Aurelien Jarno + * Copyright (c) 2008 Fabrice Bellard + * + * Based on i386/tcg-target.c and mips/tcg-target.c + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifdef CONFIG_DEBUG_TCG +static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { + "zero", + "ra", + "sp", + "gp", + "tp", + "t0", + "t1", + "t2", + "s0", + "s1", + "a0", + "a1", + "a2", + "a3", + "a4", + "a5", + "a6", + "a7", + "s2", + "s3", + "s4", + "s5", + "s6", + "s7", + "s8", + "s9", + "s10", + "s11", + "t3", + "t4", + "t5", + "t6" +}; +#endif + +static const int tcg_target_reg_alloc_order[] = { + /* Call saved registers */ + /* TCG_REG_S0 reservered for TCG_AREG0 */ + TCG_REG_S1, + TCG_REG_S2, + TCG_REG_S3, + TCG_REG_S4, + TCG_REG_S5, + TCG_REG_S6, + TCG_REG_S7, + TCG_REG_S8, + TCG_REG_S9, + TCG_REG_S10, + TCG_REG_S11, + + /* Call clobbered registers */ + TCG_REG_T0, + TCG_REG_T1, + TCG_REG_T2, + TCG_REG_T3, + TCG_REG_T4, + TCG_REG_T5, + TCG_REG_T6, + + /* Argument registers */ + TCG_REG_A0, + TCG_REG_A1, + TCG_REG_A2, + TCG_REG_A3, + TCG_REG_A4, + TCG_REG_A5, + TCG_REG_A6, + TCG_REG_A7, +}; + +static const int tcg_target_call_iarg_regs[] = { + TCG_REG_A0, + TCG_REG_A1, + TCG_REG_A2, + TCG_REG_A3, + TCG_REG_A4, + TCG_REG_A5, + TCG_REG_A6, + TCG_REG_A7, +}; + +static const int tcg_target_call_oarg_regs[] = { + TCG_REG_A0, + TCG_REG_A1, +}; + +#define TCG_CT_CONST_ZERO 0x100 +#define TCG_CT_CONST_S12 0x200 +#define TCG_CT_CONST_N12 0x400 From patchwork Thu Nov 15 22:34:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="MHwkuGbz"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="B6lvsRiC"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx622sFHz9s3q for ; Fri, 16 Nov 2018 09:35:54 +1100 (AEDT) Received: from localhost ([::1]:41076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEq-0005ul-0U for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:35:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQE3-0005sN-D7 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQDz-0003oF-QL for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:03 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:26949) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQDz-0003nB-F7; Thu, 15 Nov 2018 17:34:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321384; x=1573857384; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=blojcwrc9p/9PTv5IB/BUulhjAOR/2M0ldqvMix2Gzg=; b=MHwkuGbzW29zibnTMT0a8buqHha+qvuPR4Q4NsDa2rdGyzUlGaBlg//w xR7k6R0lC1MfvR75DBjivxkb373hwvN58U2HuknM4V0sC8NoC8itcYCUP b4K4g56zgrYkWKLx1vb0WT3NeivKprIxjm7FDjZw3LL8By5a9ZlxlBErb LB50q0WfZ7Ofdo75SZLD1rUL+mKjxMVFBn/QH9wIt7Vxt/gKjqiu+3EiI u9LXcHYndLRzq3C1uqQmKpV7n1iR8aTmDmmFYHb648F7s8ZNTRWfCsp4q 6aGg+JcP3Vyz9OXrQf8GaIbtuUS5uNEd9FX29e+1K8exm3kh8/vGqfzYl Q==; X-IronPort-AV: E=Sophos;i="5.54,499,1534780800"; d="scan'208";a="192154404" Received: from mail-sn1nam04lp0088.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([216.32.180.88]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:21 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aPDWGYTxwSY2L8hFeZ6YCHrYcrBPv6OqwmDwABntV8M=; b=B6lvsRiCTT4h/k3509UZElOxsufYZpX2f73IiI6I9xohONXjZuw6CnoFiZzCjL1btVYuKU5w91B2TstmqlorXpA92qpGRwDIMF7C2o5yByp/Vaba3Ju/tOfg7H8hT03ONYauTOwwjhuXL1v7xynQm3EoWdUsVixiLk4lu6/0a/8= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:34:56 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:34:56 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 07/23] riscv: tcg-target: Regiser the JIT Thread-Index: AQHUfTNvt657zwYMG0Gd0EUa+4zm8A== Date: Thu, 15 Nov 2018 22:34:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0064.prod.exchangelabs.com (2603:10b6:a03:94::41) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:wae5saquMZ61oMrukYBRJtDX03wX/LHSqj8id5Ey84TtnevwEtvlNBkbR2U363YENeRMYb+2jfFSb9lfyOcZhRYPaMPPGfz/hwpOVcRa2Wxa66qJvaZ8TOyb8QbfcP3mN2thwZdAd/NaggKq+PB6j1cJpp4633KJC27jOl7j2MGoh8wJdqZsBk7B9K8sQepUU4BfIQolQ+9l7ODNSIJ1D+UIJZxhYvfiieH7ol29P4ZMLj5hobZu7L7zpv9zh97p3kkfjSsWG26Teh1pxDHb0NmIiCi9bX2LoJLMKz4CN5aPgURGYy4TUa+6/6hA13qzgjbbyvxG/C4HnEdDAiDVPrKQ79l3MrA/sE4lB36S/IrknmgwuGIMuEavm3u20mOmviVfcMxmacNJjKYb/Z2wn7X4+myRFgDJfbHBH4K3i2QYqd8LxRp3mNqOH6aWSYvBiYmkJ5snFz+raZcyqeut8A==; 5:jcG9ErzjJNZ5fDQNsupCeF3nQh8qL+PbpluHJWgbvF89i+/3iZMqIXqF43dgN8RaIMqPqCAAnr8RXDGU2jKUr5rGnIAsRPiByXWbb0xW43IaJL0yuB/wkCCL7E3lOYQ9IlnqAV+rwul5TnZ6ZoEm8xdi2LO2hHmSeXuLqjNx20Y=; 7:g9jsE4wcX4YulWbqZ2hVGNrfBgj6s2ovCWv4IyNFkmoS8k4R+5ahTTj+5L+xQkWu8tR8wPO9E+AmGFtj4OGD8NRg6sQHAWGL1QHSP5ATHbcywLzz1ePV/lli7Oy4ZJpPHPMElljqGsQFpHvrx7L5Xg== x-ms-office365-filtering-correlation-id: 8f380c20-5230-4079-c006-08d64b4a916e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: OqVb8xh/HCyZxDgFEQ3U2KH/McVCpKyhVgGVv95wq+xipbNpyN0qNRYSXSs6jTLNLWwuuCd4/pK4/f7YaXBAZYrIfb9+SpxLNpwIxAIs87jT4fmyrRSSCC3mPbekotGg+fdU7YguqZFcXuIU0uQlZOUMPlhyeouXSzNOpp+3P7BrODfabNiCSRw34JSa5ksGmPVRvBuV2Uc2NgtAR/P8pO6QoEPcIEtUsplh5RMn1MhQ0Seys2n8HCH8um8Ed2GvZpaqhzSfI2/5ExhZuuMhqLM9ZGKzcptp4ucVvETKsVOMepIl42NNQ0S6TIxe3f7POZyD1/GLHVtbY2zQmeoovTebbvgcd4+Eml0UZlLHr5s= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f380c20-5230-4079-c006-08d64b4a916e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:34:56.2334 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.143.124 Subject: [Qemu-devel] [RFC v1 07/23] riscv: tcg-target: Regiser the JIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index e5eca4bbbe..a9c57493a0 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -118,3 +118,48 @@ static const int tcg_target_call_oarg_regs[] = { #define TCG_CT_CONST_ZERO 0x100 #define TCG_CT_CONST_S12 0x200 #define TCG_CT_CONST_N12 0x400 + +typedef struct { + DebugFrameHeader h; + uint8_t fde_def_cfa[4]; + uint8_t fde_reg_ofs[ARRAY_SIZE(tcg_target_callee_save_regs) * 2]; +} DebugFrame; + +#define ELF_HOST_MACHINE EM_RISCV + +static const DebugFrame debug_frame = { + .h.cie.len = sizeof(DebugFrameCIE) - 4, /* length after .len member */ + .h.cie.id = -1, + .h.cie.version = 1, + .h.cie.code_align = 1, + .h.cie.data_align = -(TCG_TARGET_REG_BITS / 8) & 0x7f, /* sleb128 */ + .h.cie.return_column = TCG_REG_RA, + + /* Total FDE size does not include the "len" member. */ + .h.fde.len = sizeof(DebugFrame) - offsetof(DebugFrame, h.fde.cie_offset), + + .fde_def_cfa = { + 12, TCG_REG_SP, /* DW_CFA_def_cfa sp, ... */ + (FRAME_SIZE & 0x7f) | 0x80, /* ... uleb128 FRAME_SIZE */ + (FRAME_SIZE >> 7) + }, + .fde_reg_ofs = { + 0x80 + 9, 12, /* DW_CFA_offset, s1, -96 */ + 0x80 + 18, 11, /* DW_CFA_offset, s2, -88 */ + 0x80 + 19, 10, /* DW_CFA_offset, s3, -80 */ + 0x80 + 20, 9, /* DW_CFA_offset, s4, -72 */ + 0x80 + 21, 8, /* DW_CFA_offset, s5, -64 */ + 0x80 + 22, 7, /* DW_CFA_offset, s6, -56 */ + 0x80 + 23, 6, /* DW_CFA_offset, s7, -48 */ + 0x80 + 24, 5, /* DW_CFA_offset, s8, -40 */ + 0x80 + 25, 4, /* DW_CFA_offset, s9, -32 */ + 0x80 + 26, 3, /* DW_CFA_offset, s10, -24 */ + 0x80 + 27, 2, /* DW_CFA_offset, s11, -16 */ + 0x80 + 1 , 1, /* DW_CFA_offset, ra, -8 */ + } +}; + +void tcg_register_jit(void *buf, size_t buf_size) +{ + tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame)); +} From patchwork Thu Nov 15 22:35:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="H5tNry5T"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="FUTw9jwu"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxLF2s7nz9s47 for ; Fri, 16 Nov 2018 09:46:29 +1100 (AEDT) Received: from localhost ([::1]:41156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQP4-00071Y-Lu for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:46:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQED-0005zT-8J for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQE9-0003ty-GV for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:13 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:26967) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQE7-0003su-RQ; Thu, 15 Nov 2018 17:35:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321309; x=1573857309; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GB3HTiU4JkuRfLZWbWIv6tG7w0JROKgH1f9mad5QI3A=; b=H5tNry5TsoDESsE3i/URFgaA8Eu0752DIe6geapZENHcZ6dKSWZ2tqYI b6826ZC7EV0x2b+887fxONaWU9bX/sE1Wx8hGc/HA2mftScAJ3x/VGuMs XslFl/t5hMlpzzhP8ma3xGIXTUH8LOe4YH0XEkDllnPubSdeec7Rp+WX6 A50VQDg4Y9SkOIDzHLaj8R6ObCPHhwUTLh0ZqiiOpF1pGUmx0uOVvfESc g4D82XuROstcbXGIy1Sw8TGFDxKv/79dhKshk2Bs8an+vAHDy9JR4x4Gw 4iYrz3dHosMBFGQAyyogSbDzWjN/IDaJZuZxfT1SeU2o/XtTfGU9kpt8j Q==; X-IronPort-AV: E=Sophos;i="5.54,499,1534780800"; d="scan'208";a="192154414" Received: from mail-sn1nam04lp0088.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([216.32.180.88]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/cg1H4WHc+2/7buEUFOw11mRpl8DbpewUFkfFm95iss=; b=FUTw9jwu0lJ467FP92rBrRZzHZG4ofggWJNE7OaSky+sVNMtxgS3mve0CaBf+MWCJJMVlooGRrmRr4cG6O9unclWpXV3TIUkC5WYQOWJla1eRa1OhDhDOuwKfAyrHe/X1Wvh7AamH7p8bfTG7xVBe2Y2Dvj9yecBk3p0Q4tNics= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:05 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:05 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 08/23] riscv: tcg-target: Add support for the constraints Thread-Index: AQHUfTN0WQRayW/gYEyR31SNLQMMvg== Date: Thu, 15 Nov 2018 22:35:05 +0000 Message-ID: <1d5f88588063393fe28b689ce9501715022052ed.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0070.prod.exchangelabs.com (2603:10b6:a03:94::47) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:oxJUUl0mOrpygfHMIfdQ5R3BXNuWWqo/66ZflAjXWRb4+PncTjM1kEkx55KuqUrPLjNcj3XNKg7P0qhLUR5t8BybTOS4Y1upqX4p6ABqJGaZf4TWXPUhrlMD7NA7jebLajqGQr293Kj7FcxGQyDgst4em3MZTK/CsyzEA/aq34NpMXH260ovRc0694xFD/sBzjKTXNlwrg1E2BC8ttUk1GXzP5aEWg0XL0BMm1PF4S+/4G+vJ9rT4puJQQcgen+oEbXvrwzuY1AR2z4awPt3WZ9DdIMaYRcrXdBjgKk5XQvUHmCGonAY1TKGWj1Xey4a2nxeWhFLmyT/tk1JVEmiOpF+0yMSw+B7yhi5yGDJsYc2io0h7p4pJLsykNX2XKQ6nSs9Bmc8dAGJCiqhV7TUHn1XyMCy/RPqX4Q7gGZYRaqFNaQO8ezehBp/hNaQ8aRtHHyNYT1dURvBCKpDVfQ+0A==; 5:e0RG6QwTzarr5b+0/dmWqBlieeR/vdH0bL0ZvZkMi9+JXsatI+SeXxr+gkL0NDgCoDPVo1WLdUbk9Lxw5GC0ItQrqXIinj8NidpzWQKi8hockukHonDQykJ91hW+oNm472zk6wBnjSOQgHGW9jwHzgasJmZhGkWAPOCA92J7nHI=; 7:81lNaiw2mXmZfXcXfIQpjAXnEap2/hRbSLaZZzN8haCZGKAg6e3FPs5L4xeNGMMyZZoXv6ssg5Q4XGVzU9EJGKxFTbmcruqUVOP1Q0Jg+Kz42DkzVMUykyYro5A5/KR5nmlNwcXvhiJrJjqAp0gIqQ== x-ms-office365-filtering-correlation-id: d64ba57f-4d03-4e8f-d489-08d64b4a96d6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: XFITDSvPUeykI0wlmevUeAFgjBd/5uzWEUDrbZMVUNmqIF+SgsUSA8/QfG0bqi88H6OOzWEwqgodnoJWVg4SR5I5Oo27rgDRTGvul5CIOQJ22utMbNGJtQlT/ixMy7jspH668i3TiWgMFy2jZJqe6oqVMePqVtkVV2bwfI9RxBRqctsNR4OCVpxZmtlCx4bpOEYwxIJElM09hcSjAg7NMCgjUJyUMhvQ2eM5HatAQeQVud76UcmazMyKNfeORFRAuTZsuY1z20e8pZam91HpJ9R+eZmc4snveJGNuXEbeybUOA1GuR3mhws6992DvI5taIjlOkWc2qSg65VLveBKJbcz2vLvFmyfZxz73/b1mYk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: d64ba57f-4d03-4e8f-d489-08d64b4a96d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:05.3091 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.143.124 Subject: [Qemu-devel] [RFC v1 08/23] riscv: tcg-target: Add support for the constraints X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 139 +++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index a9c57493a0..e585740870 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -119,6 +119,145 @@ static const int tcg_target_call_oarg_regs[] = { #define TCG_CT_CONST_S12 0x200 #define TCG_CT_CONST_N12 0x400 +/* parse target specific constraints */ +static const char *target_parse_constraint(TCGArgConstraint *ct, + const char *ct_str, TCGType type) +{ + switch (*ct_str++) { + case 'r': + ct->ct |= TCG_CT_REG; + ct->u.regs = 0xffffffff; + break; + case 'L': + /* qemu_ld/qemu_st constraint */ + ct->ct |= TCG_CT_REG; + ct->u.regs = 0xffffffff; + /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ +#if defined(CONFIG_SOFTMMU) + /* tcg_out_tlb_load uses TCG_REG_TMP0/TMP1 and TCG_REG_L0/L1 */ + /* tcg_regset_reset_reg(ct->u.regs, TCG_REG_TMP0); */ + /* tcg_regset_reset_reg(ct->u.regs, TCG_REG_TMP1); */ + tcg_regset_reset_reg(ct->u.regs, TCG_REG_TMP2); + + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[0]); + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[1]); + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[2]); + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[3]); + tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[4]); +#endif + break; + case 'I': + ct->ct |= TCG_CT_CONST_S12; + break; + case 'N': + ct->ct |= TCG_CT_CONST_N12; + break; + case 'Z': + /* we can use a zero immediate as a zero register argument. */ + ct->ct |= TCG_CT_CONST_ZERO; + break; + default: + return NULL; + } + return ct_str; +} + +/* test if a constant matches the constraint */ +static int tcg_target_const_match(tcg_target_long val, TCGType type, + const TCGArgConstraint *arg_ct) +{ + int ct = arg_ct->ct; + if (ct & TCG_CT_CONST) { + return 1; + } + if ((ct & TCG_CT_CONST_ZERO) && val == 0) { + return 1; + } + if ((ct & TCG_CT_CONST_S12) && val >= -2048 && val <= 2047) { + return 1; + } + if ((ct & TCG_CT_CONST_N12) && val >= -2047 && val <= 2048) { + return 1; + } + return 0; +} + +/* + * RISC-V Base ISA opcodes (IM) + */ + +typedef enum { + OPC_ADD = 0x33, + OPC_ADDI = 0x13, + OPC_ADDIW = 0x1b, + OPC_ADDW = 0x3b, + OPC_AND = 0x7033, + OPC_ANDI = 0x7013, + OPC_AUIPC = 0x17, + OPC_BEQ = 0x63, + OPC_BGE = 0x5063, + OPC_BGEU = 0x7063, + OPC_BLT = 0x4063, + OPC_BLTU = 0x6063, + OPC_BNE = 0x1063, + OPC_DIV = 0x2004033, + OPC_DIVU = 0x2005033, + OPC_DIVUW = 0x200503b, + OPC_DIVW = 0x200403b, + OPC_JAL = 0x6f, + OPC_JALR = 0x67, + OPC_LB = 0x3, + OPC_LBU = 0x4003, + OPC_LD = 0x3003, + OPC_LH = 0x1003, + OPC_LHU = 0x5003, + OPC_LUI = 0x37, + OPC_LW = 0x2003, + OPC_LWU = 0x6003, + OPC_MUL = 0x2000033, + OPC_MULH = 0x2001033, + OPC_MULHSU = 0x2002033, + OPC_MULHU = 0x2003033, + OPC_MULW = 0x200003b, + OPC_OR = 0x6033, + OPC_ORI = 0x6013, + OPC_REM = 0x2006033, + OPC_REMU = 0x2007033, + OPC_REMUW = 0x200703b, + OPC_REMW = 0x200603b, + OPC_SB = 0x23, + OPC_SD = 0x3023, + OPC_SH = 0x1023, + OPC_SLL = 0x1033, + OPC_SLLI = 0x1013, + OPC_SLLIW = 0x101b, + OPC_SLLW = 0x103b, + OPC_SLT = 0x2033, + OPC_SLTI = 0x2013, + OPC_SLTIU = 0x3013, + OPC_SLTU = 0x3033, + OPC_SRA = 0x40005033, + OPC_SRAI = 0x40005013, + OPC_SRAIW = 0x4000501b, + OPC_SRAW = 0x4000503b, + OPC_SRL = 0x5033, + OPC_SRLI = 0x5013, + OPC_SRLIW = 0x501b, + OPC_SRLW = 0x503b, + OPC_SUB = 0x40000033, + OPC_SUBW = 0x4000003b, + OPC_SW = 0x2023, + OPC_XOR = 0x4033, + OPC_XORI = 0x4013, + OPC_FENCE_RW_RW = 0x0330000f, + OPC_FENCE_R_R = 0x0220000f, + OPC_FENCE_W_R = 0x0120000f, + OPC_FENCE_R_W = 0x0210000f, + OPC_FENCE_W_W = 0x0110000f, + OPC_FENCE_R_RW = 0x0230000f, + OPC_FENCE_RW_W = 0x0310000f, +} RISCVInsn; + typedef struct { DebugFrameHeader h; uint8_t fde_def_cfa[4]; From patchwork Thu Nov 15 22:35:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="oHG2ox+E"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ITp18oPa"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wx9Z5ZDlz9s47 for ; Fri, 16 Nov 2018 09:38:58 +1100 (AEDT) Received: from localhost ([::1]:41095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQHo-0000Fj-C8 for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:38:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEL-00067B-Qv for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQEH-0003y4-Ms for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:21 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:51923) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQEH-0003xb-ED; Thu, 15 Nov 2018 17:35:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321318; x=1573857318; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZSsdoU2lbPlI7GUiv5UHJll85lnIehDrNOEs1PQ78mw=; b=oHG2ox+EQI4HHXPTH4UyNhHT8kuHxpITV3yVYtxr3Y+KaWcxzlAdo1xW j0j10t6FSqSRjvapnXFk+PPZRedPwnY37aF6ppaLaXS41j203TYYxB9FY m5pKB0wOtggQQr0Mdcttl4UHxdy663+vf2Ca/i45AHJdqu7P9Ini4DVlO HDI0jNBR5R2lQJfGRL2AkwUfUZIAWSbYtYUTy9+iOKFI306xNwIn49jrp BoXfMm3bEshSAumPHYGKA7QtbRGNRRuSJJJOS7RTf7qu/tIRyT4R+4n+D +e9qTf8hflyIo6nluuZq1KSrP7u0vf36sxlgRYeKwvlF69Zy49GNDR8Tq Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99165974" Received: from mail-cys01nam02lp0050.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.50]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:16 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DgZTp9SMB6/DBkuj3NuokSK7LbhdAwi8wccPghXpamM=; b=ITp18oPasrlPCMEd9Gb+408chwEXCvp0q9jjN9FQoW1wan/STZwGhvPERzRM5e1eTmGvStAApyRa96alP8tzkdCNBcL41L7NBzvD5D++cnkJSWDq/JbNFAa5uniLp45Z39IMQlydAlITtvc4RhFtSw83RLlTYd4fik32vAjrsjQ= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:14 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:14 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 09/23] riscv: tcg-target: Add the immediate encoders Thread-Index: AQHUfTN5+YO0vG0XwUCWqBO4N+aQ7A== Date: Thu, 15 Nov 2018 22:35:14 +0000 Message-ID: <2d6d038f9949b5b39feb48e322be881f31a7f4e1.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0065.prod.exchangelabs.com (2603:10b6:a03:94::42) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:6TvHWpV6CbauxN1Lh58KDpnmTZKq++FvO0oF4HUEEmLy3isgus1umc1tY2K9sU99qH3tjvLLLV9xmPp5ovaQ5k9sncpjU2dFTmVMY99rJbUiFIq2fb/EoQEVWFDH/7YE7zgjFGQlxsDXGD2Bjz7oUDAPDbLszySGrlofqPPcaOjGYzlcVPj4TQrwU0kmtE1QQNTQUdj4saC/EA23qamfQUAn4EO6EoyxqUie+7qK+t7gCFHcQ3uUvU0UmdjYhwqAMht2+/dZmS8KjSG8p/fR9+Q790bUatqpA/sCZuV/8M4nAT3pxJOD/hyOKMsTsLNDrmHNiF1FRsDITEuNcKh0jxXjf0ZT4l2D4kuoaQm8+BKdJje0wqDNEPQY4dW+iZG7ccLpCV37ZRcb/u7F539rAYOsF+YjnYixCcB8323kcUoXM+7lz9GLiiQTso+0FxydjwPIz9vyxiQnJhJDHEvFOg==; 5:FQKRq5HqQUnTDSn+S6k13msJmZCb0l23aJdQEufubETAQLOE0S1P2qJablGYxwwD4+cZ9/qZegJonaM34O34nzShk8dwCbxOcDFiWXxbbDEjZn/QIE60Xj6jWRqrtwBWCYdj6FPpDUooYU1/2gey8JghP+UuLjGUAcl4LhAQTW0=; 7:wUZh7A1lFa/vt3zRv/q8SHTxo29arRnG/S1xHmNYNbNVhz4Jq1aKj3hTLyRHNZrrpTQizKU5jfRX4zZ47usaGIUBLwjzBOtNKVYB7IGKRyAUiSU3kGQJPeQlFpReCH8Tupbp4uLnSedmsnaJ58aP3w== x-ms-office365-filtering-correlation-id: 46d7eac6-3179-48ae-f571-08d64b4a9c2d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002)(14773001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: RYe7vDxGcqi+E9bGX0px5YklBGYn7+DiGB7gK9JPQxYnICZmKYPkGTJlKG/OIzq4HC0lAcHlJZYbPIkxyeOspR6A6s94ZhBDCIGAwinbMnVRvLPi1YEBVRcT+JgeCmQg644/TzVDPrwGljj/AszGX6dlnAzeGI8rX+qi31ZyokxBBlQnud1Krh0bQJKZUlqVzjeVSD8gSraYzg/nVOR1oW/Osj3PjZ2/Lof0nIpJc3Ioe9lNGDAo6Nf24cSCrSsJJ7lZVJx2ARpNsqiagh7hJ/APP+5fmC0JkVa73f7gyqRnEgi07mJ9E8o7ddPZBB0Xi4BWDhgJd2u5GcMv9fksPQyfw0TYKJebsYffuUh4AYA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46d7eac6-3179-48ae-f571-08d64b4a9c2d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:14.2847 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 09/23] riscv: tcg-target: Add the immediate encoders X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index e585740870..5319f7ade5 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -258,6 +258,87 @@ typedef enum { OPC_FENCE_RW_W = 0x0310000f, } RISCVInsn; +/* + * RISC-V immediate and instruction encoders (excludes 16-bit RVC) + */ + +/* Type-R */ + +static int32_t encode_r(RISCVInsn opc, TCGReg rd, TCGReg rs1, TCGReg rs2) +{ + return opc | (rd & 0x1f) << 7 | (rs1 & 0x1f) << 15 | (rs2 & 0x1f) << 20; +} + +/* Type-I */ + +static int32_t encode_imm12(uint32_t imm) +{ + return (imm & 0xfff) << 20; +} + +static int32_t encode_i(RISCVInsn opc, TCGReg rd, TCGReg rs1, uint32_t imm) +{ + return opc | (rd & 0x1f) << 7 | (rs1 & 0x1f) << 15 | encode_imm12(imm); +} + +/* Type-S */ + +static int32_t encode_simm12(uint32_t imm) +{ + return ((imm << 20) >> 25) << 25 | ((imm << 27) >> 27) << 7; +} + +static int32_t encode_s(RISCVInsn opc, TCGReg rs1, TCGReg rs2, uint32_t imm) +{ + return opc | (rs1 & 0x1f) << 15 | (rs2 & 0x1f) << 20 | encode_simm12(imm); +} + +/* Type-SB */ + +static int32_t encode_sbimm12(uint32_t imm) +{ + return ((imm << 19) >> 31) << 31 | ((imm << 21) >> 26) << 25 | + ((imm << 27) >> 28) << 8 | ((imm << 20) >> 31) << 7; +} + +static int32_t encode_sb(RISCVInsn opc, TCGReg rs1, TCGReg rs2, uint32_t imm) +{ + return opc | (rs1 & 0x1f) << 15 | (rs2 & 0x1f) << 20 | encode_sbimm12(imm); +} + +/* Type-U */ + +static int32_t encode_uimm20(uint32_t imm) +{ + return (imm >> 12) << 12; +} + +static int32_t encode_u(RISCVInsn opc, TCGReg rd, uint32_t imm) +{ + return opc | (rd & 0x1f) << 7 | encode_uimm20(imm); +} + +/* Type-UJ */ + +static int32_t encode_ujimm12(uint32_t imm) +{ + return ((imm << 11) >> 31) << 31 | ((imm << 21) >> 22) << 21 | + ((imm << 20) >> 31) << 20 | ((imm << 12) >> 24) << 12; +} + +static int32_t encode_uj(RISCVInsn opc, TCGReg rd, uint32_t imm) +{ + return opc | (rd & 0x1f) << 7 | encode_ujimm12(imm); +} + +void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, + uintptr_t addr) +{ + /* Note: jump target patching should be atomic */ + reloc_call((tcg_insn_unit *)jmp_addr, (tcg_insn_unit*)addr); + flush_icache_range(jmp_addr, jmp_addr + 8); +} + typedef struct { DebugFrameHeader h; uint8_t fde_def_cfa[4]; From patchwork Thu Nov 15 22:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="qkxArqeq"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ItkntzRk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxCT1cT4z9s9G for ; Fri, 16 Nov 2018 09:40:37 +1100 (AEDT) Received: from localhost ([::1]:41102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQJO-0001kO-NO for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:40:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEl-0006Uc-4g for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQEh-0004KI-QO for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:47 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:51936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQEg-0004DQ-Eq; Thu, 15 Nov 2018 17:35:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321343; x=1573857343; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=BhyV9lNqqRilJEUZhvwqAReSPB5cixjLgz7ilsbS8/k=; b=qkxArqeqY6Lajcv1ApE0U0VRqJO/lQ7u9ZXdeQMJKChNrvGrC1aLByAA GXdDwHxKoiU7f0fjfvSru+UsmmVlxkEkqoA6PnqSxFrVl40jIlpOtrKQa KKzUYcHxkymzYM3ht74bc5+5iMP+OWOGZri5YmMeaxM6VOgmEOXR9AK48 +b4wED0d3L6JQnG19PbJ9LAn7XXp+7ZQksZrPDAd1cChJaLRdAI77n6y3 FXhTMI5OK2uRw1VqEDjQdxz2vizsFIdVtKsMlHKdImGR7urKAJ1vuvYrO g5hssVpni75MxAwypbsyDrINidaKbpaBsXCx5kTVTqTGcAV/11idyviCZ g==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99165978" Received: from mail-cys01nam02lp0049.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.49]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:25 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSWx3Fj05GOAU/fJ3C+QpBnlwDbMjpAjdRi2lx4jWmw=; b=ItkntzRkwAnDk/ubWs4r5nltZV5FXiCnCCu4RO3k0xpaqasirwweqAtfTTuAbHFdhreWm8XPYW8x9Ke8GDoXEbJzgCgv028ehGewhpe0OhA/QBvXMk+MvBJ6iQfiEosnDhyzY24PV9TgaAutGTCItn5sh+fR2cZEWvFjWNWYWhM= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:23 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:23 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 10/23] riscv: tcg-target: Add the instruction emitters Thread-Index: AQHUfTN/CP7mr4nG70ueoLUfKOBFFQ== Date: Thu, 15 Nov 2018 22:35:23 +0000 Message-ID: <94fae434261439eed18b5ecffd2e8c959f80cdc0.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0041.prod.exchangelabs.com (2603:10b6:a03:94::18) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:EU8mOpjGWYUO+RSsNiuFzidXHk8GUdcuY5RHP4Mb7Oj0enqWpfPICmVDdlal4qsfAoM0dVqB6/VcClD3B8g5O2FXPjgbXa4kg5TS7y/ZuGwSFedJT+xOKibvZTSM/tTEH4woaQ7fEAYVD1syxfk3CpVvh/VVxckkx1LoC3xXV5/1UwRgfvn29MWXuDL+WFuHSnOH2Qo0A9deXIxRcQOsaQt9wXkVBr631eJHEtpIetv/9ev6EwMWBDyRYmwFDIWOARxdnroYpzDeo+CRB06AcASoQvSr/QOuktjLfONokL8kQ8R81mdVROR4w2oKqDP3VQwwfLH1celOJ1YFIk+mkvGM1IHZcaj71tViKIaE/gxVYJpC1DrBT0D4LhrB6QiZdINP7HhyDU6Mcjp5lfqp4wHHxQWgC72g/UKXLO511rsGGxLZquim0CdzgZhgO0lwsQivMUSMWVsJr+elRLv07Q==; 5:amIIAwpF+vfdxPXTkPNyYKGgyeEOxtOA3LG/bwCakOQprEF8QXs2efzrKSCtnymomMwmEQRdqHkAooMzFWk38Z8Cp2GzO/1SOkfitHI3FsaWkZG00lW0C6Rnf5pi5D5YfN9G9GzN3F68QvutsEcOq/1byjVaCBGSsO7bPmv01/k=; 7:5eVwrv9BxOq7jM0TenKvgDQuDxf2enON5XBv+m0ZvHhvkJiaIaHjWyHBPcI0SgSKlu9V/ZDh5hjzsvILrrKBVCScG1quOLHWOa2Q8U9zRYYC8/ipuWT1fwo91PrdT4+wvf5HElk27bYTHdTHRaRCzA== x-ms-office365-filtering-correlation-id: bf1cb600-6dce-4a58-fb62-08d64b4aa1bc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: us6RIFIsYRLry7qLE25srUvCknACCAtxmP179fnXSiyUDRaG8PfKf4+5ZmO+UXPBgL9w6mHZhoE+Sd5HOp0AIcBejJAH6ePgAUhJKJxGFoNB/Q93oKCagHXY+GVJ7zXQ/IjrHd6xrkFcKzoZK859wPyfU41740aclArAGZD1VKZzTi26rGWvMlKg8OouWF2FEFT16eVu5GnuGw5BiTtq12ri4B4qBnwK8IEyMrKQaBs4NY0MTDN0UvbUbJ7bGPlYYnQwYh1LIYrjzkJCCuZpxYQsjIy49yW2KUdB7YY0ImLQ2cKjBME0s9R43Zjdp6jKFZv0svb2+C6S/kWG0tAQ4fY/wzdQR3Tih16GzytqhmM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf1cb600-6dce-4a58-fb62-08d64b4aa1bc X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:23.5866 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 10/23] riscv: tcg-target: Add the instruction emitters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 5319f7ade5..d402e48cbf 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -331,6 +331,46 @@ static int32_t encode_uj(RISCVInsn opc, TCGReg rd, uint32_t imm) return opc | (rd & 0x1f) << 7 | encode_ujimm12(imm); } +/* + * RISC-V instruction emitters + */ + +static void tcg_out_opc_reg(TCGContext *s, RISCVInsn opc, + TCGReg rd, TCGReg rs1, TCGReg rs2) +{ + tcg_out32(s, encode_r(opc, rd, rs1, rs2)); +} + +static void tcg_out_opc_imm(TCGContext *s, RISCVInsn opc, + TCGReg rd, TCGReg rs1, TCGArg imm) +{ + tcg_out32(s, encode_i(opc, rd, rs1, imm)); +} + +static void tcg_out_opc_store(TCGContext *s, RISCVInsn opc, + TCGReg rs1, TCGReg rs2, uint32_t imm) +{ + tcg_out32(s, encode_s(opc, rs1, rs2, imm)); +} + +static void tcg_out_opc_branch(TCGContext *s, RISCVInsn opc, + TCGReg rs1, TCGReg rs2, uint32_t imm) +{ + tcg_out32(s, encode_sb(opc, rs1, rs2, imm)); +} + +static void tcg_out_opc_upper(TCGContext *s, RISCVInsn opc, + TCGReg rd, uint32_t imm) +{ + tcg_out32(s, encode_u(opc, rd, imm)); +} + +static void tcg_out_opc_jump(TCGContext *s, RISCVInsn opc, + TCGReg rd, uint32_t imm) +{ + tcg_out32(s, encode_uj(opc, rd, imm)); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:35:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="OsgtuWhu"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="TYqZIYsY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxF54b90z9s47 for ; Fri, 16 Nov 2018 09:42:01 +1100 (AEDT) Received: from localhost ([::1]:41124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQKl-0002we-6N for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:41:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEj-0006Sk-3Z for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQEf-0004JF-Qj for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:44 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50579) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQEe-0004HM-DI; Thu, 15 Nov 2018 17:35:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321340; x=1573857340; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=l+ujCgPOmT211aML+1JGK3rf/aNtC3GC8ysSDC9sDyg=; b=OsgtuWhuU7cD+oXXx+bE8ZAqy4zF3+QDDeIyu8Bl7YU0J0FB+Zha3WCQ K7SlcCJhAMNE58y3f8soL2FS4R/BlUPS16udCVuXyg2O/rwwJwlE80E+P /Ry5bhCH+ebWo/8W7Ci9TMoN9FGUUO0QJKAE10tJm24cwDzBsHRLXtW/W e7o3ddJNKZVSyD+wBs98b7WuMViLlF6U61k3xLefOB3UK89G/nY16Am8J WrPB/bFa8Gr5zCSqeawgCP3Dh3QZsMZycC1JsNha8K3/d1TeGDvjNR1gU xNp/n4B4ElehZUGDyI3Y0Me/jy2JIYOMGwUAQIk6yibvIMEMyxyS4lY8Y A==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523354" Received: from mail-sn1nam04lp0085.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([216.32.180.85]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:35 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9/8vslHKT722G8aL3pV02p/sQjZmzSkxYv7E24Fibak=; b=TYqZIYsYlBjG1qLLRsQT+fcfBmffoqRgRlJeXmsqK9+fz3epHiIm//qx5fbuASRQImBYtD3HhIrO9sK/BGYUasOSPLW1pF74aQv/7CHBUnFLItzcpzNsRRpNBkEDUWg/t9BCmh2NieyTFm4RcxsQqQVZNpKNrJYWLHwqjRHo1Zk= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:33 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:33 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 11/23] riscv: tcg-target: Add the relocation functions Thread-Index: AQHUfTOFv1lIcwNF/Ue0BfAzy9tSQg== Date: Thu, 15 Nov 2018 22:35:33 +0000 Message-ID: <1fe9630dd4ad73b8581684cd0ed6d5fa2918390f.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0031.prod.exchangelabs.com (2603:10b6:a02:80::44) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:LgCKAMYgDvnPWgRG1laRpQTZHnmeMiXIrSyDaTcBgTULzkXTArTpdAa5L1Bv1YqyyNMpbCRupJLuWjW5a7dhSz2dpkZsX4u9zP/HB6ARGXDN5GR9eZiAEv5/NM5hyFA1Y8YEtLHxey/p04qcYQIIHgdiyzN/cJF2Xybf4g/pPi894ArkCHlEbSferc8MRvSD3b5z914a8cqtFa0W+UogFqRIDrkmXySLqU1mi7ilPCT6r0BLUPvw4TavJL2yCqIOSMszqBU316friUocoRdVvlNcq3RaVeTXdBOYvs6kEwjgNL/T+zzxgJ5BFG8APVjV4SHK34ThLY6enHNNrRGyl9oeXo9yi6JMGQNH93oesAM4Tl1OD3+mE9LXiMFcoxHErgapVjjJzml1EzYPVs+IA1qW3MbgRwfVkVVz6oiIGUR+y/RXOj9Q8Mn5KLbtjQyh3dgHqUPxpXTSQ6cK3NtzoA==; 5:5L6RIpmBxnW2c+iCo2EBzk0yWtLnS7yg+pRMUMJQ4qCnGj1PEx3LOBFhwm0vQuqT7lhIhvET+ik77ZhlwSZY4F8Hb9NEwrOf/BdG8j3OIkWmrR8wYvbzdWyi4RjZY2uhqHb/mT1pugSbQMs+3L/vBlfV9O+MwbhZOMk3X37i5w8=; 7:tmHsOATLpdFQN/32dlIMMHvriNWyaU28mto+u3k4S15mrgxsA7Yqsfv82703BYKsz2Y3ZeR2jAyMYVsmCTFt1lUPL9ePqtdxluc4dEOpJ55h91K7vXemKyWBXrlkAR5O0C8aCrJcJNPzYTBid1w+DQ== x-ms-office365-filtering-correlation-id: fd4d17ae-62c2-4d70-0e8f-08d64b4aa779 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: dBN1SE7QOdIpAQqYE56vap8rXI+lNFdElUSAcwLqDoFllUqUJJJccLpPnTUxGjyH5ZlgvHIo23cDsBnNDmXReVuRxGGaO/IxOrkBO4sD4pL1PF1HRjrKv2fBK3Ksxn75FFaxzzdbzTh17Aa27WV9KToZqzLusSWsiAlM1qtT5/ExBzhCOdTrdVVip4Pk0+nV7XI3BxPw8NFcKIno+HCtMUeDh48KBf7yL1bdy+Koja4EGBVgPhlCDaAmNOI+zZRpWxZjD0N2/TAqovyROxoOzgdAV1hV4AAgkSdxA6BF0IDNsIcUXS/9J4m3sXyeYn2za78UTnbpUgr9mbcgKqgIXpxmQVKX3sgMAc1rG1Ex7VA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd4d17ae-62c2-4d70-0e8f-08d64b4aa779 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:33.8673 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 11/23] riscv: tcg-target: Add the relocation functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index d402e48cbf..475feca906 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -371,6 +371,57 @@ static void tcg_out_opc_jump(TCGContext *s, RISCVInsn opc, tcg_out32(s, encode_uj(opc, rd, imm)); } +/* + * Relocations + */ + +static void reloc_sbimm12(tcg_insn_unit *code_ptr, tcg_insn_unit *target) +{ + intptr_t offset = (intptr_t)target - (intptr_t)code_ptr; + tcg_debug_assert(offset == sextract32(offset, 1, 12) << 1); + + code_ptr[0] |= encode_sbimm12(offset); +} + +static void reloc_jimm20(tcg_insn_unit *code_ptr, tcg_insn_unit *target) +{ + intptr_t offset = (intptr_t)target - (intptr_t)code_ptr; + tcg_debug_assert(offset == sextract32(offset, 1, 20) << 1); + + code_ptr[0] |= encode_ujimm12(offset); +} + +static void reloc_call(tcg_insn_unit *code_ptr, tcg_insn_unit *target) +{ + intptr_t offset = (intptr_t)target - (intptr_t)code_ptr; + tcg_debug_assert(offset == (int32_t)offset); + + int32_t hi20 = ((offset + 0x800) >> 12) << 12; + int32_t lo12 = offset - hi20; + + code_ptr[0] |= encode_uimm20(hi20); + code_ptr[1] |= encode_imm12(lo12); +} + +static void patch_reloc(tcg_insn_unit *code_ptr, int type, + intptr_t value, intptr_t addend) +{ + tcg_debug_assert(addend == 0); + switch (type) { + case R_RISCV_BRANCH: + reloc_sbimm12(code_ptr, (tcg_insn_unit *)value); + break; + case R_RISCV_JAL: + reloc_jimm20(code_ptr, (tcg_insn_unit *)value); + break; + case R_RISCV_CALL: + reloc_call(code_ptr, (tcg_insn_unit *)value); + break; + default: + tcg_abort(); + } +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:35:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="kZiq/WQc"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="SE/Fc8rz"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxJG2XxTz9s9G for ; Fri, 16 Nov 2018 09:44:44 +1100 (AEDT) Received: from localhost ([::1]:41140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQNM-0005Rp-4Z for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:44:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEn-0006WO-3G for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQEj-0004LY-MB for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:49 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:51936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQEj-0004DQ-AD; Thu, 15 Nov 2018 17:35:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321346; x=1573857346; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=AOLjCZ1pKpsR3zCpDIHavhJIcfvb+v5y0dLxL2pzpus=; b=kZiq/WQcXyNgWqaLp+FLFOh+1Z0UhTONZhPbo+rzZ33uTxZ+cBkYV+T9 JA0iS69CNpQm8FDpOitv8Cr+ghxHbC+3Rxy9KVScFZdRJszfP8CuVG6np Rkg6WhDcMQAFyi0kam42sxXTXgvfWnsjkj5hGAlnTymXVanPOsN9cAET1 pcTzSxk/E6toEa8sCcVEvxPxhjP45yiIICog1Oy3r3XFA8NDOULtPm0MV /CYtQBm0jEIbKygaECgkU1IMyteUwYHC5LLWqTdOzaeIptxfg2R0SUUbq 2vbTKKZDbyVRmEaeociD5eFKC63teEOnWvPSUzlfDulCSofvcwFYM9aHZ Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99165995" Received: from mail-cys01nam02lp0050.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.50]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:44 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4fDw9mTGC5O73+osINk7IKoou/giQLbA4a44TrLVUoM=; b=SE/Fc8rziY32Mh8EufYfY6+bS/AngWN+mcLPqcoVtvk2a7Ozb/7dXdh8aGCMubSqVz+J5ddn18tW1fQ4hNEFpx6Rgq9WmJ/LofdmwJ4Y3tDc/7QthCi4eN9E+BBPDLbcRRpT7679mOuXms0P95IVeYidPczem+J+TZhPSeSt/U0= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:42 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:42 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 12/23] riscv: tcg-target: Add the mov and movi instruction Thread-Index: AQHUfTOKOmARBjELb0eMR9tXjZs8sQ== Date: Thu, 15 Nov 2018 22:35:42 +0000 Message-ID: <51aa21df48c5d80484bf396b82d9e3943daf1e0c.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0015.prod.exchangelabs.com (2603:10b6:a02:80::28) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:/kFjbVpp2bCrem9NXMxKWDD7AbrYBvsnkjzWFzjg/nnQYqGdl1FWLqXF+H6ThN8IbIGVshnTTo7CKADmUl4lbYM/4S996WH1/e3EZ6gkYtNyIOtc/RAV4AIDrjVYtLt5sWt8AmfygA3PKzxD4iCf+bGT7UTDyEfH8r+7d4f6BGcV5ORA+TTfXM5c8GpI5fYnuWd/5D4YITu3E+4Dti4FTPywImfDHJW6II68MJ5pOfzPbjMRhK05u4XcENVnd13Re5erz7y/pS3jVr/tGGYI/ihTLgbdWfvNx3Y+S9Wk+htWnwGWIuGD2hRtOQ3ER55iJqy1fKtg2YL9B6urPsB7FWsqlgXLUoHxSACa/bIEpPcZLw6hjPmmoaPIejU5ZZM0Jnx3j1ZVhgjy++5bUnxvEJ2roSztSDykRImATvlFEIHXlyPg6Y2k2+GTsua4p7AgYf7+i19gCGizwhMcrjPwxQ==; 5:WL4J/4NmlqhZ7Y10yXGjD3KbsJTNX3ekRNKdK1iRhX6XY79Mpvi5Qz/xqPd+TT0db40mCyVsqDm7GkNXFs1KPzM/NjsCm1tTSKl1bWoAoL2m0KUNJeOTyjsfFEpb3pEATi1wxihePb3mVNjzAllnLV0z8dVRZlbGhui1eqpk0Ks=; 7:dgrx81nSv+pPg46vvAIi9fYSYrmH4JWw5xws9whytwLqDBXet8wbayidfSzJIcYu7HRuvUHfBAWgPIm9BduVD967pTlNmleqALNV5PDfquiLb6fsIhB0RdOoV9WNzi2EA2hnEixwRcoG43q6fnip/A== x-ms-office365-filtering-correlation-id: 085b3957-1f00-4a66-d38b-08d64b4aad34 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: 9J2hwc3ospTP6vgUxqXjM24ZqLDdwLerrgB4R6D+ZmViY9PBYjAzU3yMhSQ2A/FNf3ybPl85eQJA3xsHK4UcdGlAwDudUU1CeiUvL2zgawb8+5xQW2CgBoSNDayreCQdonTIsCT/jrbWWJwiB1wrF/uEUlxwQ/YYrS4uPgri6b1kygIsd1k9v5eC47wWLAf6fjUKKLfuZ2YTnG2Wyv1KptE4Dht4fRenbtvEjZWmEm8ObemLeuL0WR1n5MRVZVNPIIPS6+bq4tW97+O/Bk3pC1eoDyT/l8PbFKPWXZu7Gaiwbz5pRE3+7ief4Tu/D4R7mtJiCd31vpgoKuJ1pja86JE38IWc3YrAmgtXxCRmYD8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 085b3957-1f00-4a66-d38b-08d64b4aad34 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:42.9010 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 12/23] riscv: tcg-target: Add the mov and movi instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 475feca906..0e891e24c9 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -422,6 +422,68 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int type, } } +/* + * TCG intrinsics + */ + +static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) +{ + if (ret == arg) { + return; + } + switch (type) { + case TCG_TYPE_I32: + case TCG_TYPE_I64: + tcg_out_opc_imm(s, OPC_ADDI, ret, arg, 0); + break; + default: + g_assert_not_reached(); + } +} + +static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd, + tcg_target_long val) +{ + tcg_target_long lo = sextract32(val, 0, 12); + tcg_target_long hi = val - lo; + + RISCVInsn add32_op = TCG_TARGET_REG_BITS == 64 ? OPC_ADDIW : OPC_ADDI; + +#if TCG_TARGET_REG_BITS == 64 + ptrdiff_t offset = tcg_pcrel_diff(s, (void *)val); +#endif + + if (val == lo) { + tcg_out_opc_imm(s, OPC_ADDI, rd, TCG_REG_ZERO, val); + } else if (val && !(val & (val - 1))) { + /* power of 2 */ + tcg_out_opc_imm(s, OPC_ADDI, rd, TCG_REG_ZERO, 1); + tcg_out_opc_imm(s, OPC_SLLI, rd, rd, ctz64(val)); + } else if (TCG_TARGET_REG_BITS == 64 && + !(val >> 31 == 0 || val >> 31 == -1)) { + int shift = 12 + ctz64(hi >> 12); + hi >>= shift; + tcg_out_movi(s, type, rd, hi); + tcg_out_opc_imm(s, OPC_SLLI, rd, rd, shift); + if (lo != 0) { + tcg_out_opc_imm(s, OPC_ADDI, rd, rd, lo); + } +#if TCG_TARGET_REG_BITS == 64 + } else if (offset == sextract32(offset, 1, 31) << 1) { + tcg_out_opc_upper(s, OPC_AUIPC, rd, 0); + tcg_out_opc_imm(s, OPC_ADDI, rd, rd, 0); + reloc_call(s->code_ptr - 2, (tcg_insn_unit *)val); +#endif + } else { + if (hi != 0) { + tcg_out_opc_upper(s, OPC_LUI, rd, hi); + } + if (lo != 0) { + tcg_out_opc_imm(s, add32_op, rd, hi == 0 ? TCG_REG_ZERO : rd, lo); + } + } +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:35:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="apmKBuTJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="SDRC1KTs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxMm1RVfz9s47 for ; Fri, 16 Nov 2018 09:47:48 +1100 (AEDT) Received: from localhost ([::1]:41159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQQL-0007zz-Lm for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:47:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQEw-0006fy-2O for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQEs-0004Q0-Ri for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:35:57 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:30522) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQEs-0004PI-Je; Thu, 15 Nov 2018 17:35:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321355; x=1573857355; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=OPngtHVZoZPypiAfjv1S5ky1efE07ySExH+OP1PQCbs=; b=apmKBuTJfxypBJu0ewnyfAv+HWL/HAI7tLEWWOZRWiHrZuJLoyLC3plq ikxMN4R4Im2JyqIv1y0MbxXrXg8p5I/LYqbDsZ5/FK109af9Lx6613G/o dsS4y+CElWUrRyMUWEMMuABFWKa0SRmLysFG1MgIvh9jkDzHKqqGzH/Rv 9Ke080uvea5xZ3uBNxx8lqWGdgUgm5dK5tJ84LO8mJhHM0NJUrwyzasNT 2GLjpOiTMfB4Mnsy4wszGll5uDnZlN9lZ1kNmWPTGdtGbbgawz9nLIcN9 nShepnMy3wQ+FAbkh9u4W4ybNUrq3LSAkWjbeA54NvVwQYESdkF6K6sn4 A==; X-IronPort-AV: E=Sophos;i="5.54,499,1534780800"; d="scan'208";a="94368145" Received: from mail-cys01nam02lp0053.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.53]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:35:53 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HFvvkqiaDdvnUblhmZExaFI970LD/T93Fi603t5NQpo=; b=SDRC1KTs4NNLrNwTUJRzAxZD6yvVudKdzZ6R3ubsm8OyO/2Who1pOTSM1gK9/bIdGqKOF0K4B9G2ZRHuXeXByIIS5bWcnZdL4Xf8JB3XBNR1PZMREHE4IyI827PCqGNuAQFrgTGAY+YkxH1ZLTDQ1ZW6fNLrQccG4XnYhl4TWXg= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:35:52 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:35:52 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 13/23] riscv: tcg-target: Add the extract instructions Thread-Index: AQHUfTOQXilcdrTNx0KynLBujJmCjw== Date: Thu, 15 Nov 2018 22:35:51 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0030.prod.exchangelabs.com (2603:10b6:a02:80::43) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:Mbom7FXmfqHo38Vsc9GnLay91lFSCk6NpwqeOt7ASEMu6WJ7/HCA8hnv/BAgj0EHAevRMPbai4dRyNzHXbKFatXHtH8wUipjuCKAwAzZfZVVyTjDgz6Xn1BqXPojYnLVR8bgMANPkX1LNj/SI3KW83hlavXbqdee4gLOOysXni0M/BFBDRdeNHJEn1AooTbdecNP0fOitXf/hZg/wHnv7o/hKdrGWerpY6ebk7eQ/P/B3d5aM6Otgp55e0jgv8o7nDBH6hXQpa7/eaWQ51Z41Fa9ShgC6zvF2bq7mhLuMBOPnDE0GeWsLe7YXZVmDnU790P1Pyz4Xd2wBA0gUjDqIoTLW6GLyJRXoTiwSkTV7SGlOyG2GnwxItvvQZ1/bvbgbJ0QHSdMEtNkVsNiLBoUgV0WjQHD3vW9eBtVN52MqyoWZepOOTWZORmOiLbEVtP1ZbBtEb9gjmanVfZ+kucHvA==; 5:UPasHOOkyEXqH5HK34dRv4RfTlm+Aa+muZ6UWF9EAGZ75Hha/DpQBcaF4+qRyMwUYlGgzyNRNddQ6bctz1vqD1rH1BTcBLxmoir/wmjONgfRlBoD83PZir6pFPD0o6Ch6LL38LvkIrihWGn2a6V1B11qeR0wcgFRNeilWAhCu20=; 7:smzVeS/w25Af8h0/TOOOvMdj51SRa5mP24JSxidWf032P00Dq2tDcLU6imPkcGZEfVDBMVK2oMPDwc+mu7Gq4RWtiiN8OQ9RXkl9N1fDplIzx0DwGO/O/m5opH/5lu6RQ3883SwazN9X2AkJOpfZrw== x-ms-office365-filtering-correlation-id: 90644d2a-5cc6-4295-7931-08d64b4ab2a3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: TUraxIvE56vO61zUvOLlgIh8llBCb81k+cyjagsDXADcrRS3GijRw5b03EY3GafYZJmaCE1Gcizg/S/6OzRjuzOW/U0+/ohKeKUwD4Vfs3YX3mPVlnckQm0XOGm6qai0Q9yKrwLCrFbStvAP1CCwoekkb/GUM0ybBkaNFgH6WneZq8IcxncOC/CbDF90+A0sJgbqwDK5iWVpU9iXFU1kH/v6N5Vn/tGpC8GdWAN/Wg88Ux0oMXKzOWKozPOpknw1kF915GSStBmGcvD6wj8et0w0w+AvZ2uhcTFFOMGZBBg5wJl/bVz9FM+IpGWvi/FYLNrQ+2UCO25PRXOPeQPZ7/UT19Mxc0DcVzgYevjdKmE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90644d2a-5cc6-4295-7931-08d64b4ab2a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:35:51.9427 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.154.42 Subject: [Qemu-devel] [RFC v1 13/23] riscv: tcg-target: Add the extract instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 0e891e24c9..646a4d3ebd 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -484,6 +484,40 @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd, } } +static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_ANDI, ret, arg, 0xff); +} + +static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_SLLI, ret, arg, TCG_TARGET_REG_BITS - 16); + tcg_out_opc_imm(s, OPC_SRLI, ret, ret, TCG_TARGET_REG_BITS - 16); +} + +static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_SLLI, ret, arg, 32); + tcg_out_opc_imm(s, OPC_SRLI, ret, ret, 32); +} + +static void tcg_out_ext8s(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_SLLI, ret, arg, TCG_TARGET_REG_BITS - 8); + tcg_out_opc_imm(s, OPC_SRAI, ret, ret, TCG_TARGET_REG_BITS - 8); +} + +static void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_SLLI, ret, arg, TCG_TARGET_REG_BITS - 16); + tcg_out_opc_imm(s, OPC_SRAI, ret, ret, TCG_TARGET_REG_BITS - 16); +} + +static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg) +{ + tcg_out_opc_imm(s, OPC_ADDIW, ret, arg, 0); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998614 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="LHXCx4Ge"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="aXat+Cq0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxRJ5nxgz9s47 for ; Fri, 16 Nov 2018 09:50:52 +1100 (AEDT) Received: from localhost ([::1]:41181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQTK-0003M5-C7 for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:50:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFG-0006wG-FI for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFC-0004a1-IH for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:18 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:51983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFA-0004ZB-RA; Thu, 15 Nov 2018 17:36:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321373; x=1573857373; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=8/Rk6tVCpy6MUHXed+WXJxV2NAZPuHUqOCWACo98NAo=; b=LHXCx4GeBZwkf5BN/edH+lq3PQcDnkBTpbo+Cw7xMgKBJ8A1inL8dI6O r4h6FpZtKJjBbpgdjAiKi1fCCz27+rfoeZckfCkoAw+byvRr5+Z2olWcg h22Mun//akSbiXPP0EX9JeCldYOquFNRJLPEQjH81AK32JB4itI6xxpCn WVgPccKeScS+key9GY5El8LjE81gS6nZvPD6sNZ1l4Ir6xO/pHMPAEhpD nAD75JE73Bqe4CEzmoPAHkhWmwQotXKlDKjxyor6/O4N56idfkd7XgDbE adGIsTawlOmd38Ri4jAu+nIg0ONsY/TKX2bJNLHJQwDimB0yB49o9siJu A==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99166009" Received: from mail-cys01nam02lp0050.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.50]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:02 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=24cG47hRjCzxAS+3zSXXrBJWbfsGhHTnNF9RDpxN58Y=; b=aXat+Cq0DA/+oS+7PpqY8UVtcHZzEUxRy57AhYNprnMBHdoxnnvxg2oYWH8QRfEQ9WPYvWtCtDOTFKzGJjF2TK22iyqwQLSZcGZNWMgM9BfGytFK/XdJdTemAnHDKn85+CP1iwEBaDDfSbmnFXLuti2eguXDEzKYo3NVDn7G4ZU= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:36:00 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:01 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 14/23] riscv: tcg-target: Add the out load and store instructions Thread-Index: AQHUfTOVaruRtxqVIU6Srehedirs0g== Date: Thu, 15 Nov 2018 22:36:00 +0000 Message-ID: <7961f2bc55e109ff10543c4665c5cbc3c75a5bf7.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0024.prod.exchangelabs.com (2603:10b6:a02:80::37) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:OSY/ECWBP9kre0B7cM99by2C8P+qPUpHpleMJPn/iESIvbhnohVBn3FqEhKcbwP2MtAuAzFrl4lfT1HypqhIPusbDjUSrsO0uronM2rbTjjB3SonAiCPCRhPDM+DO+pZT+8Ui+dTmCwHzzeabCS1kHXIffwOUrJHTvxv604JBcSiRYFKzHFaXhp9/IJY3iTCb75I4dVqXzKSEGMkUGfCKc89bLkuRETFmh+ZfFnHDssWHP+u33pnDoMrFhUalmBWrBY+6KftwYpT4PZ++OradAxrHKr26OeQgYxOG1427uiZnoEurVO04BHtF9jdnI3XElKC3E7aFIzp9lGJQk10j7Oq4WmHKHxL1hgxGxarW43zK9orHyTGMTU1+Cdv/LgpqAk1TXnHJ3x6Wi0ffLwlGvKZBQwC0clUch2zMXbNfXzBOdxA1EoE0VT09cT0hjR+zHkNr8xAgCOJ9PB02EneaA==; 5:qrLZP4JF914dgPJIrZ/FfufibOLyGiYzo/fw5xC9OXFPbWU567jHk/yTLR3SiqrlHbi/+aqjbzg7romI9ewXYdzF0iEmpXV6O6/akexRmxVHpb2K8lxEDrJ+fMC9SnAo1NPqeprZdse6/qYEBnxFivt24yNhTLwoxOVd3kWN75Q=; 7:hZq0+Up02vcfOfaTIi0H1bFDrIFmpI4xiHSK71uZ5YyqLZ0k9SrYr7AFw8U93x25klxDlRBvVm53XnjGYMxAnsSoq7eKj9v5hVNH6rZSzS/WoxK+z9Hoa5dIOHSSx1BjFyzO9o0v2dStk5QGxQdIoA== x-ms-office365-filtering-correlation-id: 0e9b4a48-ad1e-410d-832a-08d64b4ab7e7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: AXf0J4sPagDzLpaWQFQ4qziKd+5eqctUfp6F+F0FfGvR3U+PBMeXF0g2lp5M2qsi5vY7dCoxx44iPGItkV2NMPr7wTUmdGFHGWtPknojq1Td2QSok5bU4GrFAzIoqs9eaMGc7G/GmD5IDNM7bcEHXeW7zrzsrWAxijAmWQsh0KwqtWL5iaHOznQ6EB4bT6csKYbhKzkP1OrE3nRvOdhKzcETkxJB1xCKZeKNS12hrDH1n4GG0RtJ4mzpfGbWbq6WAFXqs+I+Hr5mFs22IAqYGC3zHKtiK9F+EyrROUc7/9z4ScCdfurrcXAHs6vVD/yjiLQH8i01AJZmocvOPcUGhXJ33XAfRSYOsBB61oATOxU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e9b4a48-ad1e-410d-832a-08d64b4ab7e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:00.9013 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 14/23] riscv: tcg-target: Add the out load and store instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 646a4d3ebd..bc433170c4 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -518,6 +518,62 @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg) tcg_out_opc_imm(s, OPC_ADDIW, ret, arg, 0); } +static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, TCGReg data, + TCGReg addr, intptr_t offset) +{ + int32_t imm12 = sextract32(offset, 0, 12); + if (offset != imm12) { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP2, offset - imm12); + if (addr != TCG_REG_ZERO) { + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP2, TCG_REG_TMP2, addr); + } + addr = TCG_REG_TMP2; + } + switch (opc) { + case OPC_SB: + case OPC_SH: + case OPC_SW: + case OPC_SD: + tcg_out_opc_store(s, opc, addr, data, imm12); + break; + case OPC_LB: + case OPC_LBU: + case OPC_LH: + case OPC_LHU: + case OPC_LW: + case OPC_LWU: + case OPC_LD: + tcg_out_opc_imm(s, opc, data, addr, imm12); + break; + default: + g_assert_not_reached(); + } +} + +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, + TCGReg arg1, intptr_t arg2) +{ + bool is32bit = (TCG_TARGET_REG_BITS == 32 || type == TCG_TYPE_I32); + tcg_out_ldst(s, is32bit ? OPC_LW : OPC_LD, arg, arg1, arg2); +} + +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, + TCGReg arg1, intptr_t arg2) +{ + bool is32bit = (TCG_TARGET_REG_BITS == 32 || type == TCG_TYPE_I32); + tcg_out_ldst(s, is32bit ? OPC_SW : OPC_SD, arg, arg1, arg2); +} + +static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, + TCGReg base, intptr_t ofs) +{ + if (val == 0) { + tcg_out_st(s, type, TCG_REG_ZERO, base, ofs); + return true; + } + return false; +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="HZcl7tlJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="gEHFNYVF"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxRK6zftz9s9h for ; Fri, 16 Nov 2018 09:50:53 +1100 (AEDT) Received: from localhost ([::1]:41182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQTL-0003MS-Ae for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:50:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFM-00071P-IC for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFG-0004bB-CI for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:22 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:51983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFC-0004ZB-Rp; Thu, 15 Nov 2018 17:36:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321375; x=1573857375; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=l2D91ok9bj5Bq8yqkfcErVS75PMxZ0TMIn5akYcKhRk=; b=HZcl7tlJBf/CeNcS49HxCPVZA/3F84doLeJ6G+PNyyyih0uwW8K0rzUm gbwqWL8Mi+EJ7t4o4iddI6AnsWlfPF9qrvV0Hm3MAa1GdmJzHK9KIhgN4 84CSDqB33u6fXK0u8MYwGA+m/F+VgGitfPj7V16uD5IeqhafE8q6R0C8n bHdA96jfoiqZW+d4MP3epjpXWv7+nN1BsTE14vss2gY3Gr9y0L1hzG1Fq CqcvbdAEQJysGEeNrChGiBLdHkkbfwlsKbzN+NDwh6DDONDCjFrYdmxBA YuWzIvWCq0l0wLZ1JuT4bMHPYYHyif/k+xEicshYBLxnf2qwZ7Hqi/wQU Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99166012" Received: from mail-cys01nam02lp0055.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.55]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:11 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O0qbyDdDW9I9k2f9TcXw/E4e+6XMQPs3aFEaLOvXn1s=; b=gEHFNYVFAXV+AFkVvf5k/oEcV/PUi2I/Ce12xc/lxx2Auvw/XHLyfhMPKoW56CymdMNyxhzluCo7olSjQCcIBCwVOV1nHA0mwLF5MKGlxCa5Q4JUkwLRcqS4u8YHKIewFx/GnmKZxQ0g/f17UHze0OQXrVL6z+AKcnWVFz94kOo= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:36:09 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:09 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 15/23] riscv: tcg-target: Add branch and jump instructions Thread-Index: AQHUfTObyEVruEKS7kalGAj8IcAptA== Date: Thu, 15 Nov 2018 22:36:09 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0021.prod.exchangelabs.com (2603:10b6:a02:80::34) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:rSJIupYVA6IHXfpTVx+hToVbBd9mNUelo/6t24ilB/INkzEFNDTkRK5YxBOagaWy0Ek6WkpYG6pnLGfEtv2Fx9owmY3HflmK31YmHRwj6mO4D8bB9OhSIjrH9IC+SjJ9ZLhKSjncNsnVYMNg/PEsAvIvh77vzs/sXXD1WY0eaYHSnYEVG5tQvfqZmrbzVsLyM6I+ybnPu90Zm4jl2CY5QyOk0jCU3wvcpgZvsBAgdsb2fGtGFiXRHcOIB0TwewdyOxzbqfVZUVa8PfpHkTPNHF4/JH3bfjmURBel5AkogawHOi3n8caz6RuJeRitJ4r0cD6RruONVEZUKfM2BDeZt93jsm+MAaYKPVZa41iw9oJeoULTbYb19kWoTkVCfAvo2Qy921wH0pqqVxhcgwFxF+1bJRuCW6AYyRau4p2XxPHGpcxlxHfdspiioA6zq8LnKHJYMvx9g2c3Ve4BJqk7XQ==; 5:cDkLs05P7RqgxD5MTI1HImUnw9JoEmDBZ5uheK9t7yvCWFe9cnpbQs7BgpRaumCAYzquMrQ5vIbbtM9BKu6IbenvKAsvsZdW0MnGj2gLJUTlrZZ+Pl3kfeisozNfpbjHRlw87a+pnEGxnYI1ViZ68NLTj3gCZC2j3+ubZx6csXM=; 7:FwALckinkyrZDHGInaY6AZ9FYTgeCD33D7htg8gPMb6YazadEIn+AIkQjDfIpExXwBuIhP0zb993UfEUpoXPbbPmtJUNe2qqhpbMPDgm5DkA5ghjAkJQQ2WYzmd9obvDdcVPGZYPDSZbq87vm9P7XA== x-ms-office365-filtering-correlation-id: c1888ee3-83f1-47be-6551-08d64b4abd55 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: eWugKtETriBzpcZFasGaKWifc0/fj3isQIyT0Ne6ueyzS6J8uqC++VTQWdz1CTOHiazdTx6Ke9vskqvAFwi/3zpiH6oJP1DxKFCJlcr6+C1CexeXlq39m7fm5EC5+dARfaCJI0zYStLeiRByCp74StBGhPHEJUpRf1f/W2ENS4rFOISWu59z4+l6sPYZl3hl8K9NGBSWaigd69zaLPo0+DzyKN5KjaIjrk5K7c0sduvSNXIDwYwZO00LTvc3fxRPny6Or6ApAdIlU5Y7guXvx7zObRO61VOR2rRPrAVglebZ9noPkH/dhqnJcy5A0PM8gG0kJ8/SMjN+6UOgl9x/dRxjhU37QrVZTWhG2T2XL+A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1888ee3-83f1-47be-6551-08d64b4abd55 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:09.8840 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 15/23] riscv: tcg-target: Add branch and jump instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 144 +++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index bc433170c4..b449e17295 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -574,6 +574,150 @@ static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, return false; } +static const struct { + RISCVInsn op; + bool swap; +} tcg_brcond_to_riscv[] = { + [TCG_COND_EQ] = { OPC_BEQ, false }, + [TCG_COND_NE] = { OPC_BNE, false }, + [TCG_COND_LT] = { OPC_BLT, false }, + [TCG_COND_GE] = { OPC_BGE, false }, + [TCG_COND_LE] = { OPC_BGE, true }, + [TCG_COND_GT] = { OPC_BLT, true }, + [TCG_COND_LTU] = { OPC_BLTU, false }, + [TCG_COND_GEU] = { OPC_BGEU, false }, + [TCG_COND_LEU] = { OPC_BGEU, true }, + [TCG_COND_GTU] = { OPC_BLTU, true } +}; + +static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, + TCGReg arg2, TCGLabel *l) +{ + RISCVInsn op = tcg_brcond_to_riscv[cond].op; + bool swap = tcg_brcond_to_riscv[cond].swap; + + tcg_out_opc_branch(s, op, swap ? arg2 : arg1, swap ? arg1 : arg2, 0); + + if (l->has_value) { + reloc_sbimm12(s->code_ptr - 1, l->u.value_ptr); + } else { + tcg_out_reloc(s, s->code_ptr - 1, R_RISCV_BRANCH, l, 0); + } +} + +static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret, + TCGReg arg1, TCGReg arg2) +{ + switch (cond) { + case TCG_COND_EQ: + tcg_out_opc_reg(s, OPC_SUB, ret, arg1, arg2); + tcg_out_opc_imm(s, OPC_SLTIU, ret, ret, 1); + break; + case TCG_COND_NE: + tcg_out_opc_reg(s, OPC_SUB, ret, arg1, arg2); + tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, ret); + break; + case TCG_COND_LT: + tcg_out_opc_reg(s, OPC_SLT, ret, arg1, arg2); + break; + case TCG_COND_GE: + tcg_out_opc_reg(s, OPC_SLT, ret, arg1, arg2); + tcg_out_opc_imm(s, OPC_XORI, ret, ret, 1); + break; + case TCG_COND_LE: + tcg_out_opc_reg(s, OPC_SLT, ret, arg2, arg1); + tcg_out_opc_imm(s, OPC_XORI, ret, ret, 1); + break; + case TCG_COND_GT: + tcg_out_opc_reg(s, OPC_SLT, ret, arg2, arg1); + break; + case TCG_COND_LTU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg1, arg2); + break; + case TCG_COND_GEU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg1, arg2); + tcg_out_opc_imm(s, OPC_XORI, ret, ret, 1); + break; + case TCG_COND_LEU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg2, arg1); + tcg_out_opc_imm(s, OPC_XORI, ret, ret, 1); + break; + case TCG_COND_GTU: + tcg_out_opc_reg(s, OPC_SLTU, ret, arg2, arg1); + break; + default: + g_assert_not_reached(); + break; + } +} + +static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, + TCGReg bl, TCGReg bh, TCGLabel *l) +{ + /* todo */ + g_assert_not_reached(); +} + +static void tcg_out_setcond2(TCGContext *s, TCGCond cond, TCGReg ret, + TCGReg al, TCGReg ah, TCGReg bl, TCGReg bh) +{ + /* todo */ + g_assert_not_reached(); +} + +static inline void tcg_out_goto(TCGContext *s, tcg_insn_unit *target) +{ + ptrdiff_t offset = tcg_pcrel_diff(s, target); + tcg_debug_assert(offset == sextract64(offset, 0, 26)); + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, offset); +} + +static inline void tcg_out_goto_long(TCGContext *s, tcg_insn_unit *target) +{ + ptrdiff_t offset = tcg_pcrel_diff(s, target); + + if (offset == sextract64(offset, 0, 26)) { + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, offset); + } else { + tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP0, (intptr_t)target); + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_TMP0, 0); + } +} + +static void tcg_out_call_int(TCGContext *s, tcg_insn_unit *arg, bool tail) +{ + TCGReg link = tail ? TCG_REG_ZERO : TCG_REG_RA; + ptrdiff_t offset = tcg_pcrel_diff(s, arg); + if (offset == sextract32(offset, 1, 20) << 1) { + /* short jump: -2097150 to 2097152 */ + tcg_out_opc_jump(s, OPC_JAL, link, offset); + } else if (TCG_TARGET_REG_BITS == 32 || + offset == sextract32(offset, 1, 31) << 1) { + /* long jump: -2147483646 to 2147483648 */ + tcg_out_opc_upper(s, OPC_AUIPC, TCG_REG_TMP0, 0); + tcg_out_opc_imm(s, OPC_JALR, link, TCG_REG_TMP0, 0); + reloc_call(s->code_ptr - 2, arg); + } else if (TCG_TARGET_REG_BITS == 64) { + /* far jump: 64-bit */ + tcg_target_long imm = sextract32((tcg_target_long)arg, 0, 12); + tcg_target_long base = (tcg_target_long)arg - imm; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, base); + tcg_out_opc_imm(s, OPC_JALR, link, TCG_REG_TMP0, imm); + } else { + g_assert_not_reached(); + } +} + +static void tcg_out_tail(TCGContext *s, tcg_insn_unit *arg) +{ + tcg_out_call_int(s, arg, true); +} + +static void tcg_out_call(TCGContext *s, tcg_insn_unit *arg) +{ + tcg_out_call_int(s, arg, false); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="R6Uu1icz"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="kCwThNi2"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxTv4p3bz9s47 for ; Fri, 16 Nov 2018 09:53:07 +1100 (AEDT) Received: from localhost ([::1]:41204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQVV-000526-AM for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:53:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFi-0007Iy-A1 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFS-0004eg-NF for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:39 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50627) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFM-0004c0-Ll; Thu, 15 Nov 2018 17:36:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321384; x=1573857384; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2QrLSIBKrUwinH5QLYvqe8zR8s5wQtmSh5srJBKlDvE=; b=R6Uu1iczIYUBpWQc//CBnkvdnyUqTbiKg7PIw+H1r8gdDMF1mWLwpILd jqTIXaRJPJzRZhgmrJOUx83puO/DCP7g8BKdv4QxYdP+aOs52Tuo5qIXI IDOen0+Noa+ntOZcQ+0CblfSA9GRPE9gK6R75Bq8cfJR1fCPOOIIVQgCJ oAJWOKaaZ4vwFLofYSmOdP0HJdJNUt61IEETIQDYts1AlwRKY+SrB4xa8 avxgMxbwqJ/X7s+IuLi4WNSSLjqHrqU5fpjTaCgmiikymbSWdg2qIY8Q6 20P3lVbsNMMx49PDN70o+D+D3pNSXDJ4nuAD4KavnxyjmOtIYBlUZiVR/ Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523399" Received: from mail-cys01nam02lp0049.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.49]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:20 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G8/v64xeb/nnhcWslajpEqTGB4bIx3TKznLe1U0xJA8=; b=kCwThNi2zSOwH9EaMBYkYVCcuKhLEg03nGdiiWsTXBNT2n1Kx9GR7eBJ26DpS1cTr4taKNXQjTIL3vdDut+zULIDz4nQ8c533Fp38jwsXyNcg70i6p88mkvJblfoqvqxtWo0nRR5m/q+oVb+4K/b64spsNTMy5c8kifaDVIO4xo= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:36:19 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:19 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 16/23] riscv: tcg-target: Add slowpath load and store instructions Thread-Index: AQHUfTOgKQwVshsiU0SbnVCiRouTSg== Date: Thu, 15 Nov 2018 22:36:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0002.prod.exchangelabs.com (2603:10b6:a02:80::15) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:bVRBj5fL3mc5vC3B+p2aX+CRUg6kagX4K7hT269gT1n3cf5uGp8k0lMZJBzXnaV2KjZS8rTrr6hPW8W2SvfawHJZFw2/23UI5e/oG6YVd/3qm4NKmfv8kFzwK/kKue6ctIWdyx2ZZ92zqe3mjrram2kaennvFL47FPZXTihkIM3f5cHkEYASUNe/GTGXMldtuUB3uSvbhVHUxVbJosFctjO8pWjeCjSpQoXko3Z8/VF38dxvMEfhG4WBUq6EB0vNA5rA424oHP2tjAgP3pk1TI5QkZHDSUzHzAqQJUks6fpULxsERN0O0cLTATv8TcJ+Av66P4VuKrrTZIMKrd71Bz591/sB9ut0gY9XNdEZkoD4l7v7RSzEXj/qxNlNjiM5mpjdywaBGSVI3Oi0pJBR1C6a3j6HLDOlp03Yo4BVF7xhmXLMYMfboOJTtCenYCTS+OSZpudaqGIhoOLHylYxZA==; 5:TkZkfCwyz4pDYMYifna69AB4gr1Vpf1aPEOd/lwrZ6DYaortmWCtWEQ80L3TreN7sVXqOzXyR8stmSxl2zkDDQXgAmTXf1pGRlryK06uufcKxcy/iHK7RnKQ4vmhFE2aRMprm20SaELKhsu99M6KettiBM0GRgPKrjq4CBYod2c=; 7:LqwqqprzUgoxpO88U9NOB+nWoPVodz5FsoxMMft+4gku3L4/2rVtFwASRWJXiUE/NFPlXE8wInp/RYbrPKseSpEu2cqdA+acTm5p4vT8sV/kMYb/j24Doa9/GYZF4AgsInxrluCge3QG24bJYw0bHQ== x-ms-office365-filtering-correlation-id: 45d81507-b9ba-4c27-81ce-08d64b4ac2d8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: xZB+VyBtK71oSgSp++U4xnz3ae2eCTWEVByzyfIEFh8reZPW5FJ1/kUo16JcwX4rfbMDUDLx0VDJUXb45Oa1yPI4CgL7sWV4nnN7VCmUNoVaHw0MICXByvi9yOFl4vWroKqaZPsmuuDaK5YrHulQeXx5amzj984RbB5n95T64yvfKV2/0eX7MskwT2bYZ3P4Nb2FTiT96i6SkavIYABr/Sbb5TPwSnAOlO70FEVIcpj/SQEe1jA5K/FwA+M9OLSxIG0L9UD2svc3o80nmgZaBFvOBER1U9QH09oOsPmljnF9JCVuV6vLyFTSUlY2B/miqJHoyzY19eGlPSnJCd3IEy2ry+/TZEhoc9CrNBlYWrk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45d81507-b9ba-4c27-81ce-08d64b4ac2d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:19.1278 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 16/23] riscv: tcg-target: Add slowpath load and store instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 240 +++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index b449e17295..5fe6935e24 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -718,6 +718,246 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *arg) tcg_out_call_int(s, arg, false); } +static void tcg_out_mb(TCGContext *s, TCGArg a0) +{ + static const RISCVInsn fence[] = { + [0 ... TCG_MO_ALL] = OPC_FENCE_RW_RW, + [TCG_MO_LD_LD] = OPC_FENCE_R_R, + [TCG_MO_ST_LD] = OPC_FENCE_W_R, + [TCG_MO_LD_ST] = OPC_FENCE_R_W, + [TCG_MO_ST_ST] = OPC_FENCE_W_W, + [TCG_BAR_LDAQ] = OPC_FENCE_R_RW, + [TCG_BAR_STRL] = OPC_FENCE_RW_W, + [TCG_BAR_SC] = OPC_FENCE_RW_RW, + }; + tcg_out32(s, fence[a0 & TCG_MO_ALL]); +} + +/* + * Load/store and TLB + */ + +#if defined(CONFIG_SOFTMMU) +#include "tcg-ldst.inc.c" + +/* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, + * TCGMemOpIdx oi, uintptr_t ra) + */ +static void * const qemu_ld_helpers[16] = { + [MO_UB] = helper_ret_ldub_mmu, + [MO_SB] = helper_ret_ldsb_mmu, + [MO_LEUW] = helper_le_lduw_mmu, + [MO_LESW] = helper_le_ldsw_mmu, + [MO_LEUL] = helper_le_ldul_mmu, + [MO_LESL] = helper_le_ldsl_mmu, + [MO_LEQ] = helper_le_ldq_mmu, + [MO_BEUW] = helper_be_lduw_mmu, + [MO_BESW] = helper_be_ldsw_mmu, + [MO_BEUL] = helper_be_ldul_mmu, + [MO_BESL] = helper_be_ldsl_mmu, + [MO_BEQ] = helper_be_ldq_mmu, +}; + +/* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, + * uintxx_t val, TCGMemOpIdx oi, + * uintptr_t ra) + */ +static void * const qemu_st_helpers[16] = { + [MO_UB] = helper_ret_stb_mmu, + [MO_LEUW] = helper_le_stw_mmu, + [MO_LEUL] = helper_le_stl_mmu, + [MO_LEQ] = helper_le_stq_mmu, + [MO_BEUW] = helper_be_stw_mmu, + [MO_BEUL] = helper_be_stl_mmu, + [MO_BEQ] = helper_be_stq_mmu, +}; + +static void tcg_out_tlb_load(TCGContext *s, TCGReg addrl, + TCGReg addrh, TCGMemOpIdx oi, + tcg_insn_unit **label_ptr, bool is_load) +{ + TCGMemOp opc = get_memop(oi); + unsigned s_bits = opc & MO_SIZE; + unsigned a_bits = get_alignment_bits(opc); + target_ulong mask; + int mem_index = get_mmuidx(oi); + int cmp_off + = (is_load + ? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) + : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); + int add_off = offsetof(CPUArchState, tlb_table[mem_index][0].addend); + int addend_offset = (offsetof(CPUTLBEntry, addend)) - + (is_load ? offsetof(CPUTLBEntry, addr_read) + : offsetof(CPUTLBEntry, addr_write)); + RISCVInsn load_cmp_op = (TARGET_LONG_BITS == 64 ? OPC_LD : + TCG_TARGET_REG_BITS == 64 ? OPC_LWU : OPC_LW); + RISCVInsn load_add_op = TCG_TARGET_REG_BITS == 64 ? OPC_LD : OPC_LW; + TCGReg base = TCG_AREG0; + TCGReg cmpr; + + /* We don't support oversize guests */ + if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { + g_assert_not_reached(); + } + + /* We don't support unaligned accesses. */ + if (a_bits < s_bits) { + a_bits = s_bits; + } + mask = (target_ulong)TARGET_PAGE_MASK | ((1 << a_bits) - 1); + + + /* Compensate for very large offsets. */ + if (add_off >= 0x1000) { + int adj; + base = TCG_REG_TMP2; + if (cmp_off <= 2 * 0xfff) { + adj = 0xfff; + tcg_out_opc_imm(s, OPC_ADDI, base, TCG_AREG0, adj); + } else { + adj = cmp_off - sextract32(cmp_off, 0, 12); + tcg_debug_assert(add_off - adj >= -0x1000 + && add_off - adj < 0x1000); + + tcg_out_opc_upper(s, OPC_LUI, base, adj); + tcg_out_opc_reg(s, OPC_ADD, base, TCG_REG_ZERO, TCG_AREG0); + } + add_off -= adj; + cmp_off -= adj; + } + + /* Extract the page index. */ + if (CPU_TLB_BITS + CPU_TLB_ENTRY_BITS < 12) { + tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP0, addrl, + TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP0, TCG_REG_TMP0, + MAKE_64BIT_MASK(CPU_TLB_ENTRY_BITS, CPU_TLB_BITS)); + } else { + tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP0, addrl, TARGET_PAGE_BITS); + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP0, TCG_REG_TMP0, + MAKE_64BIT_MASK(0, CPU_TLB_BITS)); + tcg_out_opc_imm(s, OPC_SLLI, TCG_REG_TMP0, TCG_REG_TMP0, + CPU_TLB_ENTRY_BITS); + } + + /* Add that to the base address to index the tlb. */ + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP2, base, TCG_REG_TMP0); + base = TCG_REG_TMP2; + + /* Load the tlb comparator and the addend. */ + tcg_out_ldst(s, load_cmp_op, TCG_REG_TMP0, base, cmp_off); + tcg_out_ldst(s, load_cmp_op, TCG_REG_TMP2, base, add_off); + + /* Clear the non-page, non-alignment bits from the address. */ + if (mask == sextract64(mask, 0, 12)) { + tcg_out_opc_imm(s, OPC_ANDI, TCG_REG_TMP1, addrl, mask); + } else { + tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_TMP1, mask); + tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP1, TCG_REG_TMP1, addrl); + } + + /* Compare masked address with the TLB entry. */ + label_ptr[0] = s->code_ptr; + tcg_out_opc_branch(s, OPC_BNE, TCG_REG_TMP0, TCG_REG_TMP1, 0); + + /* TLB Hit - translate address using addend. */ + if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { + tcg_out_ext32u(s, TCG_REG_TMP0, addrl); + addrl = TCG_REG_TMP0; + } + tcg_out_opc_reg(s, OPC_ADD, TCG_REG_L0, TCG_REG_TMP2, addrl); +} + +static void add_qemu_ldst_label(TCGContext *s, int is_ld, TCGMemOpIdx oi, + TCGType ext, + TCGReg datalo, TCGReg datahi, + TCGReg addrlo, TCGReg addrhi, + void *raddr, tcg_insn_unit **label_ptr) +{ + TCGLabelQemuLdst *label = new_ldst_label(s); + + label->is_ld = is_ld; + label->oi = oi; + label->type = ext; + label->datalo_reg = datalo; + label->datahi_reg = datahi; + label->addrlo_reg = addrlo; + label->addrhi_reg = addrhi; + label->raddr = raddr; + label->label_ptr[0] = label_ptr[0]; +} + +static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + TCGMemOpIdx oi = l->oi; + TCGMemOp opc = get_memop(oi); + TCGReg a0 = tcg_target_call_iarg_regs[0]; + TCGReg a1 = tcg_target_call_iarg_regs[1]; + TCGReg a2 = tcg_target_call_iarg_regs[2]; + TCGReg a3 = tcg_target_call_iarg_regs[3]; + + /* We don't support oversize guests */ + if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { + g_assert_not_reached(); + } + + /* resolve label address */ + reloc_sbimm12(l->label_ptr[0], s->code_ptr); + + /* call load helper */ + tcg_out_mov(s, TCG_TYPE_PTR, a0, TCG_AREG0); + tcg_out_mov(s, TCG_TYPE_PTR, a1, l->addrlo_reg); + tcg_out_movi(s, TCG_TYPE_PTR, a2, oi); + tcg_out_movi(s, TCG_TYPE_PTR, a3, (tcg_target_long)l->raddr); + + tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_mov(s, (opc & MO_SIZE) == MO_64, l->datalo_reg, a0); + + tcg_out_goto(s, l->raddr); +} + +static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) +{ + TCGMemOpIdx oi = l->oi; + TCGMemOp opc = get_memop(oi); + TCGMemOp s_bits = opc & MO_SIZE; + TCGReg a0 = tcg_target_call_iarg_regs[0]; + TCGReg a1 = tcg_target_call_iarg_regs[1]; + TCGReg a2 = tcg_target_call_iarg_regs[2]; + TCGReg a3 = tcg_target_call_iarg_regs[3]; + TCGReg a4 = tcg_target_call_iarg_regs[4]; + + /* We don't support oversize guests */ + if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { + g_assert_not_reached(); + } + + /* resolve label address */ + reloc_sbimm12(l->label_ptr[0], s->code_ptr); + + /* call store helper */ + tcg_out_mov(s, TCG_TYPE_PTR, a0, TCG_AREG0); + tcg_out_mov(s, TCG_TYPE_PTR, a1, l->addrlo_reg); + tcg_out_mov(s, TCG_TYPE_PTR, a2, l->datalo_reg); + switch (s_bits) { + case MO_8: + tcg_out_ext8u(s, a2, a2); + break; + case MO_16: + tcg_out_ext16u(s, a2, a2); + break; + default: + break; + } + tcg_out_movi(s, TCG_TYPE_PTR, a3, oi); + tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr); + + tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + + tcg_out_goto(s, l->raddr); +} +#endif /* CONFIG_SOFTMMU */ + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="a1T+XaLv"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="OVcpVmhM"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxGj3fYhz9s9G for ; Fri, 16 Nov 2018 09:43:25 +1100 (AEDT) Received: from localhost ([::1]:41131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQM7-0004Ch-0E for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:43:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFo-0007Lj-Vx for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFl-0004l8-Os for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:52 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:18085) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFk-0004eN-2K; Thu, 15 Nov 2018 17:36:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321407; x=1573857407; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=cq7/ILZ0+X5q2Q8zoCsoNl0fj05PmUGDIr/DEzXQuIE=; b=a1T+XaLvuGKuZnyKNHJoPcsYXVGpxKtjOHpCaJaQd7axUoEITvQFQvML rMkFBB0tBhmNoxPMyCcn7cJLGuvzpq6CCsaenl6IxFAo06YLGbmsNMxrQ Pv+ca8RtnTzUtZUAc/yA0/tmCFAhg/enlAp4W1TEqFieujUGF6TXgs4rG jwXUD01/gCVkwgnWQD1zZzLZRsoKYU2pOUoVkpFV3armIAZQj5Eg54yM0 mwgNGUP6P5edE7Ph2ywT2J/wFjwijHA48S5rHhkrvKwx3cjI4iW2PuhGu CyWYmVXcmYjJK/6OMSmeG/RMToQYiOlk8sHKSq1ZWjZ48S5Ycy2YXufzU Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884487" Received: from mail-cys01nam02lp0056.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.56]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:29 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LTvJjU7d6Nbj7+0encG8Vm7VCgwInIOCMO9yHivlgRs=; b=OVcpVmhM5gdRVW6peJ4+/EoeXOylYJwHcbPR4dw28wC+XE8P4TjWKnzkj4HvzwMmJEnhib/eLk6J0oDYHAFPokkCntpL9ErsnzA/Q4VadrFHchpm5YEl7QAE61vjVdSuJfZpXvypLATgP5mQk/3BWQRRFj6R/Kc3XZf5gC0BA50= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:36:28 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:28 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 17/23] riscv: tcg-target: Add direct load and store instructions Thread-Index: AQHUfTOlO8R6UwvYe0umCRxlbw/rxQ== Date: Thu, 15 Nov 2018 22:36:28 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR01CA0023.prod.exchangelabs.com (2603:10b6:a02:80::36) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:5vZYXKlInwG/Iz7/fNw2yKX5SRSWUtgxhNWx3Ms2gLTN9BVavgr4/y73MPrCYeickibOHrw9tCIChGTKs5RR/9sGyhxBRnaXN6DFVdroTPFLlW+tGarV96nnf68ufqCcQz9TbhYyJzckVeJLZ9ceKu2V8DtjGVJ8mMKvLsovciuhSqmtBwei7ZQAd5e6sgD7x4WzXVWlDJjyL785ic2BB27TXcdhIbkLnaki4128UNfqsXDhaFLrAlNcFvo2THFSUs1pKrkjEhxoSFBwhptFAziyjQyNNW+nOK25jbUQG5u9j/hPq5TgNQdmCfHhhC+AXtqjbvXM0LZts/Fr4if0qdZDf+53cg2UGx8qu4VMcbH/h2lOVYnX5bCKgZ+b/TiJrCONjI9aKVRtuifyusJyZQvgZPC/jFm5D2VlIywXjqBLDxB2U3cBMJTwukl8Ufn1mmeUWOZHkm/RmlgEmv9tEg==; 5:UDi63oE3NrkSvNO1TDYk329F7GSRhqhBHO8u90XWim4nujYLXSrGKRvNlDGC9JzBirIBomLsfhHLUqkvWv5xGe1D9oVth+aXLz/Qrjkb8lwQGSkGZOIWOI3bjpX8OrnI6OmN4FitqSNfe7IO1selkDuF7B8LU/xgwsrrVWQL/5U=; 7:qaAzY45D7y3beyHxNtBblzVMnkjTN87JVEUjMZgFQWzYiSVseoUqDXNu+Km5zDCO/S+GEI6HSZglH/xvQ+/nMrRpQ2mHhOt9ZiDNHrbB2bj9m9BQ/iCtOBVjHkqb5QxHm0Ix/b5tA7Primb9Pz+Tuw== x-ms-office365-filtering-correlation-id: a8ba1f61-db9a-495a-08f9-08d64b4ac838 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: rE/N4kJMonsmwfbrYAOJnsTRzUAWJ5z+5COeD0UqU3+H1t/3V+f74sKGtmAcMqpcwWXqmcFVoAH2gD69uY0zZ0FT49udlwbj1WTuT0KHEUivm+fApI4dyHluhzjqZYT4SYDFAFCyFIn35wkQID0XqLvMmgeq2X4bxvWzs+gCQty3XGSCF6HVC6Clqu9RKxJmTnS/EWwWuzy7LzQTw09Ay5YqPElLCs7Akm4O+kwRB6O5wry772N6qWqbFSYS3r7uA0eStVYKOgv9DVqaC/vZ66DYeMvmQL+r2iHykz8xmcVwEJolHSMK+uVJg7SyVD8amCgp292uW8IL/C9y+g7QKMO/YejAGa8QJWvvl0JrVHc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8ba1f61-db9a-495a-08f9-08d64b4ac838 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:28.2095 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 17/23] riscv: tcg-target: Add direct load and store instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 145 +++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 5fe6935e24..c4a013a962 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -958,6 +958,151 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) } #endif /* CONFIG_SOFTMMU */ +static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, + TCGReg base, TCGMemOp opc, bool is_64) +{ + const TCGMemOp bswap = opc & MO_BSWAP; + + /* TODO: Handle byte swapping */ + + switch (opc & (MO_SSIZE)) { + case MO_UB: + tcg_out_opc_imm(s, OPC_LBU, lo, base, 0); + break; + case MO_SB: + tcg_out_opc_imm(s, OPC_LB, lo, base, 0); + break; + case MO_UW: + tcg_out_opc_imm(s, OPC_LHU, lo, base, 0); + break; + case MO_SW: + tcg_out_opc_imm(s, OPC_LH, lo, base, 0); + break; + case MO_UL: + if (TCG_TARGET_REG_BITS == 64 && is_64) { + tcg_out_opc_imm(s, OPC_LWU, lo, base, 0); + break; + } + /* FALLTHRU */ + case MO_SL: + tcg_out_opc_imm(s, OPC_LW, lo, base, 0); + break; + case MO_Q: + /* Prefer to load from offset 0 first, but allow for overlap. */ + if (TCG_TARGET_REG_BITS == 64) { + tcg_out_opc_imm(s, OPC_LD, lo, base, 0); + } else { + tcg_out_opc_imm(s, OPC_LW, lo, base, 0); + tcg_out_opc_imm(s, OPC_LW, hi, base, 4); + } + break; + default: + g_assert_not_reached(); + } +} + +static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) +{ + TCGReg addr_regl, addr_regh __attribute__((unused)); + TCGReg data_regl, data_regh; + TCGMemOpIdx oi; + TCGMemOp opc; +#if defined(CONFIG_SOFTMMU) + tcg_insn_unit *label_ptr[1]; +#endif + TCGReg base = TCG_REG_TMP0; + + data_regl = *args++; + data_regh = (TCG_TARGET_REG_BITS == 32 && is_64 ? *args++ : 0); + addr_regl = *args++; + addr_regh = (TCG_TARGET_REG_BITS < TARGET_LONG_BITS ? *args++ : 0); + oi = *args++; + opc = get_memop(oi); + +#if defined(CONFIG_SOFTMMU) + tcg_out_tlb_load(s, addr_regl, addr_regh, oi, label_ptr, 1); + tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64); + add_qemu_ldst_label(s, 1, oi, + (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32), + data_regl, data_regh, addr_regl, addr_regh, + s->code_ptr, label_ptr); +#else + if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { + tcg_out_ext32u(s, base, addr_regl); + addr_regl = base; + } + tcg_out_opc_reg(s, OPC_ADD, base, TCG_GUEST_BASE_REG, addr_regl); + tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64); +#endif +} + +static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, + TCGReg base, TCGMemOp opc) +{ + const TCGMemOp bswap = opc & MO_BSWAP; + + /* TODO: Handle byte swapping */ + + switch (opc & (MO_SSIZE)) { + case MO_8: + tcg_out_opc_store(s, OPC_SB, base, lo, 0); + break; + case MO_16: + tcg_out_opc_store(s, OPC_SH, base, lo, 0); + break; + case MO_32: + tcg_out_opc_store(s, OPC_SW, base, lo, 0); + break; + case MO_64: + if (TCG_TARGET_REG_BITS == 64) { + tcg_out_opc_store(s, OPC_SD, base, lo, 0); + } else { + tcg_out_opc_store(s, OPC_SW, base, lo, 0); + tcg_out_opc_store(s, OPC_SW, base, hi, 4); + } + break; + default: + g_assert_not_reached(); + } +} + +static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) +{ + TCGReg addr_regl, addr_regh __attribute__((unused)); + TCGReg data_regl, data_regh; + TCGMemOpIdx oi; + TCGMemOp opc; +#if defined(CONFIG_SOFTMMU) + tcg_insn_unit *label_ptr[1]; + TCGReg base = TCG_REG_L0; +#else + TCGReg base = TCG_REG_TMP0; +#endif + + data_regl = *args++; + data_regh = (TCG_TARGET_REG_BITS == 32 && is_64 ? *args++ : 0); + addr_regl = *args++; + addr_regh = (TCG_TARGET_REG_BITS < TARGET_LONG_BITS ? *args++ : 0); + oi = *args++; + opc = get_memop(oi); + +#if defined(CONFIG_SOFTMMU) + tcg_out_tlb_load(s, addr_regl, addr_regh, oi, label_ptr, 0); + tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc); + add_qemu_ldst_label(s, 0, oi, + (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32), + data_regl, data_regh, addr_regl, addr_regh, + s->code_ptr, label_ptr); +#else + if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { + tcg_out_ext32u(s, base, addr_regl); + addr_regl = base; + } + tcg_out_opc_reg(s, OPC_ADD, base, TCG_GUEST_BASE_REG, addr_regl); + tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc); +#endif +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="ZfchZwkJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="Gi/eCtu6"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxF243cHz9s47 for ; Fri, 16 Nov 2018 09:41:58 +1100 (AEDT) Received: from localhost ([::1]:41120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQKi-0002sj-5f for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:41:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFq-0007O3-Uq for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFn-0004lz-JE for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:36:54 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:52017) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFl-0004hI-T7; Thu, 15 Nov 2018 17:36:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321410; x=1573857410; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=kIdqu2kkg67Wx3dVEOBFmxRmyTvhjS95vH1dBbhiCCI=; b=ZfchZwkJyka1yPO3rdEuSjz+dheiUYqzO97UAJ1dg6jLg7jMNchyReW5 A4a/nBIkncYslbjTe0nNvBGSfEVaE8ALO3te0IQ6ivP/owaiU3dJ8JaRS RoRF1/brgHof+cHEcmPOQ2STH9dTB3aeq2b8aOcvDZG0Enw2DAy4MdJ5b NN/Ph2HUY5GWFLdHcD8cT3Mj1RyfWBI7dZ5cG8MIw+nX4Gf+Ikb3BReDV aup2nGV3u3Ua2nOGUnQSgQ4XUVfWYzvsiD4sBIWKZyj/clVadXjR5jTYP cxeq1lCSzLh18hnxMigKhsbMcZPqfglq+B0400EvpkQw4oeXHpN9ACSib w==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99166035" Received: from mail-cys01nam02lp0048.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.48]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:39 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9VQWfU0fHasFt5zLQTglPmL5AvE+l+x6tVoUoKlnRcw=; b=Gi/eCtu6K+16/XPKm5MnbqxVp+fEdO80t9u1Mcfn+Xksp8M4PrY+wUmcAscpMUZZveHv7GYWZ03nd5xvMkq2s3w0XFlvPeDYaAvNwLOhd4mN4cow5Av0scn0+C5vPyChPKyNYiL5LNwGr34Jtf4Z5dtq5Rs3F9hcyAH328Ww5c0= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0481.namprd04.prod.outlook.com (10.173.48.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Thu, 15 Nov 2018 22:36:37 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:37 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 18/23] riscv: tcg-target: Add the out op decoder Thread-Index: AQHUfTOrQQ6FYFM2KEeFJq+9h2FdrA== Date: Thu, 15 Nov 2018 22:36:37 +0000 Message-ID: <4e25322ab80efb351d006d50672048fea2c71a03.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0102.namprd07.prod.outlook.com (2603:10b6:a03:12b::43) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0481; 6:pNb0hu09fawVHCqGb5ca+nWSpvLB//73Rq/VuVTUKdlF5SfbzUG3da5zzRn20sfLJ8YrUHUTPqPFsrXDezCJ4SFfOH00XJ6+azi4SQlitPbfzW1mqOb3PPUXVY1HHK6SVGLsu9SK/RCqFvw1DGQxx1b4sjssrdDovXLlXP3B5+8LYOJRC8+ZtlcNur6mAXQy3AD3RpB3vTgdIDhVTFOI3mUJd1a6tqO8kzV2CCMcRcFrecuyVXZraXk1kQ/5p9UARWk9T5GnT1rl16yheyJyX65TIgvBe1eOHx6n/00ojX3oTq4SY+0LonBVN0l5taQcSPzKTCN9h/lBXqvAgWjDHHM/gcytS1QNdiYCBTTaLHIUo2B4RHo6xhCZ9CYUiJ7ndd588hbns1v1nMY1egfXJYzekafVCPloU48PR/GbGKW27LqObJOOBZr0lemuOj+tiSMZGxwcvwe0MycuCX6pjw==; 5:IzxzsnxeWtsAIaN30YP/sOElqJ5ClxQICvZXZBYYzA2RL8ij5bWoeCYf5fXwnMbnSCKjQcn+JkGogGgOlOwpwZ1bm3xhjXca2VxuzLdwr3hy2mlBcYveN4TpuaB9B9t/g1SqPXEHQQsriS30hvbhOSJXIU221J08lj/YWsLSnuQ=; 7:tHSULGXk0pS64WzaVcOpDM81o/tyb2JKgbFdHA9OYlM2EexYXXDYwiV6wsB56SuM3ZptpRdryZeb9b5toMCyLuOO5ncf/neFE0Lbzx2JLMPf/H49NNkBCWOWfwUMKw5GYH/Qy1/36oQ6kbahsx+Wng== x-ms-office365-filtering-correlation-id: acb91ba3-b20b-42ca-1275-08d64b4acd93 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0481; x-ms-traffictypediagnostic: MWHPR04MB0481: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0481; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0481; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(396003)(346002)(366004)(136003)(189003)(199004)(8936002)(81166006)(81156014)(54906003)(4744004)(8676002)(76176011)(86362001)(386003)(71190400001)(6506007)(71200400001)(52116002)(97736004)(110136005)(26005)(446003)(50226002)(118296001)(99286004)(106356001)(2616005)(476003)(66066001)(11346002)(36756003)(39060400002)(72206003)(102836004)(14454004)(186003)(486006)(2501003)(44832011)(3846002)(6116002)(256004)(2900100001)(5660300001)(53946003)(305945005)(6512007)(6486002)(25786009)(2906002)(478600001)(105586002)(4326008)(68736007)(7736002)(53936002)(316002)(6436002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0481; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: g8J7OC+dz1NYbwm8wn8xzdm8TV8EH5+TDaJOm324/iiGopScPrf0Vr0VYWw448sEiS8eL8f9hc2fc9RwxAyqVqEmksp4VRrLGjw6j+AhCi+kSD5YvmqShpCEQRrPyVLvs78WNaEChN60AgBC9w/fQOoREBhzTwFCRm+SABryzn2bLXp1cwpRiFgZc5+w444ySPY/X4hMDM+Ey5nGetU9mW6Qq6akzKZ0+uDdoN1rGuhGXPparZn56SDy30EKpyK7bRRuCHDoOkk1tv4y+mOryc9UtUaaelCHuO76D9ZNKN8Vm7fkfRWizNXvmgj+Vnv2Co3iinGGX9ECMu2u0X1yJuJB6IYjwlMsF2mvgOjO8Bc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: acb91ba3-b20b-42ca-1275-08d64b4acd93 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:37.1317 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0481 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 18/23] riscv: tcg-target: Add the out op decoder X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 472 +++++++++++++++++++++++++++++++++++++ 1 file changed, 472 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index c4a013a962..bf3b04f7dc 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1103,6 +1103,478 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) #endif } +static tcg_insn_unit *tb_ret_addr; + +static void tcg_out_op(TCGContext *s, TCGOpcode opc, + const TCGArg *args, const int *const_args) +{ + TCGArg a0 = args[0]; + TCGArg a1 = args[1]; + TCGArg a2 = args[2]; + int c2 = const_args[2]; + const bool is32bit = TCG_TARGET_REG_BITS == 32; + + switch (opc) { + case INDEX_op_exit_tb: + /* Reuse the zeroing that exists for goto_ptr. */ + if (a0 == 0) { + tcg_out_goto_long(s, s->code_gen_epilogue); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A0, a0); + tcg_out_goto_long(s, tb_ret_addr); + } + break; + + case INDEX_op_goto_tb: + if (s->tb_jmp_insn_offset) { + /* direct jump method */ + s->tb_jmp_insn_offset[a0] = tcg_current_code_size(s); + /* should align on 64-bit boundary for atomic patching */ + tcg_out_opc_upper(s, OPC_AUIPC, TCG_REG_TMP0, 0); + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_TMP0, 0); + } else { + /* indirect jump method */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_REG_ZERO, + (uintptr_t)(s->tb_jmp_target_addr + a0)); + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_TMP0, 0); + } + s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s); + break; + + case INDEX_op_goto_ptr: + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, a0, 0); + break; + + case INDEX_op_br: + tcg_out_reloc(s, s->code_ptr, R_RISCV_JAL, arg_label(a0), 0); + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, 0); + break; + + case INDEX_op_ld8u_i32: + case INDEX_op_ld8u_i64: + tcg_out_ldst(s, OPC_LBU, a0, a1, a2); + break; + case INDEX_op_ld8s_i32: + case INDEX_op_ld8s_i64: + tcg_out_ldst(s, OPC_LB, a0, a1, a2); + break; + case INDEX_op_ld16u_i32: + case INDEX_op_ld16u_i64: + tcg_out_ldst(s, OPC_LHU, a0, a1, a2); + break; + case INDEX_op_ld16s_i32: + case INDEX_op_ld16s_i64: + tcg_out_ldst(s, OPC_LH, a0, a1, a2); + break; + case INDEX_op_ld32u_i64: + tcg_out_ldst(s, OPC_LWU, a0, a1, a2); + break; + case INDEX_op_ld_i32: + case INDEX_op_ld32s_i64: + tcg_out_ldst(s, OPC_LW, a0, a1, a2); + break; + case INDEX_op_ld_i64: + tcg_out_ldst(s, OPC_LD, a0, a1, a2); + break; + + case INDEX_op_st8_i32: + case INDEX_op_st8_i64: + tcg_out_ldst(s, OPC_SB, a0, a1, a2); + break; + case INDEX_op_st16_i32: + case INDEX_op_st16_i64: + tcg_out_ldst(s, OPC_SH, a0, a1, a2); + break; + case INDEX_op_st_i32: + case INDEX_op_st32_i64: + tcg_out_ldst(s, OPC_SW, a0, a1, a2); + break; + case INDEX_op_st_i64: + tcg_out_ldst(s, OPC_SD, a0, a1, a2); + break; + + case INDEX_op_add_i32: + if (c2) { + tcg_out_opc_imm(s, is32bit ? OPC_ADDI : OPC_ADDIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, is32bit ? OPC_ADD : OPC_ADDW, a0, a1, a2); + } + break; + case INDEX_op_add_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_ADD, a0, a1, a2); + } + break; + + case INDEX_op_sub_i32: + if (c2) { + tcg_out_opc_imm(s, is32bit ? OPC_ADDI : OPC_ADDIW, a0, a1, -a2); + } else { + tcg_out_opc_reg(s, is32bit ? OPC_SUB : OPC_SUBW, a0, a1, a2); + } + break; + case INDEX_op_sub_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ADDI, a0, a1, -a2); + } else { + tcg_out_opc_reg(s, OPC_SUB, a0, a1, a2); + } + break; + + case INDEX_op_and_i32: + case INDEX_op_and_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ANDI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_AND, a0, a1, a2); + } + break; + + case INDEX_op_or_i32: + case INDEX_op_or_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_ORI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_OR, a0, a1, a2); + } + break; + + case INDEX_op_xor_i32: + case INDEX_op_xor_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_XORI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_XOR, a0, a1, a2); + } + break; + + case INDEX_op_not_i32: + case INDEX_op_not_i64: + tcg_out_opc_imm(s, OPC_XORI, a0, a1, -1); + break; + + case INDEX_op_neg_i32: + tcg_out_opc_reg(s, is32bit ? OPC_SUB : OPC_SUBW, a0, TCG_REG_ZERO, a1); + break; + case INDEX_op_neg_i64: + tcg_out_opc_imm(s, OPC_SUB, a0, TCG_REG_ZERO, a1); + break; + + case INDEX_op_mul_i32: + tcg_out_opc_reg(s, is32bit ? OPC_MUL : OPC_MULW, a0, a1, a2); + break; + case INDEX_op_mul_i64: + tcg_out_opc_reg(s, OPC_MUL, a0, a1, a2); + break; + + case INDEX_op_div_i32: + tcg_out_opc_reg(s, is32bit ? OPC_DIV : OPC_DIVW, a0, a1, a2); + break; + case INDEX_op_div_i64: + tcg_out_opc_reg(s, OPC_DIV, a0, a1, a2); + break; + + case INDEX_op_divu_i32: + tcg_out_opc_reg(s, is32bit ? OPC_DIVU : OPC_DIVUW, a0, a1, a2); + break; + case INDEX_op_divu_i64: + tcg_out_opc_reg(s, OPC_DIVU, a0, a1, a2); + break; + + case INDEX_op_rem_i32: + tcg_out_opc_reg(s, is32bit ? OPC_REM : OPC_REMW, a0, a1, a2); + break; + case INDEX_op_rem_i64: + tcg_out_opc_reg(s, OPC_REM, a0, a1, a2); + break; + + case INDEX_op_remu_i32: + tcg_out_opc_reg(s, is32bit ? OPC_REMU : OPC_REMUW, a0, a1, a2); + break; + case INDEX_op_remu_i64: + tcg_out_opc_reg(s, OPC_REMU, a0, a1, a2); + break; + + case INDEX_op_shl_i32: + if (c2) { + tcg_out_opc_imm(s, is32bit ? OPC_SLLI : OPC_SLLIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, is32bit ? OPC_SLL : OPC_SLLW, a0, a1, a2); + } + break; + case INDEX_op_shl_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SLL, a0, a1, a2); + } + break; + + case INDEX_op_shr_i32: + if (c2) { + tcg_out_opc_imm(s, is32bit ? OPC_SRLI : OPC_SRLIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, is32bit ? OPC_SRL : OPC_SRLW, a0, a1, a2); + } + break; + case INDEX_op_shr_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRL, a0, a1, a2); + } + break; + + case INDEX_op_sar_i32: + if (c2) { + tcg_out_opc_imm(s, is32bit ? OPC_SRAI : OPC_SRAIW, a0, a1, a2); + } else { + tcg_out_opc_reg(s, is32bit ? OPC_SRA : OPC_SRAW, a0, a1, a2); + } + break; + case INDEX_op_sar_i64: + if (c2) { + tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2); + } else { + tcg_out_opc_reg(s, OPC_SRA, a0, a1, a2); + } + break; + + case INDEX_op_brcond_i32: + case INDEX_op_brcond_i64: + tcg_out_brcond(s, a2, a0, a1, arg_label(args[3])); + break; + case INDEX_op_brcond2_i32: + tcg_out_brcond2(s, args[4], a0, a1, a2, args[3], arg_label(args[5])); + break; + + case INDEX_op_setcond_i32: + case INDEX_op_setcond_i64: + tcg_out_setcond(s, args[3], a0, a1, a2); + break; + case INDEX_op_setcond2_i32: + tcg_out_setcond2(s, args[5], a0, a1, a2, args[3], args[4]); + break; + + case INDEX_op_qemu_ld_i32: + tcg_out_qemu_ld(s, args, false); + break; + case INDEX_op_qemu_ld_i64: + tcg_out_qemu_ld(s, args, true); + break; + case INDEX_op_qemu_st_i32: + tcg_out_qemu_st(s, args, false); + break; + case INDEX_op_qemu_st_i64: + tcg_out_qemu_st(s, args, true); + break; + + case INDEX_op_ext8u_i32: + case INDEX_op_ext8u_i64: + tcg_out_ext8u(s, a0, a1); + break; + + case INDEX_op_ext16u_i32: + case INDEX_op_ext16u_i64: + tcg_out_ext16u(s, a0, a1); + break; + + case INDEX_op_ext32u_i64: + case INDEX_op_extu_i32_i64: + tcg_out_ext32u(s, a0, a1); + break; + + case INDEX_op_ext8s_i32: + case INDEX_op_ext8s_i64: + tcg_out_ext8s(s, a0, a1); + break; + + case INDEX_op_ext16s_i32: + case INDEX_op_ext16s_i64: + tcg_out_ext16s(s, a0, a1); + break; + + case INDEX_op_ext32s_i64: + case INDEX_op_ext_i32_i64: + tcg_out_ext32s(s, a0, a1); + break; + + case INDEX_op_mulsh_i32: + case INDEX_op_mulsh_i64: + tcg_out_opc_imm(s, OPC_MULH, a0, a1, a2); + break; + + case INDEX_op_muluh_i32: + case INDEX_op_muluh_i64: + tcg_out_opc_imm(s, OPC_MULHU, a0, a1, a2); + break; + + case INDEX_op_mb: + tcg_out_mb(s, a0); + break; + + case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ + case INDEX_op_mov_i64: + case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ + case INDEX_op_movi_i64: + case INDEX_op_call: /* Always emitted via tcg_out_call. */ + default: + g_assert_not_reached(); + } +} + +static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) +{ + static const TCGTargetOpDef r + = { .args_ct_str = { "r" } }; + static const TCGTargetOpDef r_r + = { .args_ct_str = { "r", "r" } }; + static const TCGTargetOpDef rZ_r + = { .args_ct_str = { "rZ", "r" } }; + static const TCGTargetOpDef rZ_rZ + = { .args_ct_str = { "rZ", "rZ" } }; + static const TCGTargetOpDef rZ_rZ_rZ_rZ + = { .args_ct_str = { "rZ", "rZ", "rZ", "rZ" } }; + static const TCGTargetOpDef r_r_ri + = { .args_ct_str = { "r", "r", "ri" } }; + static const TCGTargetOpDef r_r_rI + = { .args_ct_str = { "r", "r", "rI" } }; + static const TCGTargetOpDef r_rZ_rN + = { .args_ct_str = { "r", "rZ", "rN" } }; + static const TCGTargetOpDef r_rZ_rZ + = { .args_ct_str = { "r", "rZ", "rZ" } }; + static const TCGTargetOpDef r_rZ_rZ_rZ_rZ + = { .args_ct_str = { "r", "rZ", "rZ", "rZ", "rZ" } }; + static const TCGTargetOpDef r_L + = { .args_ct_str = { "r", "L" } }; + static const TCGTargetOpDef r_r_L + = { .args_ct_str = { "r", "r", "L" } }; + static const TCGTargetOpDef r_L_L + = { .args_ct_str = { "r", "L", "L" } }; + static const TCGTargetOpDef r_r_L_L + = { .args_ct_str = { "r", "r", "L", "L" } }; + static const TCGTargetOpDef LZ_L + = { .args_ct_str = { "LZ", "L" } }; + static const TCGTargetOpDef LZ_L_L + = { .args_ct_str = { "LZ", "L", "L" } }; + static const TCGTargetOpDef LZ_LZ_L + = { .args_ct_str = { "LZ", "LZ", "L" } }; + static const TCGTargetOpDef LZ_LZ_L_L + = { .args_ct_str = { "LZ", "LZ", "L", "L" } }; + + switch (op) { + case INDEX_op_goto_ptr: + return &r; + + case INDEX_op_ld8u_i32: + case INDEX_op_ld8s_i32: + case INDEX_op_ld16u_i32: + case INDEX_op_ld16s_i32: + case INDEX_op_ld_i32: + case INDEX_op_not_i32: + case INDEX_op_neg_i32: + case INDEX_op_ld8u_i64: + case INDEX_op_ld8s_i64: + case INDEX_op_ld16u_i64: + case INDEX_op_ld16s_i64: + case INDEX_op_ld32s_i64: + case INDEX_op_ld32u_i64: + case INDEX_op_ld_i64: + case INDEX_op_not_i64: + case INDEX_op_neg_i64: + case INDEX_op_ext8u_i32: + case INDEX_op_ext8u_i64: + case INDEX_op_ext16u_i32: + case INDEX_op_ext16u_i64: + case INDEX_op_ext32u_i64: + case INDEX_op_extu_i32_i64: + case INDEX_op_ext8s_i32: + case INDEX_op_ext8s_i64: + case INDEX_op_ext16s_i32: + case INDEX_op_ext16s_i64: + case INDEX_op_ext32s_i64: + case INDEX_op_ext_i32_i64: + return &r_r; + + case INDEX_op_st8_i32: + case INDEX_op_st16_i32: + case INDEX_op_st_i32: + case INDEX_op_st8_i64: + case INDEX_op_st16_i64: + case INDEX_op_st32_i64: + case INDEX_op_st_i64: + return &rZ_r; + + case INDEX_op_add_i32: + case INDEX_op_and_i32: + case INDEX_op_or_i32: + case INDEX_op_xor_i32: + case INDEX_op_add_i64: + case INDEX_op_and_i64: + case INDEX_op_or_i64: + case INDEX_op_xor_i64: + return &r_r_rI; + + case INDEX_op_sub_i32: + case INDEX_op_sub_i64: + return &r_rZ_rN; + + case INDEX_op_mul_i32: + case INDEX_op_mulsh_i32: + case INDEX_op_muluh_i32: + case INDEX_op_div_i32: + case INDEX_op_divu_i32: + case INDEX_op_rem_i32: + case INDEX_op_remu_i32: + case INDEX_op_setcond_i32: + case INDEX_op_mul_i64: + case INDEX_op_mulsh_i64: + case INDEX_op_muluh_i64: + case INDEX_op_div_i64: + case INDEX_op_divu_i64: + case INDEX_op_rem_i64: + case INDEX_op_remu_i64: + case INDEX_op_setcond_i64: + return &r_rZ_rZ; + + case INDEX_op_shl_i32: + case INDEX_op_shr_i32: + case INDEX_op_sar_i32: + case INDEX_op_shl_i64: + case INDEX_op_shr_i64: + case INDEX_op_sar_i64: + return &r_r_ri; + + case INDEX_op_brcond_i32: + case INDEX_op_brcond_i64: + return &rZ_rZ; + + case INDEX_op_brcond2_i32: + return &rZ_rZ_rZ_rZ; + + case INDEX_op_setcond2_i32: + return &r_rZ_rZ_rZ_rZ; + + case INDEX_op_qemu_ld_i32: + return TARGET_LONG_BITS <= TCG_TARGET_REG_BITS ? &r_L : &r_L_L; + case INDEX_op_qemu_st_i32: + return TARGET_LONG_BITS <= TCG_TARGET_REG_BITS ? &LZ_L : &LZ_L_L; + case INDEX_op_qemu_ld_i64: + return TCG_TARGET_REG_BITS == 64 ? &r_L + : TARGET_LONG_BITS <= TCG_TARGET_REG_BITS ? &r_r_L + : &r_r_L_L; + case INDEX_op_qemu_st_i64: + return TCG_TARGET_REG_BITS == 64 ? &LZ_L + : TARGET_LONG_BITS <= TCG_TARGET_REG_BITS ? &LZ_LZ_L + : &LZ_LZ_L_L; + + default: + return NULL; + } +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="Aq+tpfgX"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ectHJc6P"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxPw2HxPz9s47 for ; Fri, 16 Nov 2018 09:49:40 +1100 (AEDT) Received: from localhost ([::1]:41168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQS9-000157-Qo for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:49:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFx-0007WG-R1 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFu-0004rl-L8 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:01 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50663) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFu-0004r4-CE; Thu, 15 Nov 2018 17:36:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321418; x=1573857418; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=M3Os+PficGmiG5CxXXF8M8XZqujmgHhFDzxPkKQyzdw=; b=Aq+tpfgXDiaiC9DWG5zE23GLKeLmK29lYeKtIew22Xx3sy09i4K8Ad9D rrgyUm0sOPmHNaReSvEdFczcCv5zQUbuGFGUNGpZpvVWW4RQNe/fykmBw tkpQ0eKbbei23T2SfDi4/Y94LEQwtx72HKfW3l0VcEVglf3YRs/cZbvvm bPufBD4zTImeajW1gaTo1AR8qguE9egYNPfvrzBZ4zpHU4Bst9hKaAoZe MPV90bDhiCY2G+fI9/VQ5qCBlmJglM96pvWE64tdNM59yz9rmPuTpZyFE iPhIuHW+AX3Jv8FzPzn5qmRRdcJs5dNtAUt7s/IWG/VUlOWWJTfLmiH9E A==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523418" Received: from mail-cys01nam02lp0051.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.51]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:47 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NusdP1MkqcdAmhRNwrMtEizWF/SVZWg4LovuJ7KQj74=; b=ectHJc6Pec42+9g036cM9PQl3OW+g6LIeueSgW42/f+0whkcXasH45VTfYjgTDpBsqvOpGAEw41pMclEO6iTw2iuspyHZZfWmxFx4uw2EIryk5yfeCahj2QLwWASc3xp/c3f6p1/of/QpsyajaHzVbScd1Z+/rVjEYShMoBCe2I= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:36:46 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:46 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 19/23] riscv: tcg-target: Add the prologue generation Thread-Index: AQHUfTOwYRo8kNCrWkivyVuZpicg4g== Date: Thu, 15 Nov 2018 22:36:46 +0000 Message-ID: <526c9ffdb23b75e96508703b9c9e3bc95cfac939.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0076.namprd07.prod.outlook.com (2603:10b6:a03:12b::17) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:oTltrtX4O1Hb82AI1AI64OonPGSRzTNdaApfZCtaRpnIZN9n27cT8EjPkofVe1O0m7v+o/m4VjCjf0NRKWvVkAwJM7zBvmCBCdi2qG5pGld3e4zudrq1C+W1XWnQYxdrxu1spQ1bH6XVkuIOn+MmUGKJsZPjXXdeSZaOOcz/eWUfhMpBx7c8Ve1wsheVOcvh4FSZIvzfn1zQ5uqtQpBJQPOFji2vqBWeNhj7KwXIGivRRYJwrhvk5iXuMnRmnD0KBTD5cFZChFX09T4TbECMQXdxIDpS7Xg1bADOuGuQ0McMuCfsUC9MaP7r5y+foFjCHAd8rC5AuKYvu+b0QrtyNwDMP3NlgvRrdk81CkkMtwpwNOHEvjlRGSVmtSuUq53fO+6Li6w4BbGHVyXMuuI+N6ko3lq7iU+hxdzS+9vQq5eArWaW3jMXFJ3dT0xiarbXTN8RpQlSJwOrlEdClGRZQg==; 5:cXUVH+h7dLg7rb+pP4wQcWPk/oSjeGoHegLSLZTtV7UZ7t6PAvxFLKi7qPewbQU9h/QLLr9KNEMRILA+AefEAQ2mUB5X6vrmrN+fuLJC8RkX5roZKO603SjXMVJdy5DMTD0a/fmMFJKrFzugMh9aKDBDsA6t181yWQjcOmFvSBc=; 7:vpMxU6doX5KL+KDD+EYuA17iJoXx2VqH+cW8Q+PJRkR/+zJXch/XDsMRb2wLelh/A3+ebbqC6+fgBpxG1hzEn6Q/9SioFZl23CKSeLBjWxz4BwunIPCrxh96LwUWzjqWs1EpHbpqChL+bTYJoNPP9Q== x-ms-office365-filtering-correlation-id: 4347de98-232f-4fe6-7b1d-08d64b4ad2f7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: 3nCis0bm4x8c6WEn6xCkCDTp3P33Mo6LIISjB8fE5gknOR8qe5pX8OWaCe5NXz6YA3TNCiGRFBHeyNdaI/j7JeNVzbadn2nd1Orq6BJ4/QgBBnXgGWJYm9nPpLjnxj8hsRwWgg57saXKNZYCz8mDhC/OX0H0J7WX0nElyFRTBwZVXFddUxFySKShODQfsoAcwGsoTfZ774z7uFNggtvANo5C+N7bTpzGi5icPo7hq+i7nquQH4SkKjfOEnuWIncrngVCKA9XcdZ1CWtnIHgq8uEB/iaoh9MnftOH5bFySAyy74I+BuUkRbt8oKwnhMZbagkCjk4bQ+U6OBfpaPBENfC0KObu4UPnihmvH8htIjs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4347de98-232f-4fe6-7b1d-08d64b4ad2f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:46.1733 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 19/23] riscv: tcg-target: Add the prologue generation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index bf3b04f7dc..4b8f65f367 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1575,6 +1575,72 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) } } +static const int tcg_target_callee_save_regs[] = { + TCG_REG_S0, /* used for the global env (TCG_AREG0) */ + TCG_REG_S1, + TCG_REG_S2, + TCG_REG_S3, + TCG_REG_S4, + TCG_REG_S5, + TCG_REG_S6, + TCG_REG_S7, + TCG_REG_S8, + TCG_REG_S9, + TCG_REG_S10, + TCG_REG_S11, + TCG_REG_RA, /* should be last for ABI compliance */ +}; + +/* Stack frame parameters. */ +#define REG_SIZE (TCG_TARGET_REG_BITS / 8) +#define SAVE_SIZE ((int)ARRAY_SIZE(tcg_target_callee_save_regs) * REG_SIZE) +#define TEMP_SIZE (CPU_TEMP_BUF_NLONGS * (int)sizeof(long)) +#define FRAME_SIZE ((TCG_STATIC_CALL_ARGS_SIZE + TEMP_SIZE + SAVE_SIZE \ + + TCG_TARGET_STACK_ALIGN - 1) \ + & -TCG_TARGET_STACK_ALIGN) +#define SAVE_OFS (TCG_STATIC_CALL_ARGS_SIZE + TEMP_SIZE) + +/* We're expecting to be able to use an immediate for frame allocation. */ +QEMU_BUILD_BUG_ON(FRAME_SIZE > 0x7ff); + +/* Generate global QEMU prologue and epilogue code */ +static void tcg_target_qemu_prologue(TCGContext *s) +{ + int i; + + tcg_set_frame(s, TCG_REG_SP, TCG_STATIC_CALL_ARGS_SIZE, TEMP_SIZE); + + /* TB prologue */ + tcg_out_opc_imm(s, OPC_ADDI, TCG_REG_SP, TCG_REG_SP, -FRAME_SIZE); + for (i = 0; i < ARRAY_SIZE(tcg_target_callee_save_regs); i++) { + tcg_out_st(s, TCG_TYPE_REG, tcg_target_callee_save_regs[i], + TCG_REG_SP, SAVE_OFS + i * REG_SIZE); + } + +#if !defined(CONFIG_SOFTMMU) + tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base); + tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); +#endif + + /* Call generated code */ + tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, tcg_target_call_iarg_regs[1], 0); + + /* Return path for goto_ptr. Set return value to 0 */ + s->code_gen_epilogue = s->code_ptr; + tcg_out_mov(s, TCG_TYPE_REG, TCG_REG_A0, TCG_REG_ZERO); + + /* TB epilogue */ + tb_ret_addr = s->code_ptr; + for (i = 0; i < ARRAY_SIZE(tcg_target_callee_save_regs); i++) { + tcg_out_ld(s, TCG_TYPE_REG, tcg_target_callee_save_regs[i], + TCG_REG_SP, SAVE_OFS + i * REG_SIZE); + } + + tcg_out_opc_imm(s, OPC_ADDI, TCG_REG_SP, TCG_REG_SP, FRAME_SIZE); + tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_RA, 0); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:36:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="P/qY21sI"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="lHSkE9cW"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxKx5vV0z9s47 for ; Fri, 16 Nov 2018 09:46:13 +1100 (AEDT) Received: from localhost ([::1]:41153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQOp-0006mD-9l for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:46:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQFx-0007WE-8E for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQFu-0004rG-3P for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:01 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:18123) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQFt-0004qt-Pl; Thu, 15 Nov 2018 17:36:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321417; x=1573857417; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=R1D3mUhadKf8E/Xc4LVi5ZVgt9L5Bxe3N2Z5lHT9eR8=; b=P/qY21sI/WGbF7oNXc+hAKA4WL5l/IHRxFMfw/Epckvbnmlfl6GcoE+n zPRGpzLax2KXZS4f+kYl8f+U1JflS/NLBNIhxHgNrB8jvC+uhiIFJSqkB DgYXaSDCrcwXasyzKGlFMQA22PAqReU40YDxe4veao9bfgEyHCKm3H20D kzR6+3e7cu857QKeTMAvrCBkT9ohiPFEnML2lnNZxdj6dfFDzxOfRqRgz 5yeKIasRWfXjbgB/mcC3If/mndqSK7dyYteaYSFmd/agdPgcmYjk+BioK f2ygISefZHYXeLoEjCiFsYAvCS/rQZA3bS1eNC/r6ytxnPjkNxxIpHkYg Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="198884510" Received: from mail-cys01nam02lp0056.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.56]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:36:56 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L/2REaYTQNBMFZ1Y5DzEq8/DAR1Xn0k7rwxuYYJSjqM=; b=lHSkE9cWFxuVa6ptXelfVGdf6lHH7mIvfhuLNYlUs/qKxieYUNTee3+SrLOA6eObT4ZaRcdrVWfHdqiCsD/etHBibPxHxxBrb8sihzGeQDGlzRnoyxjo7vrRQ2nipPAljdsDgTiyy/dkGB8b3x+GAwaMBwVlLnVcstyltyyZi68= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:36:55 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:36:55 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 20/23] riscv: tcg-target: Add the target init code Thread-Index: AQHUfTO24B1g2SO13UKkQ6rSeWsicA== Date: Thu, 15 Nov 2018 22:36:55 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0102.namprd07.prod.outlook.com (2603:10b6:a03:12b::43) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:xhKeTNPlHQkXwdEQkUDiJITvVO5Or1avxJOnFg9AZ8vxldvbKvsPaoWAaKFqp1XVaotRgIsga0kV5hlVwzYJx1LUrUKIBzhKbt4q3V8nPx285rMBAgnwsPa/v3AKXoRZiVjKV5+XqFkTVcKJ6dguuq3eLUmzJn9I82wWFzIC1P1bFyMKP/60549t3kc+TKSXuBcZltDBreeC5fX57u8qqrxV96sXnCsTwSWoWG/VIegFxMbSt0YOFcPGV+qXjoQlPGQZLNCM6u88fBdwZejeXLf79IINiZ9/5vuCubpRA3WQ4eEbQtmw/OewaheTUUH1pPzcPtjKv00FKno/pEJDaQdkpWq2nJoVJa0JkkOhioBWcIpKeREqEs8EueRvGJ+TsQE82raGkmLRN7TvMHYmm7WcM6O+X265qyG0AZ/I0oDX/2TLbzI60ZBUdGVYyvyEtsEf+cH7epWbsdXZKFt8yw==; 5:inmucr2tXv1muE4+sqYKjjGQEWzhMEyy/ypgpwQ8/GgifBklSffFwwK+uqKgwLPqpODogj4dPCZISp6nsIBGndG/gKAuSA1hQqkFD7AK2y92HM+Jcbc+20n9qoLJJnHTfg9BRz1g1aChJE6nWX2srmfaqm70neINV7xhSzX7hMk=; 7:VrDBHRg+8VHA6XjtV26VF+aL9j5OR4pADf/ChYxg6IhJwFLMHb6qFdXolzSKx6KymzY4KYRpO5j9MmXpyUgrGvmR2yJNajPESdNV0DFGkGp7ZVXdzgQaQbKOrAXkQ+5YHncon5BWpg9aYGNjS3+F6w== x-ms-office365-filtering-correlation-id: 358f9b88-c5ca-45d4-2511-08d64b4ad84e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: Xn86enIjxsl/QRzy56CxW32K++2QgJldM78i3rMAOnQg/RvGEFzHvxoX97tHCKKlwo47oW2Y6//BJ1ZgZGqUwHaY7DmO2032Peh8g4X6y3Xnf8KXlzaUGnWrp8gUYqOxtbqR2AQmgdkneWWw4UQ51ALCNGoZEDXxl6tGotr+MqysUsc7nWLHj+5G5Ai6eI3kG1j23chGI/aFpMxRKMASJg9tBkVWa/5NoCbj67o8ARXBg+1tulZntBNbkzyYIBsOi9qaHnaDXihxQwVkUBhDcsCSz87y2i4VlNTQWLYGSEs3yQgyGyTuGyrxppWDK8e+t9/IupvQNuqg1NLuwG+9tgzO6I3+jfD+7LEc1J7V3qw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 358f9b88-c5ca-45d4-2511-08d64b4ad84e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:36:55.1980 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [RFC v1 20/23] riscv: tcg-target: Add the target init code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index 4b8f65f367..dfc4e8b44c 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1641,6 +1641,39 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_opc_imm(s, OPC_JALR, TCG_REG_ZERO, TCG_REG_RA, 0); } +static void tcg_target_init(TCGContext *s) +{ + tcg_target_available_regs[TCG_TYPE_I32] = 0xffffffff; + if (TCG_TARGET_REG_BITS == 64) { + tcg_target_available_regs[TCG_TYPE_I64] = 0xffffffff; + } + + tcg_target_call_clobber_regs = -1u; + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S0); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S1); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S2); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S3); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S4); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S5); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S6); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S7); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S8); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S9); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S10); + tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_S11); + + s->reserved_regs = 0; + tcg_regset_set_reg(s->reserved_regs, TCG_REG_ZERO); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP0); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP1); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_L0); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_L1); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_RA); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_SP); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_GP); + tcg_regset_set_reg(s->reserved_regs, TCG_REG_TP); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { From patchwork Thu Nov 15 22:37:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="Mpjc74fB"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="cv9/Zpfg"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxVw5LNkz9s47 for ; Fri, 16 Nov 2018 09:54:00 +1100 (AEDT) Received: from localhost ([::1]:41214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQWM-00064v-9F for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:53:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQG6-0007es-Vg for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQG3-0004yy-Q4 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:10 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50687) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQG3-0004yQ-G2; Thu, 15 Nov 2018 17:37:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321427; x=1573857427; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VogOQjFrd3wYQKzXil8KkY1CNgS8koY1j2JjE3rmNIM=; b=Mpjc74fBR1WEb4Tys51FVvgiuE+oCHG/R8+EuXeCjD1uIW7V4MQYvzBi 6J5ccOz8pIAag5bQWkp6IPgGqKfT0QoRN/cO51WtpTYA6clCZAIKfoYKn 3LJWmtBd8I0Mcs6CIzrrv2ai2x8AhXaB6ySioUaK7fU1YfHf7U7gWuHc+ zgSUXca/VMBKQoxmS5kZajrm9gmwVETNCQiw1AL2ETV/kSZnmnABxREdL 0BNt8pWFubyufcA1NxpoIHkCKeio8u/EtSk6I1aXnMq0PosaacoSczzGw zNBIyF50cWkgTL8VGcIjjaJ1BWuAGRNbf4hUYLtQW1NI8SuuIJtn2PRzf w==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523442" Received: from mail-bn3nam01lp0176.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([216.32.180.176]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:37:06 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzDEfzS32xANlyfIIU2aLVjqpwNmDvX6/L1+J/iOCHc=; b=cv9/ZpfgLTxrlzhP/Jqsf9OjnWOcjUVkXc3pHFiEZGOtvuKyIebiOgokq/09R3aLUgbQ5V9mef6SwfGCOk8PxKtOWBTmHp0rz6v4PqdvkdAwbl5nRRcXwHeQW+0VmVozSjOXGjc/j87o3yRBy9Mogx3ws+wV9G/B393653pFSbY= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:37:04 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:37:04 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 21/23] tcg: Add RISC-V cpu signal handler Thread-Index: AQHUfTO7klaE228UjkuSpAey4feriw== Date: Thu, 15 Nov 2018 22:37:04 +0000 Message-ID: <9e9303670bf6210b643b05f9bddf9c52f684173b.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0078.namprd07.prod.outlook.com (2603:10b6:a03:12b::19) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:PYyRMsCRxPI8v0IqZi3I23vteVy4ClWHEiBbsc44aCMiA0t1XvnkFsbkMps2PqKhVLNJs8GYjr220h1OJjtydWqUMVX1J5amsnIsYJsLAEXAH3T3SrU95JDet4/QO8XAXHtS/Puxaq2WSwZ413hmfPg1wFWShdR08swwy1n3VmVvEZnrbjT7tlSbH8Rptu28HbnzCFUcgl5284Dz9cIhLrDFccSkjGN97Z6unQ2N3D9pQSrp13MbJgxzWaG0y3OjQrfwkH+yoIq8SKjyNZ8h1Qi/UgCgStcsf/EDcQJSovTefHYnhDe3O4A/vkcO/8JDcXnopJBBR+0od2OmCnv/lbeWAaBwIR/kzsRMSL6ZBXOwO/ci7kVtT/vXtLD8zQNzEBgVq3ZDnUPBEoMpVBxF8xo5ZBxNkNz4k31Fh1Rvlb8iChaePrkV11rSmxtCzMACJaQRc8Vbk/evX2VYHlDCxw==; 5:ulPNW0tbDXkunfvOEHsrxohq0uIbMEZja2eooyW+hyg0+BozAWy7tVG3ydCcl8zBREKspSJV2omTzSS6wgAOx/PK2jbmsgQZ9I2Fsgpxb4nywYR76Ppz4c+rDQd/1sr9Uu33pqE+5C5lwVW+yAO6D3QiTUCkMeiYxwNPgsTTBSE=; 7:YJG2MiKXZheRH6hSExy6YDC2G1D3KqkV8+A6TKHL+6SajE6Hf3CZc3OQIbExcKU6jsz0qqPt1VhHV8ANyewvBxLGW7RcPLgUObEtj8Od8YvND4aafj1XHmTwvUj5YokfMkn1hSghEX0aM05KWCP73g== x-ms-office365-filtering-correlation-id: 90550e8e-36fb-41b5-19ea-08d64b4addc6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(14444005)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: PW1lXcFGAQnpx6uvZwhoc08kAcsagC+Bcc4wLHAi4ua+L7PHu1Dl/fHPQkV+fBCUq6C9z+Q3Pd9L6NQR1YL8IJOleLgcw//Ljoqo5bW5J2PyrD3DTTVVNET7cebPosELXKnTEf1v/0fvnIf6iNyswtxfqb2uVF5w+KRF/z5qBjTjXc0SzrBY95A2b7DcgNXhqV7WF2+iQLJC9NNOxDuOqS/FWv5TX8xWdc7HQeKSu3rdpWp5MuZd1Ge6Bj+CwEdWhY8iAqy9O3NsJbVQM9zEXPGvfYCGsW/XQrPeVNq0BYcaNalLpWgvE0KmtrszN7YeUC2W1E+NopHLJSYqHwfW/mJw5a9PkfeMWC1uCHhohdo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90550e8e-36fb-41b5-19ea-08d64b4addc6 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:37:04.4658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 21/23] tcg: Add RISC-V cpu signal handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- accel/tcg/user-exec.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index cd75829cf2..bb693484ed 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -571,6 +571,54 @@ int cpu_signal_handler(int host_signum, void *pinfo, return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } +#elif defined(__riscv) + +int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) +{ + siginfo_t *info = pinfo; + ucontext_t *uc = puc; + greg_t pc = uc->uc_mcontext.__gregs[REG_PC]; + + /* Detect store by reading the instruction at the program + counter. Note: we currently only generate 32-bit + instructions so we thus only detect 32-bit stores */ + uint32_t insn = *(uint32_t *)pc; + int is_write = 0; + switch (((insn >> 0) & 0b11)) { + case 3: + switch (((insn >> 2) & 0b11111)) { + case 8: + switch (((insn >> 12) & 0b111)) { + case 0: /* sb */ + case 1: /* sh */ + case 2: /* sw */ + case 3: /* sd */ + case 4: /* sq */ + is_write = 1; + break; + default: + break; + } + break; + case 9: + switch (((insn >> 12) & 0b111)) { + case 2: /* fsw */ + case 3: /* fsd */ + case 4: /* fsq */ + is_write = 1; + break; + default: + break; + } + break; + default: + break; + } + } + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); +} + #else #error host CPU specific signal handler needed From patchwork Thu Nov 15 22:37:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="ch/0c1IY"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="DvAcrZ3W"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxKS25tpz9s9G for ; Fri, 16 Nov 2018 09:45:48 +1100 (AEDT) Received: from localhost ([::1]:41146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQOP-0006QT-QN for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:45:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQGK-0007tB-Uq for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQGD-00051l-Mh for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:37:22 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:52061) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQGD-00051d-8I; Thu, 15 Nov 2018 17:37:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321438; x=1573857438; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Xl4JWw9lDIkcmyLyDGSzdZNzbsGImJzxLnNhIpReGcs=; b=ch/0c1IYAVMMCZ1oHg+r1Vmgg3Mr8asHuTmz24+KCh9FxevTrAyfHGoc cLsJ1PqtHx7ZDCiBfbJC7QzqWTFJDOkChW8JAL4qoVgLDsAtEc6W1i/xk ynxUu22Au8sG5/HtXwID94+9stH1VroncY+DmtoC6k+BLmtH+4VMEn2Ao nQxL8pZzeI7hRALhmpr0xRi2AKxU1eeRgGKTcmGcNlt1UV4aGL2fNwbKB 1kYPwoBlGy39ilr7+XnAJv++F4SPmOmHEatdr5zE7TeqduQWWIWfcw9I+ M5dSSAF6T5FZjJskVy2gNUE3V9PxPTFJeT2CiQ7kUCQg5xwyp+60UuT32 Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="99166069" Received: from mail-bn3nam01lp0178.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([216.32.180.178]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:37:16 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+je7nAaBJndhfAMUEdOnXbK/PrzUW6fnYZdTN+2thhc=; b=DvAcrZ3Wh+Is5qL1VfUX7zWv1uB0aaNC7IFQ4p1Rr6PiEPhenxeVasEtGpDbEhSJK/FfIzr7/vtA/9cctVu3eVYrrprvCszrC0CeYD4EXXchxkKSnNuIvTmBA08yWFmMFaezqa/ea2hqeeGB1x5PltQoEh/cvASUIKoI+10gTfc= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:37:13 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:37:13 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 22/23] dias: Add RISC-V support Thread-Index: AQHUfTPA/tUGnnEISECwiutuJlLLUw== Date: Thu, 15 Nov 2018 22:37:13 +0000 Message-ID: <84be65cc6caa8421b04ac381f4623e21f80ee39f.1542321076.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0093.namprd07.prod.outlook.com (2603:10b6:a03:12b::34) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:BsA/LNQt8zjxw6DMLHw4XRfAA/s1oYH0Ehzm4l8z7o4C3SiNsRUgic/KrGVCkeZspIziXEPbP+KZy+lh7wQ2OzfAHAx9nRroWLvSIA9XDkLFrUWJ8qXtaGx6G8zQ5uG0qO/nF3eEy2HaTpW4yJF/ZNIhewwc7ZkLQq5biXPEhTho1MAM3DBjpjL8o41iBdbd20+8qkhDV3R0AW50UZRajfnTqyWaLoC5ZB7WU4k4m9RSuoFUzae3WKbAocI6gxjts4WR+5xfTVaV1gR6ur8cb/l8yhQ1nuCzKiMSfR9cMfeb3QbasfrTGkY7s540PY1mxRGuCioczhYfhXRxWn4OyYHzG4QxNKKYggkL5Lhdzy//5+kSXbZCouhTB8yr5d96zc3CZ81r6lzk9hhHr4zJ5KRaUPVm7gYL0POy6IgMcan0Pg9TaGsM+HSsgUy5vYMuEY3+8CwV6sYsWQO5JehZlw==; 5:pTiXTecweLh1QZwKiKVDPjXuR1u6P9l/icbb8EsC2GvoSVA4wPyPhSLfVoCrBP5V1HyHS3mj2/44ti+irdcPrt/lj0LI8TrkTUKZdZTqY0NvLYVuqNQXYchyZqd4BImIA0iInEXjUZ4rh+QChzHrkQp5qcAnJ8SzY+9xE2MhiWY=; 7:Q7lAeMqpj68iKeR3bDMrhSMqJg3oErv3tTelBsOvppVK9KM06o1NDf8XgP1iDy49BEuG6g2QbwJutaR9mKxVSY4L2KAu/KuX/bHkUvuFhWCi19dwZAzzHbgINECRwpH6yPB9LbbBq0gEMXadx2q7MA== x-ms-office365-filtering-correlation-id: 02fe60ba-1f9f-49ca-3979-08d64b4ae33c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: xu2FDf4dyCEaekcVYOvh+pkjxZwOzIs5nQ6CfDSjG7YoIFLxO5FLzSbHVwIgyxToVDbOYO55iLQwPmuvUnSvSwi3TnoloN1k/hUgasfVygze/t4+JtWat3NBFmxnA/k2GUEvITMun2flORTsQNXKeTsocfv27MAYH3GnhQ9JfbqHSiNFtwsd4yEHDJgTh0Ei4kjOaFkYAjFPEH9AogBHTFwlwK5izu7psGSpXnTJfSzlGsqFd5MnTJK9lZt54cHJkVKgnGHztsBhvhaX8tEgHhxN068V/9PEsEiMoRMxhNurrElvgIlD775jFQHv+5w2bksLzgZI/qFsNUGUsqQ/EdxCs+e64EHo2wcGH89LVZY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02fe60ba-1f9f-49ca-3979-08d64b4ae33c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:37:13.5014 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v1 22/23] dias: Add RISC-V support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- disas.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/disas.c b/disas.c index 5325b7e6be..82a408f272 100644 --- a/disas.c +++ b/disas.c @@ -522,8 +522,14 @@ void disas(FILE *out, void *code, unsigned long size) # ifdef _ARCH_PPC64 s.info.cap_mode = CS_MODE_64; # endif -#elif defined(__riscv__) - print_insn = print_insn_riscv; +#elif defined(__riscv) && defined(CONFIG_RISCV_DIS) +#if defined(_ILP32) + print_insn = print_insn_riscv32; +#elif defined(_LP64) + print_insn = print_insn_riscv64; +#else +#error unsupported RISC-V ABI +#endif #elif defined(__aarch64__) && defined(CONFIG_ARM_A64_DIS) print_insn = print_insn_arm_a64; s.info.cap_arch = CS_ARCH_ARM64; From patchwork Thu Nov 15 22:37:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 998619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="mD7E+dX5"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="etEgCVUK"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wxZB46Sxz9s47 for ; Fri, 16 Nov 2018 09:56:50 +1100 (AEDT) Received: from localhost ([::1]:41237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQZ6-0007zR-7M for incoming@patchwork.ozlabs.org; Thu, 15 Nov 2018 17:56:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNQGw-0008TW-MD for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:38:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNQGt-00059e-AR for qemu-devel@nongnu.org; Thu, 15 Nov 2018 17:38:02 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:50705) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNQGs-00052j-9o; Thu, 15 Nov 2018 17:37:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1542321478; x=1573857478; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=sNAkeF27UM3OtLEjkEGHG14JH25iJ1vHDWmedDNdOG4=; b=mD7E+dX5zMf0boQEpGXw2hfGHLqFZb/WoxvfIBNpsOU7t29iFKJoDFrc ZLUD/69ru3eK20bFbpMjuKEZz4kROMdfY+tD7KjAmLW5P1KH9SOxOkZuH 5m+AXzkeobKoJPuZ38PA/6sMSF6FS5N45eOXgcKVRxrefgIpGX8AyzjFA BqMg+vG+fz0oSvfTMf2y+gGNKnjUj+9oLBy8BnolSfCbu9Z5c2oHeSCq3 aRSWOYe5Td+7eQPB7CtSJqich63pOkHZBK6HZyyScKTmcVBMYcFCePJob A1qFEF1wuuQ4V8EvaUJ8Nm5nBa9S4yQ3I+xVVxpdy3SwV2dSfUFanZReK Q==; X-IronPort-AV: E=Sophos;i="5.56,237,1539619200"; d="scan'208";a="95523469" Received: from mail-bn3nam01lp0177.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([216.32.180.177]) by ob1.hgst.iphmx.com with ESMTP; 16 Nov 2018 06:37:24 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bT0/h0/F3SUICJU8fPqLe86CfX7hlSOVHi2DEF6jp2U=; b=etEgCVUKm4B25iMy9sVygRDjyieeYB5Te7c/YoXdZwrWQvMUHzL/R+5OR7lRGIOSbvdd/Sa9lIo6cYfaNNobZon+97Noph2n5xrTnAyqVJHR05e/G+MxpUC2C96Knf6ZQmr4rrBgWzPJhWUQ+4hIE1yUzqO6w1dy4UjImnX4jOI= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0865.namprd04.prod.outlook.com (10.172.169.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.36; Thu, 15 Nov 2018 22:37:22 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::4853:2cc0:27bc:a62e%12]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 22:37:22 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v1 23/23] configure: Add support for building RISC-V host Thread-Index: AQHUfTPGjVeH6MKMOEKTZhqeG0wMdg== Date: Thu, 15 Nov 2018 22:37:22 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR07CA0077.namprd07.prod.outlook.com (2603:10b6:a03:12b::18) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0865; 6:iZinT/KwwQ4VKQP2ndeAACj6h354Khmov38pzOnegwaJTojmqv1em06CtDsqfu9b4LA+jphhjXmPCXH71O5Fki8EB2fsUVfTe1LmpzxmheCgoMJGQu1aZl/aBkyC8fvH80GlFWjz4dmTwBVibdNHh0YPFvTGZctTWnAOGD6tsGs0HMa9qacltJiDaGRBCJl/wkMPvIhyN9P4boPrO3sDkxqjd2whL9x/Yaq2J2un2DoJMSkxOJgXZxXrjcgpqsVc8Ur42fPk8tG5LPHH0CSwJJ5eUDwvgD4GZ7Vr+H3WzugDHyL7LdpdEyI7Km6Rv+QEsOpdwWMguQX7PC8h7LNlzCIbVKe2dT50eUJTZhI91ZGHosLoW5HNMtcwNJM0Yn7sZyDuSf4+wXT50g45E4XYmrvENu0YbmYPLVrrZChzU68LFdhvrkzPC+DTAaSAv1jbYXZQuziCr3+dC34rijxDsg==; 5:z9A4DbZ8I/G4L94z5hru20HVUKbXEaiSmJe19trm7Ap2qgO7vbFzLlawXRTaIphffIoyYU2Ek4ghDrfIRFfpBxRtRLPoo3iMLbRLE9u+sDC58UThyKjNXYQINVOfLDTvEHFVjEqsGv0qm8JX4Do2uHM8UfYW16nDkl53rkWYIoE=; 7:Spzv4nRtXf58BRZHlLo4bXRCPfvKnITXUxgFyG6eceQn7m0bMvtDpT67fqqaJZ4kgvGFn4z0Y+FnnQ7LDA6c0u07xOcqm+a+NubQDI4p7OtiaiUB+KhwGpnds0mcJA9L6juhTe/H40oRMBOSF2MdsA== x-ms-office365-filtering-correlation-id: 76c36f27-7190-4039-82a2-08d64b4ae89c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0865; x-ms-traffictypediagnostic: MWHPR04MB0865: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231415)(944501410)(52105112)(93006095)(93001095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0865; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0865; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(376002)(39860400002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(118296001)(8936002)(256004)(6486002)(25786009)(86362001)(2501003)(72206003)(105586002)(106356001)(2906002)(97736004)(478600001)(66066001)(186003)(99286004)(54906003)(386003)(11346002)(2616005)(446003)(36756003)(2900100001)(486006)(6512007)(476003)(6506007)(26005)(39060400002)(102836004)(5660300001)(305945005)(50226002)(71190400001)(71200400001)(110136005)(6436002)(68736007)(53936002)(3846002)(316002)(4326008)(6116002)(7736002)(14454004)(44832011)(52116002)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0865; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: pzktIQX027uzaikkLhYL59NfE6aYDRgYwGyRINMVRHOoYIaJ1bQ6P1ouXhlC5GiQK60/0QTKw0l9wuuzfRkiFtCMEDrSEBFYr8R9rt526X4iDklzFoe9MoQvsq8QmrAAdsRI0JWPsQLHyt0vRvZV2BZZC/GMi0QsxDwdnaSypthnTryn7jJESITGljFi3fpEPUKNo/QySklOdEATrYhUfj0W4nCXdyHomX/NwQlITqYfRZhzWhxmPbpdYrUTnsNHRGEjjbzotPLz5WOT+89I1nWFYnuPBXVC/W8P7750PBUrTHltTR7tjtFTfZXYEBRELa2JQv8ZD3siYfYHHQQSkobgqGi0QC6tS9ijmpE25p8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76c36f27-7190-4039-82a2-08d64b4ae89c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 22:37:22.5411 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0865 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.144 Subject: [Qemu-devel] [RFC v1 23/23] configure: Add support for building RISC-V host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- configure | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 74e313a810..8a7b9fc933 100755 --- a/configure +++ b/configure @@ -700,6 +700,12 @@ elif check_define __s390__ ; then else cpu="s390" fi +elif check_define __riscv ; then + if check_define _LP64 ; then + cpu="riscv64" + elif check_define _ILP32 ; then + cpu="riscv32" + fi elif check_define __arm__ ; then cpu="arm" elif check_define __aarch64__ ; then @@ -712,7 +718,7 @@ ARCH= # Normalise host CPU name and set ARCH. # Note that this case should only have supported host CPUs, not guests. case "$cpu" in - ppc|ppc64|s390|s390x|sparc64|x32) + ppc|ppc64|s390|s390x|sparc64|x32|riscv32|riscv64) cpu="$cpu" supported_cpu="yes" eval "cross_cc_${cpu}=\$host_cc" @@ -6809,6 +6815,8 @@ elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES" elif test "$ARCH" = "ppc64" ; then QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES" +elif test "$ARCH" = "riscv32" -o "$ARCH" = "riscv64" ; then + QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES" else QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES" fi @@ -7306,7 +7314,7 @@ for i in $ARCH $TARGET_BASE_ARCH ; do ppc*) disas_config "PPC" ;; - riscv) + riscv*) disas_config "RISCV" ;; s390*)