From owner-svn-src-all@freebsd.org Wed Oct 16 18:27:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B7CE14D12D; Wed, 16 Oct 2019 18:27:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46tgkm2hQbz475p; Wed, 16 Oct 2019 18:27:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22500B0F2; Wed, 16 Oct 2019 18:27:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9GIRR8j009547; Wed, 16 Oct 2019 18:27:27 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9GIRR9N009546; Wed, 16 Oct 2019 18:27:27 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910161827.x9GIRR9N009546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 16 Oct 2019 18:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353662 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 18:27:28 -0000 Author: cem Date: Wed Oct 16 18:27:27 2019 New Revision: 353662 URL: https://svnweb.freebsd.org/changeset/base/353662 Log: ddb: Add support for disassembling 'crc32' on amd64 Modified: head/sys/amd64/amd64/db_disasm.c Modified: head/sys/amd64/amd64/db_disasm.c ============================================================================== --- head/sys/amd64/amd64/db_disasm.c Wed Oct 16 18:12:22 2019 (r353661) +++ head/sys/amd64/amd64/db_disasm.c Wed Oct 16 18:27:27 2019 (r353662) @@ -145,6 +145,26 @@ static const struct inst db_inst_0f388x[] = { /*8f*/ { "", FALSE, NONE, 0, 0 }, }; +static const struct inst db_inst_0f38fx[] = { +/*f0*/ { "crc32b",TRUE, NONE, op2(Eb, R), 0 }, +/*f1*/ { "crc32", TRUE, LONG, op2(E, R), 0 }, +/*f2*/ { "", FALSE, NONE, 0, 0 }, +/*f3*/ { "", FALSE, NONE, 0, 0 }, +/*f4*/ { "", FALSE, NONE, 0, 0 }, +/*f5*/ { "", FALSE, NONE, 0, 0 }, +/*f6*/ { "", FALSE, NONE, 0, 0 }, +/*f7*/ { "", FALSE, NONE, 0, 0 }, + +/*f8*/ { "", FALSE, NONE, 0, 0 }, +/*f9*/ { "", FALSE, NONE, 0, 0 }, +/*fa*/ { "", FALSE, NONE, 0, 0 }, +/*fb*/ { "", FALSE, NONE, 0, 0 }, +/*fc*/ { "", FALSE, NONE, 0, 0 }, +/*fd*/ { "", FALSE, NONE, 0, 0 }, +/*fe*/ { "", FALSE, NONE, 0, 0 }, +/*ff*/ { "", FALSE, NONE, 0, 0 }, +}; + static const struct inst * const db_inst_0f38[] = { 0, 0, @@ -161,7 +181,7 @@ static const struct inst * const db_inst_0f38[] = { 0, 0, 0, - 0 + db_inst_0f38fx }; static const char * const db_Grp6[] = { @@ -1238,7 +1258,7 @@ db_disasm(db_addr_t loc, bool altfmt) boolean_t first; int displ; int prefix; - int rep; + int rep, repne; int imm; int imm2; long imm64; @@ -1254,6 +1274,7 @@ db_disasm(db_addr_t loc, bool altfmt) * Get prefixes */ rep = FALSE; + repne = FALSE; prefix = TRUE; do { switch (inst) { @@ -1284,8 +1305,12 @@ db_disasm(db_addr_t loc, bool altfmt) case 0xf0: db_printf("lock "); break; + /* + * XXX repne/repe are only actually valid for MOVS, CMPS, + * SCAS, LODS, STOS, INS, OUTS. + */ case 0xf2: - db_printf("repne "); + repne = TRUE; break; case 0xf3: rep = TRUE; @@ -1480,6 +1505,11 @@ db_disasm(db_addr_t loc, bool altfmt) rep = FALSE; } } + /* N.B., likely highly incomplete. */ + if (repne) { + if (ip == &db_inst_0f38fx[0] || ip == &db_inst_0f38fx[1]) + repne = FALSE; + } if (size == WORD) { if (ip->i_extra == db_Grp9 && f_mod(rex, regmodrm) != 3 && f_reg(rex, regmodrm) == 0x6) { @@ -1495,6 +1525,8 @@ db_disasm(db_addr_t loc, bool altfmt) if (rep == TRUE) db_printf("repe "); /* XXX repe VS rep */ + if (repne == TRUE) + db_printf("repne "); if (i_size == SDEP) { if (size == LONG)