xenfunc.h revision 185637
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#ifdef XENHVM
34#include <machine/xen/xenvar.h>
35#else
36#include <machine/xen/xenpmap.h>
37#include <machine/segments.h>
38#endif
39
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
68#ifndef XENHVM
69void xen_update_descriptor(union descriptor *, union descriptor *);
70#endif
71
72extern struct mtx balloon_lock;
73#if 0
74#define balloon_lock(__flags)   mtx_lock_irqsave(&balloon_lock, __flags)
75#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags)
76#else
77#define balloon_lock(__flags)   __flags = 1
78#define balloon_unlock(__flags) __flags = 0
79#endif
80
81
82
83#endif /* _XEN_XENFUNC_H_ */
84