Module Name: src
Committed By: maxv
Date: Sun Feb 17 20:25:46 UTC 2019
Modified Files:
src/lib/libnvmm: libnvmm_x86.c
Log Message:
Fix handling of SIB instructions. We were jumping to the SIB node _before_
fetching the displacement, so the node would always think there was no
displacement.
This didn't alter the final GPA we would be touching - because it is
fetched from the kernel directly and not from the computation -, but it
altered the instruction length, and on some guests (like Fedora 64bit),
the VCPU would resume execution at the wrong RIP and crash.
Now these guests work.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/lib/libnvmm/libnvmm_x86.c:1.24
--- src/lib/libnvmm/libnvmm_x86.c:1.23 Fri Feb 15 16:42:27 2019
+++ src/lib/libnvmm/libnvmm_x86.c Sun Feb 17 20:25:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: libnvmm_x86.c,v 1.23 2019/02/15 16:42:27 maxv Exp $ */
+/* $NetBSD: libnvmm_x86.c,v 1.24 2019/02/17 20:25:46 maxv Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -2233,15 +2233,15 @@ node_regmodrm(struct x86_decode_fsm *fsm
strg->u.reg = reg;
}
+ /* The displacement applies to RM. */
+ strm->disp.type = get_disp_type(instr);
+
if (has_sib(instr)) {
/* Overwrites RM */
fsm_advance(fsm, 1, node_sib);
return 0;
}
- /* The displacement applies to RM. */
- strm->disp.type = get_disp_type(instr);
-
if (is_rip_relative(fsm, instr)) {
/* Overwrites RM */
strm->type = STORE_REG;