7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/asm_linkage.h>
28 #ifndef __xpv
29 #include <sys/xpv_support.h>
30 #endif
31 #include <sys/hypervisor.h>
32
33 /*
34 * Hypervisor "system calls"
35 *
36 * i386
37 * %eax == call number
38 * args in registers (%ebx, %ecx, %edx, %esi, %edi)
39 *
40 * amd64
41 * %rax == call number
42 * args in registers (%rdi, %rsi, %rdx, %r10, %r8, %r9)
43 *
44 * Note that for amd64 we use %r10 instead of %rcx for passing 4th argument
45 * as in C calling convention since the "syscall" instruction clobbers %rcx.
46 *
147
148 .data
149 .align HYPERCALL_SHINFO_PAGESIZE
150 .globl hypercall_shared_info_page
151 .type hypercall_shared_info_page, @object
152 .size hypercall_shared_info_page, HYPERCALL_SHINFO_PAGESIZE
153 hypercall_shared_info_page:
154 .skip HYPERCALL_SHINFO_PAGESIZE
155
156 .text
157 .align HYPERCALL_PAGESIZE
158 .globl hypercall_page
159 .type hypercall_page, @function
160 hypercall_page:
161 .skip HYPERCALL_PAGESIZE
162 .size hypercall_page, HYPERCALL_PAGESIZE
163 #if defined(__amd64)
164 #define TRAP_INSTR \
165 shll $5, %eax; \
166 addq $hypercall_page, %rax; \
167 jmp *%rax
168 #else
169 #define TRAP_INSTR \
170 shll $5, %eax; \
171 addl $hypercall_page, %eax; \
172 call *%eax
173 #endif
174
175 #else /* !_xpv */
176
177 #if defined(__amd64)
178 #define TRAP_INSTR syscall
179 #elif defined(__i386)
180 #define TRAP_INSTR int $0x82
181 #endif
182 #endif /* !__xpv */
183
184
185 #if defined(__amd64)
186
187 ENTRY_NP(__hypercall0)
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2019 Joyent, Inc.
29 */
30
31 #include <sys/asm_linkage.h>
32 #ifndef __xpv
33 #include <sys/xpv_support.h>
34 #endif
35 #include <sys/hypervisor.h>
36
37 /*
38 * Hypervisor "system calls"
39 *
40 * i386
41 * %eax == call number
42 * args in registers (%ebx, %ecx, %edx, %esi, %edi)
43 *
44 * amd64
45 * %rax == call number
46 * args in registers (%rdi, %rsi, %rdx, %r10, %r8, %r9)
47 *
48 * Note that for amd64 we use %r10 instead of %rcx for passing 4th argument
49 * as in C calling convention since the "syscall" instruction clobbers %rcx.
50 *
151
152 .data
153 .align HYPERCALL_SHINFO_PAGESIZE
154 .globl hypercall_shared_info_page
155 .type hypercall_shared_info_page, @object
156 .size hypercall_shared_info_page, HYPERCALL_SHINFO_PAGESIZE
157 hypercall_shared_info_page:
158 .skip HYPERCALL_SHINFO_PAGESIZE
159
160 .text
161 .align HYPERCALL_PAGESIZE
162 .globl hypercall_page
163 .type hypercall_page, @function
164 hypercall_page:
165 .skip HYPERCALL_PAGESIZE
166 .size hypercall_page, HYPERCALL_PAGESIZE
167 #if defined(__amd64)
168 #define TRAP_INSTR \
169 shll $5, %eax; \
170 addq $hypercall_page, %rax; \
171 INDIRECT_JMP_REG(rax);
172 #else
173 #define TRAP_INSTR \
174 shll $5, %eax; \
175 addl $hypercall_page, %eax; \
176 call *%eax
177 #endif
178
179 #else /* !_xpv */
180
181 #if defined(__amd64)
182 #define TRAP_INSTR syscall
183 #elif defined(__i386)
184 #define TRAP_INSTR int $0x82
185 #endif
186 #endif /* !__xpv */
187
188
189 #if defined(__amd64)
190
191 ENTRY_NP(__hypercall0)
|