Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1521335yba; Thu, 25 Apr 2019 00:54:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzcgLPqgk8/HAgNJFFk6nl8HvuwgqrfUBv+7rfQ6cvwZcf7Q500m4ILyxFYwYs29+VOB/d X-Received: by 2002:a62:e304:: with SMTP id g4mr14926790pfh.71.1556178862798; Thu, 25 Apr 2019 00:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556178862; cv=none; d=google.com; s=arc-20160816; b=YJccAqJxGIsdMc8sO1ToHRMg5PU1n5nMUgbaoog+xhJ/3JZ0eZimphLL4GcpJibybr X/v+PBNYmtmpvAAhWNsinLPbcjulnXQnHBrR77akP8rNcTXZ587jsvsCNfKKaP4FGR3/ ScJHGW4mQUA/L10ODfGQWdwuXDV2Bqmyxw1vieUWyl0srjfYS5Aoyd46ynmWhFuVW0UR e8wIXSy4Tn9IFXoKfdc+t7Wi1O4eCai/lLxkZDsbGXBkKQXIYTctWYd+EvwXhA8R2mnn d8U+/HeBm/8TM3+y3l9+KLapn8qzDFg0InVVVFIaBnpWoFMmDMNjsO718sT/B3G5XQ6A p8zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=P7fq4gO7L6FguPlxIBI0qYrKjGlygBjMH+9TRS5eVRw=; b=dS6HSHOvigBS1bPdazylNE/78O9MoHbgHZshJFVbvjmBVeetu1bfxxmdBAbz7oH4yX kRmctJzANazEyniEl+AOTR+WxcyECSv/RqwyLrC7tXyOCJAx6gI9ociOxm6w9dT1zQpE tVvBshT3Uob1zppDkLi5Z40Jqm2MqWS4Gqh/W7sNQCCoxY+XZ/GrE0DL9Ng/qCLLwk3r KMLAWCHuax/ESAFDQItFNfnOj6Q13fm7Cfj8FNaKkLMfAN+oDDY5eb9vsYABKbBTr8zl sTVOQV4q4n/F8sJBlzeMhP9hCeKl969XoMCW+HjuWg2H0pcuiN+AnDI3lSyO+CwOsLNF T0IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si4681081pfv.253.2019.04.25.00.54.08; Thu, 25 Apr 2019 00:54:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727334AbfDYAlf (ORCPT + 99 others); Wed, 24 Apr 2019 20:41:35 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:45294 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfDYAle (ORCPT ); Wed, 24 Apr 2019 20:41:34 -0400 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23993062AbfDYAladQ7Kx (ORCPT + 1 other); Thu, 25 Apr 2019 02:41:30 +0200 Date: Thu, 25 Apr 2019 01:41:30 +0100 (BST) From: "Maciej W. Rozycki" To: Paul Burton cc: Mathieu Desnoyers , Carlos O'Donell , Will Deacon , Boqun Feng , heiko carstens , gor , schwidefsky , "Russell King, ARM Linux" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , carlos , Florian Weimer , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Dave Watson , Paul Turner , Rich Felker , linux-kernel , linux-api Subject: Re: [PATCH 1/4] glibc: Perform rseq(2) registration at C startup and thread creation (v7) In-Reply-To: <20190424231303.zu2irxd5g3v7yqey@pburton-laptop> Message-ID: References: <20190212194253.1951-1-mathieu.desnoyers@efficios.com> <20190212194253.1951-2-mathieu.desnoyers@efficios.com> <5166fbe9-cfe0-8554-abc7-4fc844cf2765@redhat.com> <1965431879.7576.1553529272844.JavaMail.zimbra@efficios.com> <602718e0-7375-deb7-b6e6-2d17022173c5@redhat.com> <20190404214151.6ogrm34dok52az4h@pburton-laptop> <1031613720.1496.1555613900993.JavaMail.zimbra@efficios.com> <1103046939.521.1556118342613.JavaMail.zimbra@efficios.com> <20190424231303.zu2irxd5g3v7yqey@pburton-laptop> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Apr 2019, Paul Burton wrote: > > > Any idea why 0x7273 is not accepted by my assembler ? > > I don't know why the assembler wants a smaller immediate than the > instruction encoding allows... There's a comment in the binutils file > include/opcode/mips.h that reads: > > > A breakpoint instruction uses OP, CODE and SPEC (10 bits of the > > breakpoint instruction are not defined; Kane says the breakpoint code > > field in BREAK is 20 bits; yet MIPS assemblers and debuggers only use > > ten bits). An optional two-operand form of break/sdbbp allows the > > lower ten bits to be set too, and MIPS32 and later architectures allow > > 20 bits to be set with a signal operand (using CODE20). > > I suspect there's some history here that predates my involvement (or > possibly just predates me). A useful explanation is in the Linux kernel (always good to look there), in arch/mips/kernel/traps.c: /* * There is the ancient bug in the MIPS assemblers that the break * code starts left to bit 16 instead to bit 6 in the opcode. * Gas is bug-compatible, but not always, grrr... * We handle both cases with a simple heuristics. --macro */ Unfortunately the bug has been carried over to the microMIPS instruction encoding in libopcodes for no reason (i.e. likely by copying the table mechanically without analysing it) and I didn't catch it when upstreaming. We should have permitted setting all bits in the 20-bit code field in the microMIPS encoding with a single operand, but you need two, like with the regular MIPS instruction set. The note on the MIPS32 assembly ISA permitting to set all the 20 bits with a single operand is a stale comment referring to the situation before binutils commit 1586d91e32ea ("/ 0 should send SIGFPE not SIGTRAP..."), , which addressed a user ABI compatibility issue as discussed upthread here: and previously: . As this is my mistake with the stale note, I have applied a fix to binutils now, commit cd0923370be1 ("MIPS/include: opcode/mips.h: Update stale comment for CODE20 operand"), so that it is clear that it is only SDBBP that accepts a single 20-bit operand for the code field (for the MIPS32 and later ISAs). FWIW, Maciej