From patchwork Thu May 5 16:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 67219 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp844694qge; Thu, 5 May 2016 09:35:51 -0700 (PDT) X-Received: by 10.140.91.103 with SMTP id y94mr14894507qgd.81.1462466149685; Thu, 05 May 2016 09:35:49 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 205si6529331qhs.73.2016.05.05.09.35.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 May 2016 09:35:49 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayMEg-0001qY-BY; Thu, 05 May 2016 16:34:46 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayMEe-0001og-NO for xen-devel@lists.xen.org; Thu, 05 May 2016 16:34:44 +0000 Received: from [193.109.254.147] by server-7.bemta-14.messagelabs.com id AB/63-03757-4267B275; Thu, 05 May 2016 16:34:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTVe5TDv cYO42BYslHxezODB6HN39mymAMYo1My8pvyKBNWPFyQ1MBYc4Kvbv28rcwDiDvYuRi0NIYCOj xJpZ05ghnNOMEnePT2TsYuTkYBPQlLjz+RMTiC0iIC1x7fNlRpAiZoFmRonpi16zgSSEBQIkD m6aBtbAIqAqMf/mSVYQm1fARWLmrb/sILaEgJzEyWOTweKcAq4SS8+vZAGxhYBqTu6YxDaBkX sBI8MqRvXi1KKy1CJdC72kosz0jJLcxMwcXUNDE73c1OLixPTUnMSkYr3k/NxNjEAPMwDBDsa Nk5wPMUpyMCmJ8m5X0g4X4kvKT6nMSCzOiC8qzUktPsQow8GhJMErVwqUEyxKTU+tSMvMAYYa TFqCg0dJhFcCJM1bXJCYW5yZDpE6xagoJc6rAJIQAElklObBtcHC+xKjrJQwLyPQIUI8BalFu ZklqPKvGMU5GJWEeVNApvBk5pXATX8FtJgJaPH7uZogi0sSEVJSDYxJ6+atdPGXvpdXxiJ3S+ u/4ddfbv1tP2uYoh/FSrNvyhIMdzcRl51+SdImWsdscuqZ8Og5E6uzLeu2xcw4pbK1WvDMe8V rSpkai+wUdPLs/5zL8d6st8+v8VRKo9CirZracuf3X1hZ4TxtSsHb6GrP3NTZCo/tyxU9NcOO 1idWTdTRc3g8V4mlOCPRUIu5qDgRAFv9jgJqAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1462466082!37829386!1 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 29944 invoked from network); 5 May 2016 16:34:43 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-27.messagelabs.com with SMTP; 5 May 2016 16:34:43 -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 EF80A3A; Thu, 5 May 2016 09:34:49 -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 8A4673F252; Thu, 5 May 2016 09:34:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 5 May 2016 17:34:17 +0100 Message-Id: <1462466065-30212-9-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462466065-30212-1-git-send-email-julien.grall@arm.com> References: <1462466065-30212-1-git-send-email-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, wei.chen@arm.com, steve.capper@arm.com Subject: [Xen-devel] [RFC 08/16] 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" 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 --- 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 */ /*