1*843e1988Sjohnlev/* 2*843e1988Sjohnlev * CDDL HEADER START 3*843e1988Sjohnlev * 4*843e1988Sjohnlev * The contents of this file are subject to the terms of the 5*843e1988Sjohnlev * Common Development and Distribution License (the "License"). 6*843e1988Sjohnlev * You may not use this file except in compliance with the License. 7*843e1988Sjohnlev * 8*843e1988Sjohnlev * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*843e1988Sjohnlev * or http://www.opensolaris.org/os/licensing. 10*843e1988Sjohnlev * See the License for the specific language governing permissions 11*843e1988Sjohnlev * and limitations under the License. 12*843e1988Sjohnlev * 13*843e1988Sjohnlev * When distributing Covered Code, include this CDDL HEADER in each 14*843e1988Sjohnlev * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*843e1988Sjohnlev * If applicable, add the following below this CDDL HEADER, with the 16*843e1988Sjohnlev * fields enclosed by brackets "[]" replaced with your own identifying 17*843e1988Sjohnlev * information: Portions Copyright [yyyy] [name of copyright owner] 18*843e1988Sjohnlev * 19*843e1988Sjohnlev * CDDL HEADER END 20*843e1988Sjohnlev */ 21*843e1988Sjohnlev 22*843e1988Sjohnlev/* 23*843e1988Sjohnlev * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*843e1988Sjohnlev * Use is subject to license terms. 25*843e1988Sjohnlev */ 26*843e1988Sjohnlev 27*843e1988Sjohnlev#pragma ident "%Z%%M% %I% %E% SMI" 28*843e1988Sjohnlev 29*843e1988Sjohnlev/ 30*843e1988Sjohnlev/ Inline functions for the x86 kernel running on the hypervisor 31*843e1988Sjohnlev/ 32*843e1988Sjohnlev 33*843e1988Sjohnlev .inline __hypercall0, 4 34*843e1988Sjohnlev movl (%esp), %eax 35*843e1988Sjohnlev int $0x82 36*843e1988Sjohnlev .end 37*843e1988Sjohnlev 38*843e1988Sjohnlev .inline __hypercall1, 8 39*843e1988Sjohnlev pushl %ebx 40*843e1988Sjohnlev movl 4(%esp), %eax 41*843e1988Sjohnlev movl 8(%esp), %ebx 42*843e1988Sjohnlev int $0x82 43*843e1988Sjohnlev popl %ebx 44*843e1988Sjohnlev .end 45*843e1988Sjohnlev 46*843e1988Sjohnlev .inline __hypercall2, 12 47*843e1988Sjohnlev pushl %ebx 48*843e1988Sjohnlev movl 4(%esp), %eax 49*843e1988Sjohnlev movl 8(%esp), %ebx 50*843e1988Sjohnlev movl 12(%esp), %ecx 51*843e1988Sjohnlev int $0x82 52*843e1988Sjohnlev popl %ebx 53*843e1988Sjohnlev .end 54*843e1988Sjohnlev 55*843e1988Sjohnlev .inline __hypercall3, 16 56*843e1988Sjohnlev pushl %ebx 57*843e1988Sjohnlev movl 4(%esp), %eax 58*843e1988Sjohnlev movl 8(%esp), %ebx 59*843e1988Sjohnlev movl 12(%esp), %ecx 60*843e1988Sjohnlev movl 16(%esp), %edx 61*843e1988Sjohnlev int $0x82 62*843e1988Sjohnlev popl %ebx 63*843e1988Sjohnlev .end 64*843e1988Sjohnlev 65*843e1988Sjohnlev .inline __hypercall4, 20 66*843e1988Sjohnlev pushl %ebx 67*843e1988Sjohnlev pushl %esi 68*843e1988Sjohnlev movl 8(%esp), %eax 69*843e1988Sjohnlev movl 12(%esp), %ebx 70*843e1988Sjohnlev movl 16(%esp), %ecx 71*843e1988Sjohnlev movl 20(%esp), %edx 72*843e1988Sjohnlev movl 24(%esp), %esi 73*843e1988Sjohnlev int $0x82 74*843e1988Sjohnlev popl %esi 75*843e1988Sjohnlev popl %ebx 76*843e1988Sjohnlev .end 77*843e1988Sjohnlev 78*843e1988Sjohnlev .inline __hypercall5, 24 79*843e1988Sjohnlev pushl %ebx 80*843e1988Sjohnlev pushl %esi 81*843e1988Sjohnlev pushl %edi 82*843e1988Sjohnlev movl 12(%esp), %eax 83*843e1988Sjohnlev movl 16(%esp), %ebx 84*843e1988Sjohnlev movl 20(%esp), %ecx 85*843e1988Sjohnlev movl 24(%esp), %edx 86*843e1988Sjohnlev movl 28(%esp), %esi 87*843e1988Sjohnlev movl 32(%esp), %edi 88*843e1988Sjohnlev int $0x82 89*843e1988Sjohnlev popl %edi 90*843e1988Sjohnlev popl %esi 91*843e1988Sjohnlev popl %ebx 92*843e1988Sjohnlev .end 93*843e1988Sjohnlev 94*843e1988Sjohnlev/* 95*843e1988Sjohnlev * Read the -real- TSC. 96*843e1988Sjohnlev * This is difficult to virtualize on the hypervisor given there is 97*843e1988Sjohnlev * no way to prevent preemption; thus this inline function 98*843e1988Sjohnlev * should only be used in the middle of the paravirtualized 99*843e1988Sjohnlev * implementation of tsc_read. 100*843e1988Sjohnlev */ 101*843e1988Sjohnlev .inline __rdtsc_insn, 0 102*843e1988Sjohnlev rdtsc 103*843e1988Sjohnlev .end 104