xenfunc.h revision 181638
1181638Skmacy/*
2181638Skmacy *
3181638Skmacy * Copyright (c) 2004,2005 Kip Macy
4181638Skmacy * All rights reserved.
5181638Skmacy *
6181638Skmacy * Redistribution and use in source and binary forms, with or without
7181638Skmacy * modification, are permitted provided that the following conditions
8181638Skmacy * are met:
9181638Skmacy * 1. Redistributions of source code must retain the above copyright
10181638Skmacy *    notice, this list of conditions and the following disclaimer.
11181638Skmacy * 2. Redistributions in binary form must reproduce the above copyright
12181638Skmacy *    notice, this list of conditions and the following disclaimer in the
13181638Skmacy *    documentation and/or other materials provided with the distribution.
14181638Skmacy * 4. The name of the author may not be used to endorse or promote products
15181638Skmacy *    derived from this software without specific prior written permission.
16181638Skmacy *
17181638Skmacy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18181638Skmacy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19181638Skmacy * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20181638Skmacy * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21181638Skmacy * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22181638Skmacy * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23181638Skmacy * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24181638Skmacy * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25181638Skmacy * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26181638Skmacy * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27181638Skmacy *
28181638Skmacy * $FreeBSD: head/sys/i386/include/xen/xenfunc.h 181638 2008-08-12 19:41:11Z kmacy $
29181638Skmacy */
30181638Skmacy
31181638Skmacy
32181638Skmacy#ifndef _XEN_XENFUNC_H_
33181638Skmacy#define _XEN_XENFUNC_H_
34181638Skmacy
35181638Skmacy#include <machine/xen/xen-os.h>
36181638Skmacy#include <machine/xen/hypervisor.h>
37181638Skmacy#include <machine/xen/xenpmap.h>
38181638Skmacy#include <machine/segments.h>
39181638Skmacy#include <sys/pcpu.h>
40181638Skmacy#define BKPT __asm__("int3");
41181638Skmacy#define XPQ_CALL_DEPTH 5
42181638Skmacy#define XPQ_CALL_COUNT 2
43181638Skmacy#define PG_PRIV PG_AVAIL3
44181638Skmacytypedef struct {
45181638Skmacy	unsigned long pt_ref;
46181638Skmacy	unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH];
47181638Skmacy} pteinfo_t;
48181638Skmacy
49181638Skmacyextern pteinfo_t *pteinfo_list;
50181638Skmacy#ifdef XENDEBUG_LOW
51181638Skmacy#define	__PRINTK(x) printk x
52181638Skmacy#else
53181638Skmacy#define	__PRINTK(x)
54181638Skmacy#endif
55181638Skmacy
56181638Skmacychar *xen_setbootenv(char *cmd_line);
57181638Skmacy
58181638Skmacyint  xen_boothowto(char *envp);
59181638Skmacy
60181638Skmacyvoid _xen_machphys_update(unsigned long, unsigned long, char *file, int line);
61181638Skmacy
62181638Skmacy#ifdef INVARIANTS
63181638Skmacy#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__)
64181638Skmacy#else
65181638Skmacy#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0)
66181638Skmacy#endif
67181638Skmacy
68181638Skmacyvoid xen_update_descriptor(union descriptor *, union descriptor *);
69181638Skmacy
70181638Skmacyvoid ap_cpu_initclocks(void);
71181638Skmacy
72181638Skmacyextern struct mtx balloon_lock;
73181638Skmacy#if 0
74181638Skmacy#define balloon_lock(__flags)   mtx_lock_irqsave(&balloon_lock, __flags)
75181638Skmacy#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags)
76181638Skmacy#else
77181638Skmacy#define balloon_lock(__flags)   __flags = 1
78181638Skmacy#define balloon_unlock(__flags) __flags = 0
79181638Skmacy#endif
80181638Skmacy
81181638Skmacy
82181638Skmacy
83181638Skmacy#endif /* _XEN_XENFUNC_H_ */
84