From patchwork Sun May 26 01:09:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 165183 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5430099ili; Sat, 25 May 2019 18:28:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaQUM7L5JWl/MuGO4U4mpI6Exs4sR1BfFK8udNRSOgsCIP2erCHYzOIofW/hdu3KPd1qvr X-Received: by 2002:a67:ec42:: with SMTP id z2mr24396095vso.30.1558834122098; Sat, 25 May 2019 18:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558834122; cv=none; d=google.com; s=arc-20160816; b=TPEHaJtiiGEqn0HZPEIvUHld59iQbSWyXQQYoWEHwp9was6M02dce0PV6/9PIQDi8R orhZ/wff/HtzkgxrbaImbU3DFwRDb9xYxR/HDwzT6RqvY59lR832ArBa3W1S/YB3qupH JUZiRtQg0fvpI2PaR7yx5vMcFhWo9ZWPdVrPAAv1yREMA1OjzHwpn9WGg8NOwqjR6K4C Ll63UVyMc05H/5spD9LLwiCau2CjDLlU8d6LKh7Tfwp+QQbmM6POqBPlmVf9F60CX1UR ZMnJhjViEX9YFsYMdm1n0wWCu87PsEg3NmiLw+xa7q6gEK6TYVP+rqD2aGyf+OPURdZJ je6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:to:from :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date; bh=niN4BQwRj/iTWl309DyTteKW5yqNgmgqemJXUQlVM6Q=; b=o+p5X20hUjg2UMYle6/eQYT1BJdAwZG0U94cERZQnx+SoM077JByvmwIV39GSEQvgr q3mG9d4fR+ENY0S2UzMPZtWfyS1WT6tie3E1SImwwQS0DnZHT2GDNkS3rRfL4xAFloCX jbsx6ZPUVoM9g302uhPBC9Xub+3fOgaqhgPdqbM4vqXnmgc64r0BnUNmV+rmhSdP65L7 zW5zUkDW9Ry8HBBEFWNjuvQ23WqsQDGIGuUEpeDhbiVnrzQe8b0uxAjYM/gTxAbXSFzX MR27lGTBnVLhdKNTdt0C/4TFAwjvx+5SQXewNS/SHsHrse/+8v38u01N99EWuquRieOb v2mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j4si2387855vso.419.2019.05.25.18.28.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 25 May 2019 18:28:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([127.0.0.1]:49062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUhxp-0003gq-Gy for patch@linaro.org; Sat, 25 May 2019 21:28:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUhxC-0003Hg-Hv for qemu-devel@nongnu.org; Sat, 25 May 2019 21:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUhgN-0006UX-Un for qemu-devel@nongnu.org; Sat, 25 May 2019 21:10:40 -0400 Received: from mail-pf1-f173.google.com ([209.85.210.173]:44180) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hUhgN-0006U6-OK for qemu-devel@nongnu.org; Sat, 25 May 2019 21:10:39 -0400 Received: by mail-pf1-f173.google.com with SMTP id g9so7487399pfo.11 for ; Sat, 25 May 2019 18:10:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=niN4BQwRj/iTWl309DyTteKW5yqNgmgqemJXUQlVM6Q=; b=tfB02dBStjAMSB1j+6UK3wyLDCfe9xWewMIHl5uElucL5MQk5d3LyP2/em1ehjIHCz SKxkHgD9Q8956fpKmiUgg/AbngXsu0zo0+YabFg9VzCEWQSmKpAVKh9mZpJebsKzZAPG DOG8n4M+KVtp+ydPhPQZURngDCcKnb6aRM5btjLKDOkAjze8HIUgb2tD9okgJGAQQioA 8PgjtOXVL4Azgv0arRS1KxTwgoO5feFfnlqZ2uQR8xVTNiG8pExqNyXaVLnquHRqL8kG x1Ijmp+kJue/Lh/0DD8Rwe7LMxeGgwadkq5bBBGoIIp6CuRvoDdTnqeVJDF0HcU8ZBQZ gL7Q== X-Gm-Message-State: APjAAAWMT0i09lT5vonYnUhS97j21YgfialrumGMcRQpWlZK7phqpOss wNEM7ecCTe0uIY5odjU19S3BIA== X-Received: by 2002:a63:1224:: with SMTP id h36mr24384550pgl.9.1558833038226; Sat, 25 May 2019 18:10:38 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id a11sm6828548pff.128.2019.05.25.18.10.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 May 2019 18:10:37 -0700 (PDT) Date: Sat, 25 May 2019 18:09:46 -0700 Message-Id: <20190526010948.3923-28-palmer@sifive.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190526010948.3923-1-palmer@sifive.com> References: <20190526010948.3923-1-palmer@sifive.com> MIME-Version: 1.0 From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PULL 27/29] target/riscv: Add checks for several RVC reserved operands X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Palmer Dabbelt , qemu-riscv@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson C.ADDI16SP, C.LWSP, C.JR, C.ADDIW, C.LDSP all have reserved operands that were not diagnosed. Signed-off-by: Richard Henderson Reviewed-by: Palmer Dabbelt Signed-off-by: Palmer Dabbelt --- target/riscv/insn16-64.decode | 10 ++++++++-- target/riscv/insn16.decode | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/target/riscv/insn16-64.decode b/target/riscv/insn16-64.decode index 055859d29f61..672e1e916f6b 100644 --- a/target/riscv/insn16-64.decode +++ b/target/riscv/insn16-64.decode @@ -21,10 +21,16 @@ ld 011 ... ... .. ... 00 @cl_d sd 111 ... ... .. ... 00 @cs_d # *** RV64C Standard Extension (Quadrant 1) *** -addiw 001 . ..... ..... 01 @ci +{ + illegal 001 - 00000 ----- 01 # c.addiw, RES rd=0 + addiw 001 . ..... ..... 01 @ci +} subw 100 1 11 ... 00 ... 01 @cs_2 addw 100 1 11 ... 01 ... 01 @cs_2 # *** RV64C Standard Extension (Quadrant 2) *** -ld 011 . ..... ..... 10 @c_ldsp +{ + illegal 011 - 00000 ----- 10 # c.ldsp, RES rd=0 + ld 011 . ..... ..... 10 @c_ldsp +} sd 111 . ..... ..... 10 @c_sdsp diff --git a/target/riscv/insn16.decode b/target/riscv/insn16.decode index 433c0e8c6861..1cb93876fe0f 100644 --- a/target/riscv/insn16.decode +++ b/target/riscv/insn16.decode @@ -96,6 +96,7 @@ sw 110 ... ... .. ... 00 @cs_w addi 000 . ..... ..... 01 @ci addi 010 . ..... ..... 01 @c_li { + illegal 011 0 ----- 00000 01 # c.addi16sp and c.lui, RES nzimm=0 addi 011 . 00010 ..... 01 @c_addi16sp lui 011 . ..... ..... 01 @c_lui } @@ -113,8 +114,12 @@ bne 111 ... ... ..... 01 @cb_z # *** RV32/64C Standard Extension (Quadrant 2) *** slli 000 . ..... ..... 10 @c_shift2 fld 001 . ..... ..... 10 @c_ldsp -lw 010 . ..... ..... 10 @c_lwsp { + illegal 010 - 00000 ----- 10 # c.lwsp, RES rd=0 + lw 010 . ..... ..... 10 @c_lwsp +} +{ + illegal 100 0 00000 00000 10 # c.jr, RES rs1=0 jalr 100 0 ..... 00000 10 @c_jalr rd=0 # C.JR addi 100 0 ..... ..... 10 @c_mv }