xenfunc.h revision 185181
1/* 2 * 3 * Copyright (c) 2004,2005 Kip Macy 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 4. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 30#ifndef _XEN_XENFUNC_H_ 31#define _XEN_XENFUNC_H_ 32 33#include <machine/xen/xen-os.h> 34#include <machine/xen/hypervisor.h> 35#include <machine/xen/xenpmap.h> 36#include <machine/segments.h> 37#include <sys/pcpu.h> 38#define BKPT __asm__("int3"); 39#define XPQ_CALL_DEPTH 5 40#define XPQ_CALL_COUNT 2 41#define PG_PRIV PG_AVAIL3 42typedef struct { 43 unsigned long pt_ref; 44 unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH]; 45} pteinfo_t; 46 47extern pteinfo_t *pteinfo_list; 48#ifdef XENDEBUG_LOW 49#define __PRINTK(x) printk x 50#else 51#define __PRINTK(x) 52#endif 53 54char *xen_setbootenv(char *cmd_line); 55 56int xen_boothowto(char *envp); 57 58void _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line); 59 60#ifdef INVARIANTS 61#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__) 62#else 63#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0) 64#endif 65 66void xen_update_descriptor(union descriptor *, union descriptor *); 67 68extern struct mtx balloon_lock; 69#if 0 70#define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags) 71#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags) 72#else 73#define balloon_lock(__flags) __flags = 1 74#define balloon_unlock(__flags) __flags = 0 75#endif 76 77 78 79#endif /* _XEN_XENFUNC_H_ */ 80