xenfunc.h revision 207673
1207673Sjoel/*- 2207673Sjoel * Copyright (c) 2004, 2005 Kip Macy 3181638Skmacy * All rights reserved. 4181638Skmacy * 5181638Skmacy * Redistribution and use in source and binary forms, with or without 6181638Skmacy * modification, are permitted provided that the following conditions 7181638Skmacy * are met: 8181638Skmacy * 1. Redistributions of source code must retain the above copyright 9181638Skmacy * notice, this list of conditions and the following disclaimer. 10181638Skmacy * 2. Redistributions in binary form must reproduce the above copyright 11181638Skmacy * notice, this list of conditions and the following disclaimer in the 12181638Skmacy * documentation and/or other materials provided with the distribution. 13181638Skmacy * 14207673Sjoel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15207673Sjoel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16207673Sjoel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17207673Sjoel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18207673Sjoel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19207673Sjoel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20207673Sjoel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21207673Sjoel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22207673Sjoel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23207673Sjoel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24207673Sjoel * SUCH DAMAGE. 25181638Skmacy * 26181638Skmacy * $FreeBSD: head/sys/i386/include/xen/xenfunc.h 207673 2010-05-05 20:39:02Z joel $ 27181638Skmacy */ 28181638Skmacy 29181638Skmacy#ifndef _XEN_XENFUNC_H_ 30181638Skmacy#define _XEN_XENFUNC_H_ 31181638Skmacy 32181638Skmacy#include <machine/xen/xen-os.h> 33186557Skmacy#include <xen/hypervisor.h> 34181638Skmacy#include <machine/xen/xenpmap.h> 35181638Skmacy#include <machine/segments.h> 36181638Skmacy#include <sys/pcpu.h> 37181638Skmacy#define BKPT __asm__("int3"); 38181638Skmacy#define XPQ_CALL_DEPTH 5 39181638Skmacy#define XPQ_CALL_COUNT 2 40181638Skmacy#define PG_PRIV PG_AVAIL3 41181638Skmacytypedef struct { 42181638Skmacy unsigned long pt_ref; 43181638Skmacy unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH]; 44181638Skmacy} pteinfo_t; 45181638Skmacy 46181638Skmacyextern pteinfo_t *pteinfo_list; 47181638Skmacy#ifdef XENDEBUG_LOW 48181638Skmacy#define __PRINTK(x) printk x 49181638Skmacy#else 50181638Skmacy#define __PRINTK(x) 51181638Skmacy#endif 52181638Skmacy 53181638Skmacychar *xen_setbootenv(char *cmd_line); 54181638Skmacy 55181638Skmacyint xen_boothowto(char *envp); 56181638Skmacy 57181810Skmacyvoid _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line); 58181638Skmacy 59181638Skmacy#ifdef INVARIANTS 60181638Skmacy#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__) 61181638Skmacy#else 62181638Skmacy#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0) 63181638Skmacy#endif 64181638Skmacy 65181638Skmacyvoid xen_update_descriptor(union descriptor *, union descriptor *); 66181638Skmacy 67181638Skmacyextern struct mtx balloon_lock; 68181638Skmacy#if 0 69181638Skmacy#define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags) 70181638Skmacy#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags) 71181638Skmacy#else 72181638Skmacy#define balloon_lock(__flags) __flags = 1 73181638Skmacy#define balloon_unlock(__flags) __flags = 0 74181638Skmacy#endif 75181638Skmacy 76181638Skmacy 77181638Skmacy 78181638Skmacy#endif /* _XEN_XENFUNC_H_ */ 79