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*26a04d67SDave Plauger * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24843e1988Sjohnlev * Use is subject to license terms. 25843e1988Sjohnlev */ 26843e1988Sjohnlev 27843e1988Sjohnlev/ 28843e1988Sjohnlev/ Inline functions for the x86 kernel running on the hypervisor 29843e1988Sjohnlev/ 30843e1988Sjohnlev 31843e1988Sjohnlev .inline __hypercall0, 4 32843e1988Sjohnlev movl (%esp), %eax 33843e1988Sjohnlev int $0x82 34843e1988Sjohnlev .end 35843e1988Sjohnlev 36843e1988Sjohnlev .inline __hypercall1, 8 37843e1988Sjohnlev pushl %ebx 38843e1988Sjohnlev movl 4(%esp), %eax 39843e1988Sjohnlev movl 8(%esp), %ebx 40843e1988Sjohnlev int $0x82 41843e1988Sjohnlev popl %ebx 42843e1988Sjohnlev .end 43843e1988Sjohnlev 44843e1988Sjohnlev .inline __hypercall2, 12 45843e1988Sjohnlev pushl %ebx 46843e1988Sjohnlev movl 4(%esp), %eax 47843e1988Sjohnlev movl 8(%esp), %ebx 48843e1988Sjohnlev movl 12(%esp), %ecx 49843e1988Sjohnlev int $0x82 50843e1988Sjohnlev popl %ebx 51843e1988Sjohnlev .end 52843e1988Sjohnlev 53843e1988Sjohnlev .inline __hypercall3, 16 54843e1988Sjohnlev pushl %ebx 55843e1988Sjohnlev movl 4(%esp), %eax 56843e1988Sjohnlev movl 8(%esp), %ebx 57843e1988Sjohnlev movl 12(%esp), %ecx 58843e1988Sjohnlev movl 16(%esp), %edx 59843e1988Sjohnlev int $0x82 60843e1988Sjohnlev popl %ebx 61843e1988Sjohnlev .end 62843e1988Sjohnlev 63843e1988Sjohnlev .inline __hypercall4, 20 64843e1988Sjohnlev pushl %ebx 65843e1988Sjohnlev pushl %esi 66843e1988Sjohnlev movl 8(%esp), %eax 67843e1988Sjohnlev movl 12(%esp), %ebx 68843e1988Sjohnlev movl 16(%esp), %ecx 69843e1988Sjohnlev movl 20(%esp), %edx 70843e1988Sjohnlev movl 24(%esp), %esi 71843e1988Sjohnlev int $0x82 72843e1988Sjohnlev popl %esi 73843e1988Sjohnlev popl %ebx 74843e1988Sjohnlev .end 75843e1988Sjohnlev 76843e1988Sjohnlev .inline __hypercall5, 24 77843e1988Sjohnlev pushl %ebx 78843e1988Sjohnlev pushl %esi 79843e1988Sjohnlev pushl %edi 80843e1988Sjohnlev movl 12(%esp), %eax 81843e1988Sjohnlev movl 16(%esp), %ebx 82843e1988Sjohnlev movl 20(%esp), %ecx 83843e1988Sjohnlev movl 24(%esp), %edx 84843e1988Sjohnlev movl 28(%esp), %esi 85843e1988Sjohnlev movl 32(%esp), %edi 86843e1988Sjohnlev int $0x82 87843e1988Sjohnlev popl %edi 88843e1988Sjohnlev popl %esi 89843e1988Sjohnlev popl %ebx 90843e1988Sjohnlev .end 91843e1988Sjohnlev 92843e1988Sjohnlev/* 93843e1988Sjohnlev * Read the -real- TSC. 94843e1988Sjohnlev * This is difficult to virtualize on the hypervisor given there is 95843e1988Sjohnlev * no way to prevent preemption; thus this inline function 96843e1988Sjohnlev * should only be used in the middle of the paravirtualized 97843e1988Sjohnlev * implementation of tsc_read. 98843e1988Sjohnlev */ 99843e1988Sjohnlev .inline __rdtsc_insn, 0 100843e1988Sjohnlev rdtsc 101843e1988Sjohnlev .end 1025c7544f7SDavid Plauger 1035c7544f7SDavid Plauger/ 1045c7544f7SDavid Plauger/ prefetch 64 bytes 105*26a04d67SDave Plauger/ prefetch is an SSE extension which is not supported on older 32-bit processors 106*26a04d67SDave Plauger/ so define this as a no-op for now 1075c7544f7SDavid Plauger/ 1085c7544f7SDavid Plauger .inline prefetch64, 4 109*26a04d67SDave Plauger/ movl (%esp), %eax 110*26a04d67SDave Plauger/ prefetcht0 (%eax) 111*26a04d67SDave Plauger/ prefetcht0 32(%eax) 1125c7544f7SDavid Plauger .end 113