xenfunc.h revision 207673
1262744Stychon/*- 2262744Stychon * Copyright (c) 2004, 2005 Kip Macy 3262744Stychon * All rights reserved. 4262744Stychon * 5262744Stychon * Redistribution and use in source and binary forms, with or without 6262744Stychon * modification, are permitted provided that the following conditions 7262744Stychon * are met: 8262744Stychon * 1. Redistributions of source code must retain the above copyright 9262744Stychon * notice, this list of conditions and the following disclaimer. 10262744Stychon * 2. Redistributions in binary form must reproduce the above copyright 11262744Stychon * notice, this list of conditions and the following disclaimer in the 12262744Stychon * documentation and/or other materials provided with the distribution. 13262744Stychon * 14262744Stychon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15262744Stychon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16262744Stychon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17262744Stychon * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18262744Stychon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19262744Stychon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20262744Stychon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21262744Stychon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22262744Stychon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23262744Stychon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24262744Stychon * SUCH DAMAGE. 25262744Stychon * 26262744Stychon * $FreeBSD: head/sys/amd64/include/xen/xenfunc.h 207673 2010-05-05 20:39:02Z joel $ 27262744Stychon */ 28262744Stychon 29262744Stychon#ifndef _XEN_XENFUNC_H_ 30262744Stychon#define _XEN_XENFUNC_H_ 31262744Stychon 32262744Stychon#ifdef XENHVM 33262744Stychon#include <machine/xen/xenvar.h> 34262744Stychon#else 35262744Stychon#include <machine/xen/xenpmap.h> 36262744Stychon#include <machine/segments.h> 37262744Stychon#endif 38262744Stychon 39262744Stychon#define BKPT __asm__("int3"); 40262744Stychon#define XPQ_CALL_DEPTH 5 41262744Stychon#define XPQ_CALL_COUNT 2 42262744Stychon#define PG_PRIV PG_AVAIL3 43262744Stychontypedef struct { 44262744Stychon unsigned long pt_ref; 45262744Stychon unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH]; 46262744Stychon} pteinfo_t; 47262744Stychon 48262744Stychonextern pteinfo_t *pteinfo_list; 49262744Stychon#ifdef XENDEBUG_LOW 50262744Stychon#define __PRINTK(x) printk x 51262744Stychon#else 52262744Stychon#define __PRINTK(x) 53262744Stychon#endif 54262744Stychon 55262744Stychonchar *xen_setbootenv(char *cmd_line); 56262744Stychon 57262744Stychonint xen_boothowto(char *envp); 58262744Stychon 59262744Stychonvoid _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line); 60262744Stychon 61262744Stychon#ifdef INVARIANTS 62262744Stychon#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__) 63262744Stychon#else 64262744Stychon#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0) 65262744Stychon#endif 66262744Stychon 67262744Stychon#ifndef XENHVM 68262744Stychonvoid xen_update_descriptor(union descriptor *, union descriptor *); 69262744Stychon#endif 70262744Stychon 71262744Stychonextern struct mtx balloon_lock; 72262744Stychon#if 0 73262744Stychon#define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags) 74262744Stychon#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags) 75262744Stychon#else 76262744Stychon#define balloon_lock(__flags) __flags = 1 77262744Stychon#define balloon_unlock(__flags) __flags = 0 78262744Stychon#endif 79262744Stychon 80262744Stychon 81262744Stychon 82262744Stychon#endif /* _XEN_XENFUNC_H_ */ 83262744Stychon