From owner-svn-src-stable@freebsd.org Sun Apr 15 20:20:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2213F89565; Sun, 15 Apr 2018 20:20:08 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A422486A46; Sun, 15 Apr 2018 20:20:08 +0000 (UTC) (envelope-from grehan@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 9EF5813970; Sun, 15 Apr 2018 20:20:08 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3FKK8Su090603; Sun, 15 Apr 2018 20:20:08 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3FKK8ea090602; Sun, 15 Apr 2018 20:20:08 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201804152020.w3FKK8ea090602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Sun, 15 Apr 2018 20:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332516 - stable/11/sys/amd64/vmm X-SVN-Group: stable-11 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: stable/11/sys/amd64/vmm X-SVN-Commit-Revision: 332516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Apr 2018 20:20:09 -0000 Author: grehan Date: Sun Apr 15 20:20:08 2018 New Revision: 332516 URL: https://svnweb.freebsd.org/changeset/base/332516 Log: MFC r325261 Emulate the "OR reg, r/m" instruction (opcode 0BH). This is needed for the HDA emulation with FreeBSD guests. Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_instruction_emul.c Sun Apr 15 19:23:37 2018 (r332515) +++ stable/11/sys/amd64/vmm/vmm_instruction_emul.c Sun Apr 15 20:20:08 2018 (r332516) @@ -109,6 +109,10 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x0F, .op_type = VIE_OP_TYPE_TWO_BYTE }, + [0x0B] = { + .op_byte = 0x0B, + .op_type = VIE_OP_TYPE_OR, + }, [0x2B] = { .op_byte = 0x2B, .op_type = VIE_OP_TYPE_SUB, @@ -992,12 +996,38 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct mem_region_read_t memread, mem_region_write_t memwrite, void *arg) { int error, size; - uint64_t val1, result, rflags, rflags2; + enum vm_reg_name reg; + uint64_t result, rflags, rflags2, val1, val2; size = vie->opsize; error = EINVAL; switch (vie->op.op_byte) { + case 0x0B: + /* + * OR reg (ModRM:reg) and mem (ModRM:r/m) and store the + * result in reg. + * + * 0b/r or r16, r/m16 + * 0b/r or r32, r/m32 + * REX.W + 0b/r or r64, r/m64 + */ + + /* get the first operand */ + reg = gpr_map[vie->reg]; + error = vie_read_register(vm, vcpuid, reg, &val1); + if (error) + break; + + /* get the second operand */ + error = memread(vm, vcpuid, gpa, &val2, size, arg); + if (error) + break; + + /* perform the operation and write the result */ + result = val1 | val2; + error = vie_update_register(vm, vcpuid, reg, result, size); + break; case 0x81: case 0x83: /*