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