From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.remcomp.fr (mail.remcomp.fr [144.76.29.216]) by sourceware.org (Postfix) with ESMTP id 5C63D3858D20 for ; Sat, 10 Feb 2024 12:56:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C63D3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jacob.remcomp.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jacob.remcomp.fr ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C63D3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=144.76.29.216 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707569792; cv=none; b=lbcrBbyQJE6ofTIkWtuLFaF7bGR+g77q6LflCWnycYSUMaRpDSzISW/855oOZ1pEYlZDKj/2siXcgMKygZdZiJIrL4GYyd5g++jG6LyiqiVkSxu6SSKUKszjFeTaS8TgvLyy+EVCvrJBwbe2nTANHG4Nppxav9LwiUdZNOsgFtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707569792; c=relaxed/simple; bh=DZ2M4UBUod7JKsHrZEBMOo2iJMjehsoeH3sfEoSk6CU=; h=Mime-Version:Subject:From:Date:Message-Id:To; b=g9YLOFnvJ9k1Vc4zLRuH8PEhIEaH+fH3qN/cQ/scHNLQQAVYhQI8T8m2KeUyeyPQ69lKDRml7M0Kr1YReu7xzp00ZSwwSsfyceqbA0oQkVEu31ZYL8e+lAwSNYNcGStnnEJ5c3LS1tOYxwsnb7QZrSsj9eLzkVTU6EtEoSNNxVQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtpclient.apple (lfbn-idf3-1-253-13.w90-22.abo.wanadoo.fr [90.22.252.13]) (Authenticated sender: jacob) by mail.remcomp.fr (Postfix) with ESMTPSA id C388B40062; Sat, 10 Feb 2024 12:56:27 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Subject: Re: Defined illegal instruction From: jacob navia In-Reply-To: Date: Sat, 10 Feb 2024 13:56:17 +0100 Cc: Peter Bergner , binutils@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <80629157-361A-457F-81E1-21D2D23DD99F@jacob.remcomp.fr> References: <4EF79A76-0C4A-492C-95E5-F12B338F637D@jacob.remcomp.fr> <6c936101-c79a-40b0-b627-cc6d8e741d43@linux.ibm.com> To: Andrew Waterman X-Mailer: Apple Mail (2.3774.300.61.1.2) X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: OK. So now we have: unimp and c.unimp Both generate 16 bit zeroes if the C extension is present. If the C extension is not present, unimp generates=20 csrw cycle, x0 If we want to generate the defined unimplemented instruction in 32 bis = we write .long 0 As in the power PC. I am going through each one of the instructions because I am writing a = full documentation for the gas assembler for riscv. It has now approx = 200 pages, with explanations about the riscv encoding, the software, its = history, etc. Thanks for your help. Jacob > Le 10 f=C3=A9vr. 2024 =C3=A0 01:03, Andrew Waterman = a =C3=A9crit : >=20 > If memory serves, the reason we didn't define unimp to be 0x00000000 > is that 0x0000 is a 16-bit-long instruction (because the two LSBs are > zero). When targeting RISC-V variants that lack support for 16-bit > instructions (via the C extension), the inclusion of a 16-bit-long > instruction (or, I suppose, a pair of 16-bit-long instructions) can > confuse both humans and disassemblers. unimp does map to 0x0000 when > the C extension is provided; it only maps to the > illegal-write-of-read-only-CSR when the C extension is not provided. >=20 > On Fri, Feb 9, 2024 at 9:48=E2=80=AFAM Peter Bergner = wrote: >>=20 >> On 2/9/24 11:03 AM, jacob navia wrote: >>> The riscv processor defines an illegal instruction (all zeroes). I = do not >>> find the mnemonic used by gas for this. As far as I remember, the = x86 also >>> has a defined illegal instruction. >>=20 >> I can't speak for riscv or x86, but Power also defines a 32-bit all = zero >> instruction as an illegal instruction. We do not have a mnemonic for = it >> though. When we want to emit that into the instruction stream, we = just >> emit a ".long 0" assembler directive. Maybe the other architectures = do >> the same thing? >>=20 >> Peter >>=20