From patchwork Tue Nov 27 21:09: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: 10701477 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 0127915A7 for ; Tue, 27 Nov 2018 21:34:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC4662B6A4 for ; Tue, 27 Nov 2018 21:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D099D2BD4B; Tue, 27 Nov 2018 21:34:03 +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 536742BB20 for ; Tue, 27 Nov 2018 21:34:03 +0000 (UTC) Received: from localhost ([::1]:44638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRkza-0004jU-EP for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Nov 2018 16:34:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRkbu-000663-JQ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 16:09:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRkbr-00058t-Ek for qemu-devel@nongnu.org; Tue, 27 Nov 2018 16:09:34 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:36228) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRkbr-00058J-6U; Tue, 27 Nov 2018 16:09:31 -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=1543352971; x=1574888971; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0UJUMZAl5jWUNS4qw735kIQJ999GrnWsP68bPYu4/H8=; b=fxv3+SmHmLhxhuOKoutTuqlYyoQhscVYZMSUKB+Eo3uGsPd+p9o8Gf3R 5s/yBZze9oKaUamZ30MtdJ6FxvIyXbNLgXs/5QaHDDmgDGQgFZQh4mtxI YzrXxRVEaZYZXkw5QL94Yk2IFrktxDB+uTqbSaGEiUjXVrT/BLwlhULQm EKH43yRzE0yQtuBBVxhiD8GLmNAvMjA8dWfvsELgC2+3S3eLXtmoHecIf 1CSJslNjf9B6Mo4Zi9znMP4XfasNaTKQ0bg6ykm/BPyDv0xtfKdptRj9j 8KiC4nMqBomRqpJtur4VVbYcPlhYRAZkRZ9yg7efLNTGNNgwxwayHCNys w==; X-IronPort-AV: E=Sophos;i="5.56,287,1539619200"; d="scan'208";a="100064290" Received: from mail-cys01nam02lp0047.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.47]) by ob1.hgst.iphmx.com with ESMTP; 28 Nov 2018 05:09:30 +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=LEwwl76sQ3rvSMuy6XlwCt2DjvO80qZGSgZ8MyIb1aY=; b=XS29v+qaGhUPVrklAI+SVg29Osile13oO6UNI/CTRruYkNtLK3tuIFTOI/J2l3bbxtTf2Ima/bX1SEr0OrPvFMViNLCSHgXi/LlsfM35UXJKGAtYizbIB/F3F1OTRSKH5koBD0rAS8RwdM4a05Xt/M7OkufoUzlwqgHec8xKSpU= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB0639.namprd04.prod.outlook.com (10.172.166.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.15; Tue, 27 Nov 2018 21:09:28 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::d13d:19d3:fc93:2ec5]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::d13d:19d3:fc93:2ec5%9]) with mapi id 15.20.1361.019; Tue, 27 Nov 2018 21:09:28 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v2 19/24] riscv: tcg-target: Add the target init code Thread-Index: AQHUhpV7+CvNYo28S06WJ/kBCvoxXw== Date: Tue, 27 Nov 2018 21:09:28 +0000 Message-ID: <7beac896a4d4ffd873c24a74f7f7be4118ba7e5d.1543352682.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: BYAPR08CA0017.namprd08.prod.outlook.com (2603:10b6:a03:100::30) 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; MWHPR04MB0639; 6:BhRXB7WpEhxr+m3BY6YyakRE2xDR616eWUDzOVuQk3sa/us3CIEUNJIYLBlxJN7Zm8Rmy9E0VhhyvNm+Zm5QtBdCbz3x67YIybJyBqnZypLLDNGIPiQCAJ7h1a17tItF7JD7Bya7BG0jvZIFlOS9Jo/w0KwHhr8SLrKWjhfCO6VOE6SKqvExG31ILgTIB4Se4dFkbMHPf3EH5q7Gc5KrN92+F6K0Xicz9QEFO1mRMNzpdhR1DjE/QyecNOilVIaSj06aZhTFY9Hzs8cOSQvxIBGve9ZzV8bm9Mr00/bDbqALw7a9ASQbQIEOPbprLC5jBkCFEkYpj6mftrNKJfSOQ0ocXbBEVAlFfCfT+/mzc8KYjQeujRPnsV/nCTdXz5Br8KYJvNCRfbZGv+yya47dSw6xSkx/+Y9WYLqFOUCSTmp4+Ur4Ptw8drpRCjuBlAomLktkb4lQzkVh9NCrGwzZDw==; 5:m/adKryTbJSSxa6a7knTZRmuQcRcAUt+LMEltIYYeGva2yEvyRWXQmuAJ7becnj78OL7vJZ7DT/PFqoA1xRN82r42hI46NrPVhxsf4xhtT+2JKYbid0H/HlIHmuJJNgoXhFRqSO+svV3a8Sq+lsGjrw9igs0KuUZqfuKcwuZvEU=; 7:LRtJ7q4H1zHDUUeC56sSBvUm/EDK6RZYohBMrwt76FtklaanEjyKAhJmYBp9jhAsZl/Fuy/IUmmlaUHSwWp9ycQ52MKEdAHVQ2yC3PVdVXujHmUYHI5PsLldUwR0f96l0C8sWWfXxh8Sy092gTXG8w== x-ms-office365-filtering-correlation-id: 574510df-458d-4349-b312-08d654ac9e0f 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:MWHPR04MB0639; x-ms-traffictypediagnostic: MWHPR04MB0639: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231443)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB0639; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0639; x-forefront-prvs: 086943A159 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(86362001)(6436002)(53936002)(97736004)(6512007)(2906002)(66066001)(8676002)(8936002)(81166006)(81156014)(50226002)(54906003)(110136005)(5660300001)(316002)(575784001)(118296001)(7736002)(2501003)(6486002)(68736007)(305945005)(36756003)(478600001)(72206003)(71190400001)(71200400001)(52116002)(76176011)(6116002)(386003)(6506007)(102836004)(44832011)(2616005)(476003)(3846002)(26005)(186003)(486006)(14454004)(99286004)(446003)(25786009)(106356001)(39060400002)(105586002)(256004)(11346002)(4326008); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0639; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-microsoft-antispam-message-info: L9hbSZs/rvocYueSCZwcyPmV7KDoqKz6jSxXeSSgUHe9ltEnO7S/zlnZpCkll74yYc5WNe4Zn5TmC7d4ZiI3T8e3A+s3NN4CpikctrNKBhyJu3hAqbzf5pd52B5oznC8CZwXZWH1gJH8GweHFVKdJEc8etqDtnolWiIHuLSGL68CzzSTyHswy+31xN2u1B5aY/d7bHSwrx2pNRL+aCl9jOWadirPZIOSj7yO663MHFWFvV0+IIqwy3KlmnfUtt9EN8sLbl4+ZZARkHQYaUoBAvxjtDtQNSFORU++4ynjNVxhEEP0y+EEQ310H2ONDHROtNlcCZ12UnsorWUe4PE/cgq/+CM3iUCDqwXi+7cWAew= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 574510df-458d-4349-b312-08d654ac9e0f X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2018 21:09:28.4784 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0639 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 v2 19/24] 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 51961ade81..13756f6d0d 100644 --- a/tcg/riscv/tcg-target.inc.c +++ b/tcg/riscv/tcg-target.inc.c @@ -1683,6 +1683,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); +} + void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) {