svn commit: r281153 - in projects/ifnet: lib/libelftc sys/amd64/vmm sys/netinet usr.sbin/bluetooth/bthidd
Gleb Smirnoff
glebius at FreeBSD.org
Mon Apr 6 15:38:36 UTC 2015
Author: glebius
Date: Mon Apr 6 15:38:34 2015
New Revision: 281153
URL: https://svnweb.freebsd.org/changeset/base/281153
Log:
Merge head r257698 through r281152.
Modified:
projects/ifnet/lib/libelftc/elftc_version.c
projects/ifnet/sys/amd64/vmm/vmm_instruction_emul.c
projects/ifnet/sys/netinet/ip_carp.c
projects/ifnet/usr.sbin/bluetooth/bthidd/hid.c
Directory Properties:
projects/ifnet/ (props changed)
projects/ifnet/sys/ (props changed)
projects/ifnet/sys/amd64/vmm/ (props changed)
Modified: projects/ifnet/lib/libelftc/elftc_version.c
==============================================================================
--- projects/ifnet/lib/libelftc/elftc_version.c Mon Apr 6 15:31:19 2015 (r281152)
+++ projects/ifnet/lib/libelftc/elftc_version.c Mon Apr 6 15:38:34 2015 (r281153)
@@ -6,5 +6,5 @@
const char *
elftc_version(void)
{
- return "elftoolchain r3163M";
+ return "elftoolchain r3179M";
}
Modified: projects/ifnet/sys/amd64/vmm/vmm_instruction_emul.c
==============================================================================
--- projects/ifnet/sys/amd64/vmm/vmm_instruction_emul.c Mon Apr 6 15:31:19 2015 (r281152)
+++ projects/ifnet/sys/amd64/vmm/vmm_instruction_emul.c Mon Apr 6 15:38:34 2015 (r281153)
@@ -71,6 +71,7 @@ enum {
VIE_OP_TYPE_CMP,
VIE_OP_TYPE_POP,
VIE_OP_TYPE_MOVS,
+ VIE_OP_TYPE_GROUP1,
VIE_OP_TYPE_LAST
};
@@ -161,15 +162,15 @@ static const struct vie_op one_byte_opco
.op_type = VIE_OP_TYPE_AND,
},
[0x81] = {
- /* XXX Group 1 extended opcode - not just AND */
+ /* XXX Group 1 extended opcode */
.op_byte = 0x81,
- .op_type = VIE_OP_TYPE_AND,
+ .op_type = VIE_OP_TYPE_GROUP1,
.op_flags = VIE_OP_F_IMM,
},
[0x83] = {
- /* XXX Group 1 extended opcode - not just OR */
+ /* XXX Group 1 extended opcode */
.op_byte = 0x83,
- .op_type = VIE_OP_TYPE_OR,
+ .op_type = VIE_OP_TYPE_GROUP1,
.op_flags = VIE_OP_F_IMM8,
},
[0x8F] = {
@@ -839,16 +840,18 @@ emulate_and(void *vm, int vcpuid, uint64
error = vie_update_register(vm, vcpuid, reg, result, size);
break;
case 0x81:
+ case 0x83:
/*
- * AND/OR mem (ModRM:r/m) with immediate and store the
+ * AND mem (ModRM:r/m) with immediate and store the
* result in mem.
*
- * AND: i = 4
- * OR: i = 1
- * 81 /i op r/m16, imm16
- * 81 /i op r/m32, imm32
- * REX.W + 81 /i op r/m64, imm32 sign-extended to 64
+ * 81 /4 and r/m16, imm16
+ * 81 /4 and r/m32, imm32
+ * REX.W + 81 /4 and r/m64, imm32 sign-extended to 64
*
+ * 83 /4 and r/m16, imm8 sign-extended to 16
+ * 83 /4 and r/m32, imm8 sign-extended to 32
+ * REX.W + 83/4 and r/m64, imm8 sign-extended to 64
*/
/* get the first operand */
@@ -857,26 +860,11 @@ emulate_and(void *vm, int vcpuid, uint64
break;
/*
- * perform the operation with the pre-fetched immediate
- * operand and write the result
- */
- switch (vie->reg & 7) {
- case 0x4:
- /* modrm:reg == b100, AND */
- result = val1 & vie->immediate;
- break;
- case 0x1:
- /* modrm:reg == b001, OR */
- result = val1 | vie->immediate;
- break;
- default:
- error = EINVAL;
- break;
- }
- if (error)
- break;
-
- error = memwrite(vm, vcpuid, gpa, result, size, arg);
+ * perform the operation with the pre-fetched immediate
+ * operand and write the result
+ */
+ result = val1 & vie->immediate;
+ error = memwrite(vm, vcpuid, gpa, result, size, arg);
break;
default:
break;
@@ -913,20 +901,20 @@ emulate_or(void *vm, int vcpuid, uint64_
error = EINVAL;
switch (vie->op.op_byte) {
+ case 0x81:
case 0x83:
/*
* OR mem (ModRM:r/m) with immediate and store the
* result in mem.
*
- * 83 /1 OR r/m16, imm8 sign-extended to 16
- * 83 /1 OR r/m32, imm8 sign-extended to 32
- * REX.W + 83/1 OR r/m64, imm8 sign-extended to 64
+ * 81 /1 or r/m16, imm16
+ * 81 /1 or r/m32, imm32
+ * REX.W + 81 /1 or r/m64, imm32 sign-extended to 64
*
- * Currently, only the OR operation of the 0x83 opcode
- * is implemented (ModRM:reg = b001).
+ * 83 /1 or r/m16, imm8 sign-extended to 16
+ * 83 /1 or r/m32, imm8 sign-extended to 32
+ * REX.W + 83/1 or r/m64, imm8 sign-extended to 64
*/
- if ((vie->reg & 7) != 1)
- break;
/* get the first operand */
error = memread(vm, vcpuid, gpa, &val1, size, arg);
@@ -997,11 +985,37 @@ emulate_cmp(void *vm, int vcpuid, uint64
if (error)
return (error);
+ rflags2 = getcc(size, op1, op2);
+ break;
+ case 0x81:
+ case 0x83:
+ /*
+ * 81 /7 cmp r/m16, imm16
+ * 81 /7 cmp r/m32, imm32
+ * REX.W + 81 /7 cmp r/m64, imm32 sign-extended to 64
+ *
+ * 83 /7 cmp r/m16, imm8 sign-extended to 16
+ * 83 /7 cmp r/m32, imm8 sign-extended to 32
+ * REX.W + 83 /7 cmp r/m64, imm8 sign-extended to 64
+ *
+ * Compare mem (ModRM:r/m) with immediate and set
+ * status flags according to the results. The
+ * comparison is performed by subtracting the
+ * immediate from the first operand and then setting
+ * the status flags.
+ *
+ */
+
+ /* get the first operand */
+ error = memread(vm, vcpuid, gpa, &op1, size, arg);
+ if (error)
+ return (error);
+
+ rflags2 = getcc(size, op1, vie->immediate);
break;
default:
return (EINVAL);
}
- rflags2 = getcc(size, op1, op2);
error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags);
if (error)
return (error);
@@ -1220,6 +1234,34 @@ emulate_pop(void *vm, int vcpuid, uint64
return (error);
}
+static int
+emulate_group1(void *vm, int vcpuid, uint64_t gpa, struct vie *vie,
+ struct vm_guest_paging *paging, mem_region_read_t memread,
+ mem_region_write_t memwrite, void *memarg)
+{
+ int error;
+
+ switch (vie->reg & 7) {
+ case 0x1: /* OR */
+ error = emulate_or(vm, vcpuid, gpa, vie,
+ memread, memwrite, memarg);
+ break;
+ case 0x4: /* AND */
+ error = emulate_and(vm, vcpuid, gpa, vie,
+ memread, memwrite, memarg);
+ break;
+ case 0x7: /* CMP */
+ error = emulate_cmp(vm, vcpuid, gpa, vie,
+ memread, memwrite, memarg);
+ break;
+ default:
+ error = EINVAL;
+ break;
+ }
+
+ return (error);
+}
+
int
vmm_emulate_instruction(void *vm, int vcpuid, uint64_t gpa, struct vie *vie,
struct vm_guest_paging *paging, mem_region_read_t memread,
@@ -1231,6 +1273,10 @@ vmm_emulate_instruction(void *vm, int vc
return (EINVAL);
switch (vie->op.op_type) {
+ case VIE_OP_TYPE_GROUP1:
+ error = emulate_group1(vm, vcpuid, gpa, vie, paging, memread,
+ memwrite, memarg);
+ break;
case VIE_OP_TYPE_POP:
error = emulate_pop(vm, vcpuid, gpa, vie, paging, memread,
memwrite, memarg);
Modified: projects/ifnet/sys/netinet/ip_carp.c
==============================================================================
--- projects/ifnet/sys/netinet/ip_carp.c Mon Apr 6 15:31:19 2015 (r281152)
+++ projects/ifnet/sys/netinet/ip_carp.c Mon Apr 6 15:38:34 2015 (r281153)
@@ -180,9 +180,6 @@ static int proto_reg[] = {-1, -1};
*
* Known issues with locking:
*
- * - There is no protection for races between two ioctl() requests,
- * neither SIOCSVH, nor SIOCAIFADDR & SIOCAIFADDR_IN6. I think that all
- * interface ioctl()s should be serialized right in net/if.c.
* - Sending ad, we put the pointer to the softc in an mtag, and no reference
* counting is done on the softc.
* - On module unload we may race (?) with packet processing thread
@@ -321,6 +318,7 @@ static void carp_demote_adj(int, char *)
static LIST_HEAD(, carp_softc) carp_list;
static struct mtx carp_mtx;
+static struct sx carp_sx;
static struct task carp_sendall_task =
TASK_INITIALIZER(0, carp_send_ad_all, NULL);
@@ -1650,6 +1648,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd
goto out;
}
+ sx_xlock(&carp_sx);
switch (cmd) {
case SIOCSVH:
if ((error = priv_check(td, PRIV_NETINET_CARP)))
@@ -1780,6 +1779,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd
default:
error = EINVAL;
}
+ sx_xunlock(&carp_sx);
out:
if (locked)
@@ -2099,6 +2099,7 @@ carp_mod_cleanup(void)
mtx_unlock(&carp_mtx);
taskqueue_drain(taskqueue_swi, &carp_sendall_task);
mtx_destroy(&carp_mtx);
+ sx_destroy(&carp_sx);
}
static int
@@ -2107,6 +2108,7 @@ carp_mod_load(void)
int err;
mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF);
+ sx_init(&carp_sx, "carp_sx");
LIST_INIT(&carp_list);
carp_get_vhid_p = carp_get_vhid;
carp_forus_p = carp_forus;
Modified: projects/ifnet/usr.sbin/bluetooth/bthidd/hid.c
==============================================================================
--- projects/ifnet/usr.sbin/bluetooth/bthidd/hid.c Mon Apr 6 15:31:19 2015 (r281152)
+++ projects/ifnet/usr.sbin/bluetooth/bthidd/hid.c Mon Apr 6 15:38:34 2015 (r281153)
@@ -48,12 +48,6 @@
#include "bthidd.h"
#include "kbd.h"
-#undef min
-#define min(x, y) (((x) < (y))? (x) : (y))
-
-#undef ASIZE
-#define ASIZE(a) (sizeof(a)/sizeof(a[0]))
-
/*
* Process data from control channel
*/
More information about the svn-src-projects
mailing list