Module Name:    src
Committed By:   maxv
Date:           Sat Jan 26 14:44:54 UTC 2019

Modified Files:
        src/lib/libnvmm: libnvmm_x86.c

Log Message:
Ah, fix bug: when the opcode has an immediate, we fill the src with a
register storage, but then we overwrite it without zeroing out the highest
bits of the resulting immediate (which may contain garbage from the union).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libnvmm/libnvmm_x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.15 src/lib/libnvmm/libnvmm_x86.c:1.16
--- src/lib/libnvmm/libnvmm_x86.c:1.15	Sun Jan 13 10:43:22 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Sat Jan 26 14:44:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.15 2019/01/13 10:43:22 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.16 2019/01/26 14:44:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -2071,12 +2071,14 @@ node_regmodrm(struct x86_decode_fsm *fsm
 		instr->emul = group11[instr->regmodrm.reg].emul;
 	}
 
-	reg = get_register_reg(instr, opcode);
-	if (reg == NULL) {
-		return -1;
+	if (!opcode->immediate) {
+		reg = get_register_reg(instr, opcode);
+		if (reg == NULL) {
+			return -1;
+		}
+		strg->type = STORE_REG;
+		strg->u.reg = reg;
 	}
-	strg->type = STORE_REG;
-	strg->u.reg = reg;
 
 	if (has_sib(instr)) {
 		/* Overwrites RM */

Reply via email to