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 x86 kernel running on the hypervisor 31/ 32 33 .inline __hypercall0, 4 34 movl (%esp), %eax 35 int $0x82 36 .end 37 38 .inline __hypercall1, 8 39 pushl %ebx 40 movl 4(%esp), %eax 41 movl 8(%esp), %ebx 42 int $0x82 43 popl %ebx 44 .end 45 46 .inline __hypercall2, 12 47 pushl %ebx 48 movl 4(%esp), %eax 49 movl 8(%esp), %ebx 50 movl 12(%esp), %ecx 51 int $0x82 52 popl %ebx 53 .end 54 55 .inline __hypercall3, 16 56 pushl %ebx 57 movl 4(%esp), %eax 58 movl 8(%esp), %ebx 59 movl 12(%esp), %ecx 60 movl 16(%esp), %edx 61 int $0x82 62 popl %ebx 63 .end 64 65 .inline __hypercall4, 20 66 pushl %ebx 67 pushl %esi 68 movl 8(%esp), %eax 69 movl 12(%esp), %ebx 70 movl 16(%esp), %ecx 71 movl 20(%esp), %edx 72 movl 24(%esp), %esi 73 int $0x82 74 popl %esi 75 popl %ebx 76 .end 77 78 .inline __hypercall5, 24 79 pushl %ebx 80 pushl %esi 81 pushl %edi 82 movl 12(%esp), %eax 83 movl 16(%esp), %ebx 84 movl 20(%esp), %ecx 85 movl 24(%esp), %edx 86 movl 28(%esp), %esi 87 movl 32(%esp), %edi 88 int $0x82 89 popl %edi 90 popl %esi 91 popl %ebx 92 .end 93 94/* 95 * Read the -real- TSC. 96 * This is difficult to virtualize on the hypervisor given there is 97 * no way to prevent preemption; thus this inline function 98 * should only be used in the middle of the paravirtualized 99 * implementation of tsc_read. 100 */ 101 .inline __rdtsc_insn, 0 102 rdtsc 103 .end 104