amd64.il revision 843e19887f64dde75055cf8842fc4db2171eff45
843e19887f64dde75055cf8842fc4db2171eff45johnlev/*
843e19887f64dde75055cf8842fc4db2171eff45johnlev * CDDL HEADER START
843e19887f64dde75055cf8842fc4db2171eff45johnlev *
843e19887f64dde75055cf8842fc4db2171eff45johnlev * The contents of this file are subject to the terms of the
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Common Development and Distribution License (the "License").
843e19887f64dde75055cf8842fc4db2171eff45johnlev * You may not use this file except in compliance with the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev *
843e19887f64dde75055cf8842fc4db2171eff45johnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
843e19887f64dde75055cf8842fc4db2171eff45johnlev * or http://www.opensolaris.org/os/licensing.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * See the License for the specific language governing permissions
843e19887f64dde75055cf8842fc4db2171eff45johnlev * and limitations under the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev *
843e19887f64dde75055cf8842fc4db2171eff45johnlev * When distributing Covered Code, include this CDDL HEADER in each
843e19887f64dde75055cf8842fc4db2171eff45johnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * If applicable, add the following below this CDDL HEADER, with the
843e19887f64dde75055cf8842fc4db2171eff45johnlev * fields enclosed by brackets "[]" replaced with your own identifying
843e19887f64dde75055cf8842fc4db2171eff45johnlev * information: Portions Copyright [yyyy] [name of copyright owner]
843e19887f64dde75055cf8842fc4db2171eff45johnlev *
843e19887f64dde75055cf8842fc4db2171eff45johnlev * CDDL HEADER END
843e19887f64dde75055cf8842fc4db2171eff45johnlev */
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev/*
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Use is subject to license terms.
843e19887f64dde75055cf8842fc4db2171eff45johnlev */
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#pragma ident "%Z%%M% %I% %E% SMI"
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev/
843e19887f64dde75055cf8842fc4db2171eff45johnlev/ Inline functions for the x64 kernel running on the hypervisor
843e19887f64dde75055cf8842fc4db2171eff45johnlev/
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall0, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall1, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rsi, %rdi / arg 1
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall2, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rsi, %rdi / arg 1
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdx, %rsi / arg 2
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall3, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rsi, %rdi / arg 1
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdx, %rsi / arg 2
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rcx, %rdx / arg 3
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev/* XXPV studio bug r10 is changed to eax by compiler */
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall4_broken, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rsi, %rdi / arg 1
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdx, %rsi / arg 2
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rcx, %rdx / arg 3
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %r8, %r10 / r10 = 4th arg
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __hypercall5_broken, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdi, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rsi, %rdi / arg 1
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rdx, %rsi / arg 2
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %rcx, %rdx / arg 3
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %r8, %r10 / r10 = 4th arg
843e19887f64dde75055cf8842fc4db2171eff45johnlev movq %r9, %r8 / arg 5
843e19887f64dde75055cf8842fc4db2171eff45johnlev syscall
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev/*
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Read the -real- TSC.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * This is difficult to virtualize on the hypervisor given there is
843e19887f64dde75055cf8842fc4db2171eff45johnlev * no way to prevent preemption; thus this inline function
843e19887f64dde75055cf8842fc4db2171eff45johnlev * should only be used in the middle of the paravirtualized
843e19887f64dde75055cf8842fc4db2171eff45johnlev * implementation of tsc_read.
843e19887f64dde75055cf8842fc4db2171eff45johnlev */
843e19887f64dde75055cf8842fc4db2171eff45johnlev .inline __rdtsc_insn, 0
843e19887f64dde75055cf8842fc4db2171eff45johnlev rdtsc
843e19887f64dde75055cf8842fc4db2171eff45johnlev shlq $32, %rdx
843e19887f64dde75055cf8842fc4db2171eff45johnlev orq %rdx, %rax
843e19887f64dde75055cf8842fc4db2171eff45johnlev .end