1843e1988Sjohnlev/* 2843e1988Sjohnlev * CDDL HEADER START 3843e1988Sjohnlev * 4843e1988Sjohnlev * The contents of this file are subject to the terms of the 5843e1988Sjohnlev * Common Development and Distribution License (the "License"). 6843e1988Sjohnlev * You may not use this file except in compliance with the License. 7843e1988Sjohnlev * 8843e1988Sjohnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9843e1988Sjohnlev * or http://www.opensolaris.org/os/licensing. 10843e1988Sjohnlev * See the License for the specific language governing permissions 11843e1988Sjohnlev * and limitations under the License. 12843e1988Sjohnlev * 13843e1988Sjohnlev * When distributing Covered Code, include this CDDL HEADER in each 14843e1988Sjohnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15843e1988Sjohnlev * If applicable, add the following below this CDDL HEADER, with the 16843e1988Sjohnlev * fields enclosed by brackets "[]" replaced with your own identifying 17843e1988Sjohnlev * information: Portions Copyright [yyyy] [name of copyright owner] 18843e1988Sjohnlev * 19843e1988Sjohnlev * CDDL HEADER END 20843e1988Sjohnlev */ 21843e1988Sjohnlev 22843e1988Sjohnlev/* 23*94e7edb1Slucy wang - Sun Microsystems - Beijing China * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24843e1988Sjohnlev * Use is subject to license terms. 25843e1988Sjohnlev */ 26843e1988Sjohnlev 27843e1988Sjohnlev/ 28843e1988Sjohnlev/ Inline functions for the x64 kernel running on the hypervisor 29843e1988Sjohnlev/ 30843e1988Sjohnlev 31843e1988Sjohnlev .inline __hypercall0, 0 32843e1988Sjohnlev movq %rdi, %rax 33843e1988Sjohnlev syscall 34843e1988Sjohnlev .end 35843e1988Sjohnlev 36843e1988Sjohnlev .inline __hypercall1, 0 37843e1988Sjohnlev movq %rdi, %rax 38843e1988Sjohnlev movq %rsi, %rdi / arg 1 39843e1988Sjohnlev syscall 40843e1988Sjohnlev .end 41843e1988Sjohnlev 42843e1988Sjohnlev .inline __hypercall2, 0 43843e1988Sjohnlev movq %rdi, %rax 44843e1988Sjohnlev movq %rsi, %rdi / arg 1 45843e1988Sjohnlev movq %rdx, %rsi / arg 2 46843e1988Sjohnlev syscall 47843e1988Sjohnlev .end 48843e1988Sjohnlev 49843e1988Sjohnlev .inline __hypercall3, 0 50843e1988Sjohnlev movq %rdi, %rax 51843e1988Sjohnlev movq %rsi, %rdi / arg 1 52843e1988Sjohnlev movq %rdx, %rsi / arg 2 53843e1988Sjohnlev movq %rcx, %rdx / arg 3 54843e1988Sjohnlev syscall 55843e1988Sjohnlev .end 56843e1988Sjohnlev 57843e1988Sjohnlev/* XXPV studio bug r10 is changed to eax by compiler */ 58843e1988Sjohnlev .inline __hypercall4_broken, 0 59843e1988Sjohnlev movq %rdi, %rax 60843e1988Sjohnlev movq %rsi, %rdi / arg 1 61843e1988Sjohnlev movq %rdx, %rsi / arg 2 62843e1988Sjohnlev movq %rcx, %rdx / arg 3 63843e1988Sjohnlev movq %r8, %r10 / r10 = 4th arg 64843e1988Sjohnlev syscall 65843e1988Sjohnlev .end 66843e1988Sjohnlev 67843e1988Sjohnlev .inline __hypercall5_broken, 0 68843e1988Sjohnlev movq %rdi, %rax 69843e1988Sjohnlev movq %rsi, %rdi / arg 1 70843e1988Sjohnlev movq %rdx, %rsi / arg 2 71843e1988Sjohnlev movq %rcx, %rdx / arg 3 72843e1988Sjohnlev movq %r8, %r10 / r10 = 4th arg 73843e1988Sjohnlev movq %r9, %r8 / arg 5 74843e1988Sjohnlev syscall 75843e1988Sjohnlev .end 76843e1988Sjohnlev 77843e1988Sjohnlev/* 78843e1988Sjohnlev * Read the -real- TSC. 79843e1988Sjohnlev * This is difficult to virtualize on the hypervisor given there is 80843e1988Sjohnlev * no way to prevent preemption; thus this inline function 81843e1988Sjohnlev * should only be used in the middle of the paravirtualized 82843e1988Sjohnlev * implementation of tsc_read. 83843e1988Sjohnlev */ 84843e1988Sjohnlev .inline __rdtsc_insn, 0 85843e1988Sjohnlev rdtsc 86843e1988Sjohnlev shlq $32, %rdx 87843e1988Sjohnlev orq %rdx, %rax 88843e1988Sjohnlev .end 89