From patchwork Wed Dec 19 19:19:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 10738085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D33514E2 for ; Wed, 19 Dec 2018 19:42:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3485E28517 for ; Wed, 19 Dec 2018 19:42:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2864828526; Wed, 19 Dec 2018 19:42:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FAAC28517 for ; Wed, 19 Dec 2018 19:42:58 +0000 (UTC) Received: from localhost ([::1]:33886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZhk9-0004Yd-OY for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Dec 2018 14:42:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZhNt-00031J-NO for qemu-devel@nongnu.org; Wed, 19 Dec 2018 14:19:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZhNp-00021K-PE for qemu-devel@nongnu.org; Wed, 19 Dec 2018 14:19:57 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:29366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZhNp-0001z0-Cp; Wed, 19 Dec 2018 14:19:53 -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=1545247193; x=1576783193; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=6dTaVrWDZrdrGhHmsDGhElvsiZxKoK0fM6IP0OO6jNY=; b=Ggr0sixwEmtbTZTkya2Jf9Vw/PmvOpXS0kPxneGrz48+ib333cVsqsLo R86YYBKj+JKCuuQ3QQwsGwP0AHAs6GJ4oonkOwWmS3D6HRSw7tm5GiaZn a9EHC59teXjDrpUR5BpRcKe4zuS2aA3gDM6XuA36QBBnpHQXeXIxVgvRY ary6yWTMpX0sTLtOUwCgxMhoZrQQ8XEJQfWs9eVmfrlVvi0Cz67/PGDMw 0NrSDc+yw7Ds7HjvGvCuvINrf9GZZ+qTHJCQwoJPgViM8CWaoMilh35H/ 47ioCixA/rzigXn8Vef1tHAx5wm1/RbDQDbKGpWiPlq0lMuZltqxQRevp A==; X-IronPort-AV: E=Sophos;i="5.56,373,1539619200"; d="scan'208";a="97004272" Received: from mail-bn3nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.58]) by ob1.hgst.iphmx.com with ESMTP; 20 Dec 2018 03:19:51 +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=1Or/TU8JuGF75Hf01ciUsh21qASFfQbIVhGKWJgUeXY=; b=T0PeYSV49/HTJGU9whaIciRYfzieOGu0HbDLRE3tzIAbNBGp9eFEjBbGoNLbTvmqQn4Vvq12rq9/ttwJSg24UQX4D8mPxWjxOOFzLsaTB+rq1b1+DEZxuYJwZesPd+hv03S+/hPBEGkiSF+yjDKBj0cO10IDpegqpFBR23t4RgI= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0832.namprd04.prod.outlook.com (10.172.168.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Wed, 19 Dec 2018 19:19:50 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::9067:fb44:66b2:7604]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::9067:fb44:66b2:7604%4]) with mapi id 15.20.1446.018; Wed, 19 Dec 2018 19:19:50 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [PATCH v2 20/23] riscv: tcg-target: Add the target init code Thread-Index: AQHUl8/P2QjuKfXVMUazzXJugerYag== Date: Wed, 19 Dec 2018 19:19:49 +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: BYAPR02CA0005.namprd02.prod.outlook.com (2603:10b6:a02:ee::18) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.171] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB0832; 6:Koula++WGZSZiMt9ZpYv8nW7sgKkp2w+7HhbE+YEsgVALtgCrs9otSX6el94aC/OVfybwuEj13EGmgiI62QxyoIG31tZLglGAoMUqQUohp9azD+Nf3PQElLMzovCpmc1hTml1mp90MmSQS0Q9L4AgXEUkBg4H7UqJYlBUiNMuTGQ8Cn7d0cecAbHq/ZM3Myh1VOyfBbRSlYJecyssA6zDPwSFodkYb2gQ4EJQNqcO5Qy2tQ+3DcJ6YAVMNLsYhnRkoeXKFqbbOuM81QpyZZwh8SzB3uFuMVl45aCoavkMHPLtlk0Y/1bS0CzLxV1CpMUvL7BTMdSd6WdRYp3kpFiRnvum2Dnmv6XE1Kp73x0BwAIWbPY9WeLQFbRLuJMB1hXs1DrFk9fbxvSi5mftu9ojCnEVaR/dVuXaXdo95H6/fkB3XFtPyJYYrt2ymRoUnSIkjccrNxAm+lLbKh64mnKYQ==; 5:O51DuEY6HA8qBnhQkQHQGsKz2pDU5Z8AFdPPl/myOHjxqplLmM28+Tkj0TTRmKlJPS8etSce4fjRxjiX+WUUN+jZXBVYXqCsM84ab82GykzVe2yxkp6yfghLQJv1wFk5EUyvqZUsHWDi/cOURq86XdrqlriZN0wqfScv63xlhLs=; 7:FWIagoWMVvd6UBozdsDZz7kVYQDxr1jte/c74BLldbHscIhmdmHXNgqTCQWWDBUgu9C3LYWLd5eXp8uTTKdgUqLyxD0Rkox8tRm65z3L/U7nJLEXK/FsxVAEtyU9DHN0o91hlt+IkzAtYf2pDw5UUw== x-ms-office365-filtering-correlation-id: ac09e947-7946-43ca-5605-08d665e6f202 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0832; x-ms-traffictypediagnostic: MWHPR04MB0832: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(999002)(5005020)(6040522)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(10201501046)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0832; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0832; x-forefront-prvs: 0891BC3F3D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(366004)(396003)(346002)(136003)(189003)(199004)(6506007)(68736007)(76176011)(386003)(102836004)(476003)(2616005)(44832011)(486006)(97736004)(118296001)(478600001)(316002)(26005)(6346003)(4326008)(110136005)(54906003)(186003)(39060400002)(8676002)(50226002)(81166006)(86362001)(6512007)(52116002)(81156014)(53936002)(71200400001)(99286004)(256004)(71190400001)(8936002)(446003)(11346002)(305945005)(7736002)(106356001)(6486002)(3846002)(6116002)(66066001)(25786009)(5660300001)(2906002)(72206003)(2501003)(14454004)(36756003)(6436002)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0832; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-microsoft-antispam-message-info: CzpmRQxet3W3l5s1tlEZa5fbuFra1+zmI73boYveWX9NdcQi14pdI7+x2BzDEdMZkenKeEcV9Zvu0m2Xitg1bQ73u0C/k8l9W+y8PDP8GY9y1C98IAlkEzPEQawfxrYLYZ8L02A1wWbAOwepgSJTIJWItOyTDXZQWroLqSOzC1UrbK5/ROFhyURr454mJz5gnO/2hxG1vODoIXgZoZKVDN66SC723fhwBUIsqn/JDNBGk85eZuAnT+ymHYTrZUul3gABkRVAIntbtGu9haRZXvB3moTWH/MUE11Nxvy9xgxN0e8Q5dwka4gT6wz3jYoE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac09e947-7946-43ca-5605-08d665e6f202 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2018 19:19:49.8668 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0832 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.154.42 Subject: [Qemu-devel] [PATCH v2 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" , "richard.henderson@linaro.org" , Alistair Francis Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index bc1a2bc4ab..f718542d63 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1869,6 +1869,37 @@ 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_TMP2); + 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); +} + typedef struct { DebugFrameHeader h; uint8_t fde_def_cfa[4];