From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbdBWO7K (ORCPT ); Thu, 23 Feb 2017 09:59:10 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46748 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbdBWO7J (ORCPT ); Thu, 23 Feb 2017 09:59:09 -0500 Date: Thu, 23 Feb 2017 15:59:06 +0100 From: Peter Zijlstra To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, arjan@linux.intel.com, bp@alien8.de, jpoimboe@redhat.com, richard.weinberger@gmail.com Subject: Re: [PATCH] x86: Implement __WARN using UD0 Message-ID: <20170223145906.GV6536@twins.programming.kicks-ass.net> References: <20170223132813.GB6515@twins.programming.kicks-ass.net> <20170223140929.GU6536@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170223140929.GU6536@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 23, 2017 at 03:09:29PM +0100, Peter Zijlstra wrote: > On Thu, Feb 23, 2017 at 02:28:13PM +0100, Peter Zijlstra wrote: > > + * Since various instruction decoders disagree on the length of UD1, > > + * we cannot use it either. So use UD0 for WARN. > > + * > > + * (binutils knows about "ud1" but {en,de}codes it as 2 bytes, whereas > > + * our kernel decoder thinks it takes a ModRM byte, which seems consistent > > + * with various things like the Intel SDM instruction encoding rules) > > + */ > > + > > +#define ASM_UD0 ".byte 0x0f, 0xff" > > +#define ASM_UD1 ".byte 0x0f, 0xb9" /* + ModRM */ > > +#define ASM_UD2 ".byte 0x0f, 0x0b" > > http://repo.or.cz/nasm.git/blob/HEAD:/x86/insns.dat > > has: > > 1378 UD0 void [ 0f ff] 186,UNDOC > 1379 UD1 void [ 0f b9] 186,UNDOC > 1380 UD2B void [ 0f b9] 186,UNDOC,ND > 1381 UD2 void [ 0f 0b] 186 > 1382 UD2A void [ 0f 0b] 186,ND > > which seems to use the 2 byte version of UD1. > > hpa, any input? N/m, as Josh said, they're listed in the latest SDM (Dec 2016) and that lists UD1 /r, so 3 bytes. This means binutils decodes it wrong.