xenfunc.h revision 186557
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 * $FreeBSD: head/sys/i386/include/xen/xenfunc.h 186557 2008-12-29 06:31:03Z kmacy $
29 */
30
31
32#ifndef _XEN_XENFUNC_H_
33#define _XEN_XENFUNC_H_
34
35#include <machine/xen/xen-os.h>
36#include <xen/hypervisor.h>
37#include <machine/xen/xenpmap.h>
38#include <machine/segments.h>
39#include <sys/pcpu.h>
40#define BKPT __asm__("int3");
41#define XPQ_CALL_DEPTH 5
42#define XPQ_CALL_COUNT 2
43#define PG_PRIV PG_AVAIL3
44typedef struct {
45	unsigned long pt_ref;
46	unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH];
47} pteinfo_t;
48
49extern pteinfo_t *pteinfo_list;
50#ifdef XENDEBUG_LOW
51#define	__PRINTK(x) printk x
52#else
53#define	__PRINTK(x)
54#endif
55
56char *xen_setbootenv(char *cmd_line);
57
58int  xen_boothowto(char *envp);
59
60void _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line);
61
62#ifdef INVARIANTS
63#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__)
64#else
65#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0)
66#endif
67
68void xen_update_descriptor(union descriptor *, union descriptor *);
69
70extern struct mtx balloon_lock;
71#if 0
72#define balloon_lock(__flags)   mtx_lock_irqsave(&balloon_lock, __flags)
73#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags)
74#else
75#define balloon_lock(__flags)   __flags = 1
76#define balloon_unlock(__flags) __flags = 0
77#endif
78
79
80
81#endif /* _XEN_XENFUNC_H_ */
82