summaryrefslogtreecommitdiffstats
path: root/sys/amd64/vmm
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2015-03-02 20:13:49 +0000
committerneel <neel@FreeBSD.org>2015-03-02 20:13:49 +0000
commite549774cf351fd0017e15dc3bf8d672083a73919 (patch)
tree9312e31d2764a9869f4448be845ea6ab9da6c3a4 /sys/amd64/vmm
parent157b1a660bcb66425d9235b46b87e3430a337162 (diff)
downloadFreeBSD-src-e549774cf351fd0017e15dc3bf8d672083a73919.zip
FreeBSD-src-e549774cf351fd0017e15dc3bf8d672083a73919.tar.gz
Fix warnings/errors when building vmm.ko with gcc:
- fix warning about comparison of 'uint8_t v_tpr >= 0' always being true. - fix error triggered by an empty clobber list in the inline assembly for "clgi" and "stgi" - fix error when compiling "vmload %rax", "vmrun %rax" and "vmsave %rax". The gcc assembler does not like the explicit operand "%rax" while the clang assembler requires specifying the operand "%rax". Fix this by encoding the instructions using the ".byte" directive. Reported by: julian MFC after: 1 week
Diffstat (limited to 'sys/amd64/vmm')
-rw-r--r--sys/amd64/vmm/amd/svm.c6
-rw-r--r--sys/amd64/vmm/amd/svm_support.S12
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index bcd9efc..88a846d 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -1641,7 +1641,7 @@ done:
* VMRUN.
*/
v_tpr = vlapic_get_cr8(vlapic);
- KASSERT(v_tpr >= 0 && v_tpr <= 15, ("invalid v_tpr %#x", v_tpr));
+ KASSERT(v_tpr <= 15, ("invalid v_tpr %#x", v_tpr));
if (ctrl->v_tpr != v_tpr) {
VCPU_CTR2(sc->vm, vcpu, "VMCB V_TPR changed from %#x to %#x",
ctrl->v_tpr, v_tpr);
@@ -1808,14 +1808,14 @@ static __inline void
disable_gintr(void)
{
- __asm __volatile("clgi" : : :);
+ __asm __volatile("clgi");
}
static __inline void
enable_gintr(void)
{
- __asm __volatile("stgi" : : :);
+ __asm __volatile("stgi");
}
/*
diff --git a/sys/amd64/vmm/amd/svm_support.S b/sys/amd64/vmm/amd/svm_support.S
index 72327bd..b363101 100644
--- a/sys/amd64/vmm/amd/svm_support.S
+++ b/sys/amd64/vmm/amd/svm_support.S
@@ -22,6 +22,8 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#include <machine/asmacros.h>
@@ -35,6 +37,10 @@
#define VENTER push %rbp ; mov %rsp,%rbp
#define VLEAVE pop %rbp
+#define VMLOAD .byte 0x0f, 0x01, 0xda
+#define VMRUN .byte 0x0f, 0x01, 0xd8
+#define VMSAVE .byte 0x0f, 0x01, 0xdb
+
/*
* svm_launch(uint64_t vmcb, struct svm_regctx *gctx)
* %rdi: physical address of VMCB
@@ -79,9 +85,9 @@ ENTRY(svm_launch)
movq SCTX_RDI(%rsi), %rdi
movq SCTX_RSI(%rsi), %rsi /* %rsi must be restored last */
- vmload %rax
- vmrun %rax
- vmsave %rax
+ VMLOAD
+ VMRUN
+ VMSAVE
pop %rax /* pop guest context pointer from the stack */
OpenPOWER on IntegriCloud