xref: /titanic_51/usr/src/uts/i86xpv/ml/amd64.il (revision 46b2e54fef23f79962caefa489542a11b53acd45)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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/ Inline functions for the x64 kernel running on the hypervisor
29/
30
31	.inline	__hypercall0, 0
32	movq	%rdi, %rax
33	syscall
34	.end
35
36	.inline	__hypercall1, 0
37	movq	%rdi, %rax
38	movq	%rsi, %rdi		/ arg 1
39	syscall
40	.end
41
42	.inline	__hypercall2, 0
43	movq	%rdi, %rax
44	movq	%rsi, %rdi		/ arg 1
45	movq	%rdx, %rsi		/ arg 2
46	syscall
47	.end
48
49	.inline	__hypercall3, 0
50	movq	%rdi, %rax
51	movq	%rsi, %rdi		/ arg 1
52	movq	%rdx, %rsi		/ arg 2
53	movq	%rcx, %rdx		/ arg 3
54	syscall
55	.end
56
57/*  XXPV studio bug  r10 is changed to eax by compiler */
58	.inline	__hypercall4_broken, 0
59	movq	%rdi, %rax
60	movq	%rsi, %rdi		/ arg 1
61	movq	%rdx, %rsi		/ arg 2
62	movq	%rcx, %rdx		/ arg 3
63	movq	%r8, %r10		/ r10 = 4th arg
64	syscall
65	.end
66
67	.inline	__hypercall5_broken, 0
68	movq	%rdi, %rax
69	movq	%rsi, %rdi		/ arg 1
70	movq	%rdx, %rsi		/ arg 2
71	movq	%rcx, %rdx		/ arg 3
72	movq	%r8, %r10		/ r10 = 4th arg
73	movq	%r9, %r8		/ arg 5
74	syscall
75	.end
76
77/*
78 * Read the -real- TSC.
79 * This is difficult to virtualize on the hypervisor given there is
80 * no way to prevent preemption; thus this inline function
81 * should only be used in the middle of the paravirtualized
82 * implementation of tsc_read.
83 */
84	.inline	__rdtsc_insn, 0
85	rdtsc
86	shlq	$32, %rdx
87	orq	%rdx, %rax
88	.end
89