vaseboot/include/VasEBoot/xen.h

108 lines
3.2 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_XEN_HEADER
#define VAS_EBOOT_XEN_HEADER 1
#define __XEN_INTERFACE_VERSION__ 0x0003020a
#define memset VasEBoot_memset
#ifdef ASM_FILE
#define __ASSEMBLY__
#include <xen/xen.h>
#else
#include <VasEBoot/symbol.h>
#include <VasEBoot/types.h>
#include <VasEBoot/err.h>
#ifndef VAS_EBOOT_SYMBOL_GENERATOR
typedef VasEBoot_int8_t int8_t;
typedef VasEBoot_int16_t int16_t;
typedef VasEBoot_uint8_t uint8_t;
typedef VasEBoot_uint16_t uint16_t;
typedef VasEBoot_uint32_t uint32_t;
typedef VasEBoot_uint64_t uint64_t;
#include <xen/xen.h>
#include <xen/sched.h>
#include <xen/grant_table.h>
#include <xen/io/console.h>
#include <xen/io/xs_wire.h>
#include <xen/io/xenbus.h>
#include <xen/io/protocols.h>
#endif
#include <VasEBoot/cpu/xen/hypercall.h>
extern VasEBoot_size_t EXPORT_VAR (VasEBoot_xen_n_allocated_shared_pages);
#define VAS_EBOOT_XEN_LOG_PAGE_SIZE 12
#define VAS_EBOOT_XEN_PAGE_SIZE (1 << VAS_EBOOT_XEN_LOG_PAGE_SIZE)
extern volatile struct xencons_interface *VasEBoot_xen_xcons;
extern volatile struct shared_info *EXPORT_VAR (VasEBoot_xen_shared_info);
extern volatile struct xenstore_domain_interface *VasEBoot_xen_xenstore;
extern volatile grant_entry_v1_t *VasEBoot_xen_grant_table;
void EXPORT_FUNC (VasEBoot_xen_store_send) (const void *buf_, VasEBoot_size_t len);
void EXPORT_FUNC (VasEBoot_xen_store_recv) (void *buf_, VasEBoot_size_t len);
VasEBoot_err_t
EXPORT_FUNC (VasEBoot_xenstore_dir) (const char *dir,
int (*hook) (const char *dir,
void *hook_data),
void *hook_data);
void *EXPORT_FUNC (VasEBoot_xenstore_get_file) (const char *dir,
VasEBoot_size_t * len);
VasEBoot_err_t EXPORT_FUNC (VasEBoot_xenstore_write_file) (const char *dir,
const void *buf,
VasEBoot_size_t len);
typedef unsigned int VasEBoot_xen_grant_t;
void *EXPORT_FUNC (VasEBoot_xen_alloc_shared_page) (domid_t dom,
VasEBoot_xen_grant_t * grnum);
void EXPORT_FUNC (VasEBoot_xen_free_shared_page) (void *ptr);
#define mb() asm volatile("mfence;sfence;" : : : "memory");
extern struct start_info *EXPORT_VAR (VasEBoot_xen_start_page_addr);
void VasEBoot_console_init (void);
void VasEBoot_xendisk_fini (void);
void VasEBoot_xendisk_init (void);
void VasEBoot_parse_xen_cmdline (void);
#ifdef __x86_64__
typedef VasEBoot_uint64_t VasEBoot_xen_mfn_t;
#else
typedef VasEBoot_uint32_t VasEBoot_xen_mfn_t;
#endif
typedef unsigned int VasEBoot_xen_evtchn_t;
#ifdef VAS_EBOOT_MACHINE_XEN_PVH
extern struct hvm_start_info *pvh_start_info;
void VasEBoot_xen_setup_pvh (void);
#endif
#endif
#endif