From patchwork Mon May 23 14:17:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9131891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BC87607D3 for ; Mon, 23 May 2016 14:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5278D2822F for ; Mon, 23 May 2016 14:19:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4717E2823B; Mon, 23 May 2016 14:19:39 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0F332822F for ; Mon, 23 May 2016 14:19:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4qg7-0003ZO-Rl; Mon, 23 May 2016 14:17:55 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4qg6-0003Xd-8G for xen-devel@lists.xen.org; Mon, 23 May 2016 14:17:54 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id F5/64-02219-11113475; Mon, 23 May 2016 14:17:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTVdQ0Dn c4PQ9VoslHxezODB6HN39mymAMYo1My8pvyKBNWPWtrusBRs5K+bvfMXewPiOvYuRi0NIYCOj xMHtm5ggnNOMEh/fPGfsYuTkYBPQlLjz+RMTiC0iIC1x7fNlRpAiZoE5jBJrHvxlBkkIC4RK7 L31jQ3EZhFQlZhwsZ0VxOYVcJF4cf8zWFxCQE7i5LHJYHFOAVeJ7V/OgS0QAqrpuLWTfQIj9w JGhlWMGsWpRWWpRbqGpnpJRZnpGSW5iZk5uoYGpnq5qcXFiempOYlJxXrJ+bmbGIE+ZgCCHYw N2z0PMUpyMCmJ8p7c4RQuxJeUn1KZkVicEV9UmpNafIhRhoNDSYJ3M79zuJBgUWp6akVaZg4w 2GDSEhw8SiK8h/iA0rzFBYm5xZnpEKlTjIpS4rzTQPoEQBIZpXlwbbAAv8QoKyXMywh0iBBPQ WpRbmYJqvwrRnEORiVh3i0gU3gy80rgpr8CWswEtPihtAPI4pJEhJRUA6PE18OTvm+dJsV9Q2 S3d9PtdQoh5za99/z5Nls20eCOy5mNUg/fSyxZrzz102xVzYgWldP3tj5Lq2ETry93E2lhf3z paj1PtXfu/YAPhfuDYo8/XbnQ5MgOtzoN7csrawpLn3jMf/T7jh4Th0t867U/Gn8Etao+KSwT WnQ1q6D0kPrNmZs8VLYpsRRnJBpqMRcVJwIAX8uhvGsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1464013068!37465424!4 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34594 invoked from network); 23 May 2016 14:17:52 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-206.messagelabs.com with SMTP; 23 May 2016 14:17:52 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB3273C; Mon, 23 May 2016 07:18:14 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D59F3F21A; Mon, 23 May 2016 07:17:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 23 May 2016 15:17:24 +0100 Message-Id: <1464013052-32587-8-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464013052-32587-1-git-send-email-julien.grall@arm.com> References: <1464013052-32587-1-git-send-email-julien.grall@arm.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, steve.capper@arm.com, andre.przywara@arm.com, Julien Grall , wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 07/15] xen/arm: arm64: Reserve a brk immediate to fault on purpose X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP It may not possible to return a proper error when encoding an instruction. Instead, a handcrafted instruction will be returned. Also, provide the encoding for the faulting instruction. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Add Stefano's acked-by --- xen/include/asm-arm/arm64/brk.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/include/asm-arm/arm64/brk.h b/xen/include/asm-arm/arm64/brk.h index 7867b07..04442c4 100644 --- a/xen/include/asm-arm/arm64/brk.h +++ b/xen/include/asm-arm/arm64/brk.h @@ -12,8 +12,21 @@ /* * #imm16 values used for BRK instruction generation * 0x001: xen-mode BUG() and WARN() traps + * 0x002: for triggering a fault on purpose (reserved) */ #define BRK_BUG_FRAME_IMM 1 +#define BRK_FAULT_IMM 2 + +/* + * BRK instruction encoding + * The #imm16 value should be placed at bits[20:5] within BRK ins + */ +#define AARCH64_BREAK_MON 0xd4200000 + +/* + * BRK instruction for provoking a fault on purpose + */ +#define AARCH64_BREAK_FAULT (AARCH64_BREAK_MON | (BRK_FAULT_IMM << 5)) #endif /* !__ASM_ARM_ARM64_BRK */ /*