xref: /titanic_41/usr/src/uts/i86xpv/ml/amd64.il (revision fb49a0d14105507530a42288b4a7bec770c7b016)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29/
30/ Inline functions for the x64 kernel running on the hypervisor
31/
32
33	.inline	__hypercall0, 0
34	movq	%rdi, %rax
35	syscall
36	.end
37
38	.inline	__hypercall1, 0
39	movq	%rdi, %rax
40	movq	%rsi, %rdi		/ arg 1
41	syscall
42	.end
43
44	.inline	__hypercall2, 0
45	movq	%rdi, %rax
46	movq	%rsi, %rdi		/ arg 1
47	movq	%rdx, %rsi		/ arg 2
48	syscall
49	.end
50
51	.inline	__hypercall3, 0
52	movq	%rdi, %rax
53	movq	%rsi, %rdi		/ arg 1
54	movq	%rdx, %rsi		/ arg 2
55	movq	%rcx, %rdx		/ arg 3
56	syscall
57	.end
58
59/*  XXPV studio bug  r10 is changed to eax by compiler */
60	.inline	__hypercall4_broken, 0
61	movq	%rdi, %rax
62	movq	%rsi, %rdi		/ arg 1
63	movq	%rdx, %rsi		/ arg 2
64	movq	%rcx, %rdx		/ arg 3
65	movq	%r8, %r10		/ r10 = 4th arg
66	syscall
67	.end
68
69	.inline	__hypercall5_broken, 0
70	movq	%rdi, %rax
71	movq	%rsi, %rdi		/ arg 1
72	movq	%rdx, %rsi		/ arg 2
73	movq	%rcx, %rdx		/ arg 3
74	movq	%r8, %r10		/ r10 = 4th arg
75	movq	%r9, %r8		/ arg 5
76	syscall
77	.end
78
79/*
80 * Read the -real- TSC.
81 * This is difficult to virtualize on the hypervisor given there is
82 * no way to prevent preemption; thus this inline function
83 * should only be used in the middle of the paravirtualized
84 * implementation of tsc_read.
85 */
86	.inline	__rdtsc_insn, 0
87	rdtsc
88	shlq	$32, %rdx
89	orq	%rdx, %rax
90	.end
91