Deleted Added
full compact
svm_support.S (284894) svm_support.S (285015)
1/*-
2 * Copyright (c) 2013, Anish Gupta (akgupt3@gmail.com)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2013, Anish Gupta (akgupt3@gmail.com)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/sys/amd64/vmm/amd/svm_support.S 284894 2015-06-27 22:48:22Z neel $
26 * $FreeBSD: stable/10/sys/amd64/vmm/amd/svm_support.S 285015 2015-07-01 19:46:57Z neel $
27 */
28#include <machine/asmacros.h>
29
30#include "svm_assym.h"
31
32/*
33 * Be friendly to DTrace FBT's prologue/epilogue pattern matching.
34 *
35 * They are also responsible for saving/restoring the host %rbp across VMRUN.
36 */
37#define VENTER push %rbp ; mov %rsp,%rbp
38#define VLEAVE pop %rbp
39
40#define VMLOAD .byte 0x0f, 0x01, 0xda
41#define VMRUN .byte 0x0f, 0x01, 0xd8
42#define VMSAVE .byte 0x0f, 0x01, 0xdb
43
44/*
27 */
28#include <machine/asmacros.h>
29
30#include "svm_assym.h"
31
32/*
33 * Be friendly to DTrace FBT's prologue/epilogue pattern matching.
34 *
35 * They are also responsible for saving/restoring the host %rbp across VMRUN.
36 */
37#define VENTER push %rbp ; mov %rsp,%rbp
38#define VLEAVE pop %rbp
39
40#define VMLOAD .byte 0x0f, 0x01, 0xda
41#define VMRUN .byte 0x0f, 0x01, 0xd8
42#define VMSAVE .byte 0x0f, 0x01, 0xdb
43
44/*
45 * svm_launch(uint64_t vmcb, struct svm_regctx *gctx)
45 * svm_launch(uint64_t vmcb, struct svm_regctx *gctx, struct pcpu *pcpu)
46 * %rdi: physical address of VMCB
47 * %rsi: pointer to guest context
46 * %rdi: physical address of VMCB
47 * %rsi: pointer to guest context
48 * %rdx: pointer to the pcpu data
48 */
49ENTRY(svm_launch)
50 VENTER
51
49 */
50ENTRY(svm_launch)
51 VENTER
52
53 /* save pointer to the pcpu data */
54 push %rdx
55
52 /*
53 * Host register state saved across a VMRUN.
54 *
55 * All "callee saved registers" except:
56 * %rsp: because it is preserved by the processor across VMRUN.
57 * %rbp: because it is saved/restored by the function prologue/epilogue.
58 */
59 push %rbx

--- 51 unchanged lines hidden (view full) ---

111
112 /* Restore host state */
113 pop %r15
114 pop %r14
115 pop %r13
116 pop %r12
117 pop %rbx
118
56 /*
57 * Host register state saved across a VMRUN.
58 *
59 * All "callee saved registers" except:
60 * %rsp: because it is preserved by the processor across VMRUN.
61 * %rbp: because it is saved/restored by the function prologue/epilogue.
62 */
63 push %rbx

--- 51 unchanged lines hidden (view full) ---

115
116 /* Restore host state */
117 pop %r15
118 pop %r14
119 pop %r13
120 pop %r12
121 pop %rbx
122
123 /* Restore %GS.base to point to the host's pcpu data */
124 pop %rdx
125 mov %edx, %eax
126 shr $32, %rdx
127 mov $MSR_GSBASE, %ecx
128 wrmsr
129
119 VLEAVE
120 ret
121END(svm_launch)
130 VLEAVE
131 ret
132END(svm_launch)