hypercall.c revision e4b86885570d77af552e9cf94f142f4d744fb8c8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Provides basic C wrappers around hypervisor invocation.
*
* i386: eax = vector: ebx, ecx, edx, esi, edi = args 1-5
* eax = return value
* (argument registers may be clobbered on return)
*
* amd64:rax = vector: rdi, rsi, rdx, r10, r8, r9 = args 1-6
* rax = return value
* (arguments registers not clobbered on return; rcx, r11 are)
*/
#ifdef XPV_HVM_DRIVER
#include <sys/xpv_support.h>
#endif
#include <sys/hypervisor.h>
#include <sys/archsystm.h>
long
{
}
int
{
return (__hypercall4_int(__HYPERVISOR_mmu_update,
}
long
{
return (__hypercall2(
}
/*
* XXPV Seems like "sp" would be a better name for both amd64 and i386?
* For now stay consistent with xen project source.
*/
long
{
}
#if defined(__amd64)
long
{
return (__hypercall3(__HYPERVISOR_set_callbacks,
}
long
{
return (__hypercall4(__HYPERVISOR_set_callbacks,
}
#endif /* __amd64 */
long
{
}
/* *** __HYPERVISOR_sched_op_compat *** OBSOLETED */
long
{
}
/* *** __HYPERVISOR_set_debugreg *** NOT IMPLEMENTED */
/* *** __HYPERVISOR_get_debugreg *** NOT IMPLEMENTED */
long
{
#if defined(__amd64)
#endif
}
long
{
}
long
{
return (__hypercall2(__HYPERVISOR_multicall,
}
int
{
#if !defined(_BOOT)
if (IN_XPV_PANIC())
return (0);
#endif
#if defined(__amd64)
#endif /* __i386 */
}
/*
* Note: this timeout must be the Xen system time not hrtime (see
* xpv_timestamp.c).
*/
long
{
#if defined(__amd64)
return (__hypercall2(__HYPERVISOR_set_timer_op,
#endif /* __i386 */
}
/* *** __HYPERVISOR_event_channel_op_compat *** OBSOLETED */
long
{
}
long
{
}
/* *** __HYPERVISOR_physdev_op_compat *** OBSOLETED */
long
{
int ret_val;
#if !defined(_BOOT) && !defined(XPV_HVM_DRIVER)
/*
* XXPV --
* The map_grant_ref call suffers a poor design flaw.
* It's the only hypervisor interface that creates page table mappings
* that doesn't take an entire PTE. Hence we can't create the
* mapping with a particular setting of the software PTE bits, NX, etc.
*
* Until the interface is fixed, we need to minimize the possiblity
* of dtrace or kmdb blowing up on a foreign mapping that doesn't
* have a correct setting for the soft bits. We'll force them here.
*/
extern void xen_fix_foreign(uint64_t);
uint_t i;
for (i = 0; i < count; ++i) {
}
}
#endif
return (ret_val);
}
long
{
return (__hypercall2(__HYPERVISOR_vm_assist,
}
int
{
#if defined(__amd64)
#endif /* __i386 */
}
/*
* *** __HYPERVISOR_iret ***
* see HYPERVISOR_IRET() macro in i86xpv/sys/machprivregs.h
*/
long
{
(ulong_t)extra_args));
}
#if defined(__amd64)
long
{
}
#endif /* __amd64 */
int
{
return (__hypercall4_int(__HYPERVISOR_mmuext_op,
}
long
{
}
long
{
}
long
{
return (__hypercall2(__HYPERVISOR_sched_op,
}
long
{
return (__hypercall2(__HYPERVISOR_callback_op,
}
/* *** __HYPERVISOR_xenoprof_op *** NOT IMPLEMENTED */
long
{
}
long
{
}
long
{
}
long
{
}
long
{
}
/* *** __HYPERVISOR_kexec_op *** NOT IMPLEMENTED */
/*
*
* HYPERCALL HELPER ROUTINES
* These don't have there own unique hypercalls.
*
*/
long
HYPERVISOR_yield(void)
{
}
long
HYPERVISOR_block(void)
{
}
long
{
struct sched_shutdown sched_shutdown;
}
/*
* Poll one or more event-channel ports, and return when pending.
* An optional timeout (in nanoseconds, absolute time since boot) may be
* specified. Note: this timeout must be the Xen system time not hrtime (see
* xpv_timestamp.c).
*/
long
{
struct sched_poll sched_poll;
/*LINTED: constant in conditional context*/
}
long
{
struct sched_shutdown sched_shutdown;
}
long
{
long rv;
switch (cmd) {
case XEN_MC_CMD_fetch:
case XEN_MC_CMD_physcpuinfo:
case XEN_MC_CMD_msrinject:
case XEN_MC_CMD_mceinject:
case XEN_MC_CMD_offlinecpu:
return (EINVAL);
break;
case XEN_MC_CMD_notifydomain:
return (ENOTSUP);
default:
return (EINVAL);
}
return (rv);
}