[34] | 1 | /****************************************************************************** |
---|
| 2 | * xenguest.h |
---|
| 3 | * |
---|
| 4 | * A library for guest domain management in Xen. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2003-2004, K A Fraser. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #ifndef XENGUEST_H |
---|
| 10 | #define XENGUEST_H |
---|
| 11 | |
---|
| 12 | #define XCFLAGS_LIVE 1 |
---|
| 13 | #define XCFLAGS_DEBUG 2 |
---|
| 14 | #define XCFLAGS_HVM 4 |
---|
| 15 | #define XCFLAGS_STDVGA 8 |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | /** |
---|
| 19 | * This function will save a running domain. |
---|
| 20 | * |
---|
| 21 | * @parm xc_handle a handle to an open hypervisor interface |
---|
| 22 | * @parm fd the file descriptor to save a domain to |
---|
| 23 | * @parm dom the id of the domain |
---|
| 24 | * @return 0 on success, -1 on failure |
---|
| 25 | */ |
---|
| 26 | int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, |
---|
| 27 | uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */, |
---|
| 28 | int (*suspend)(int domid), int hvm, |
---|
| 29 | void *(*init_qemu_maps)(int, unsigned), /* HVM only */ |
---|
| 30 | void (*qemu_flip_buffer)(int, int)); /* HVM only */ |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * This function will restore a saved domain. |
---|
| 35 | * |
---|
| 36 | * @parm xc_handle a handle to an open hypervisor interface |
---|
| 37 | * @parm fd the file descriptor to restore a domain from |
---|
| 38 | * @parm dom the id of the domain |
---|
| 39 | * @parm store_evtchn the store event channel for this domain to use |
---|
| 40 | * @parm store_mfn returned with the mfn of the store page |
---|
| 41 | * @parm hvm non-zero if this is a HVM restore |
---|
| 42 | * @parm pae non-zero if this HVM domain has PAE support enabled |
---|
| 43 | * @return 0 on success, -1 on failure |
---|
| 44 | */ |
---|
| 45 | int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom, |
---|
| 46 | unsigned int store_evtchn, unsigned long *store_mfn, |
---|
| 47 | unsigned int console_evtchn, unsigned long *console_mfn, |
---|
| 48 | unsigned int hvm, unsigned int pae); |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * This function will create a domain for a paravirtualized Linux |
---|
| 52 | * using file names pointing to kernel and ramdisk |
---|
| 53 | * |
---|
| 54 | * @parm xc_handle a handle to an open hypervisor interface |
---|
| 55 | * @parm domid the id of the domain |
---|
| 56 | * @parm mem_mb memory size in megabytes |
---|
| 57 | * @parm image_name name of the kernel image file |
---|
| 58 | * @parm ramdisk_name name of the ramdisk image file |
---|
| 59 | * @parm cmdline command line string |
---|
| 60 | * @parm flags domain creation flags |
---|
| 61 | * @parm store_evtchn the store event channel for this domain to use |
---|
| 62 | * @parm store_mfn returned with the mfn of the store page |
---|
| 63 | * @parm console_evtchn the console event channel for this domain to use |
---|
| 64 | * @parm conole_mfn returned with the mfn of the console page |
---|
| 65 | * @return 0 on success, -1 on failure |
---|
| 66 | */ |
---|
| 67 | int xc_linux_build(int xc_handle, |
---|
| 68 | uint32_t domid, |
---|
| 69 | unsigned int mem_mb, |
---|
| 70 | const char *image_name, |
---|
| 71 | const char *ramdisk_name, |
---|
| 72 | const char *cmdline, |
---|
| 73 | const char *features, |
---|
| 74 | unsigned long flags, |
---|
| 75 | unsigned int store_evtchn, |
---|
| 76 | unsigned long *store_mfn, |
---|
| 77 | unsigned int console_evtchn, |
---|
| 78 | unsigned long *console_mfn); |
---|
| 79 | |
---|
| 80 | /** The same interface, but the dom structure is managed by the caller */ |
---|
| 81 | struct xc_dom_image; |
---|
| 82 | int xc_dom_linux_build(int xc_handle, |
---|
| 83 | struct xc_dom_image *dom, |
---|
| 84 | uint32_t domid, |
---|
| 85 | unsigned int mem_mb, |
---|
| 86 | const char *image_name, |
---|
| 87 | const char *ramdisk_name, |
---|
| 88 | unsigned long flags, |
---|
| 89 | unsigned int store_evtchn, |
---|
| 90 | unsigned long *store_mfn, |
---|
| 91 | unsigned int console_evtchn, |
---|
| 92 | unsigned long *console_mfn); |
---|
| 93 | |
---|
| 94 | /** |
---|
| 95 | * This function will create a domain for a paravirtualized Linux |
---|
| 96 | * using buffers for kernel and initrd |
---|
| 97 | * |
---|
| 98 | * @parm xc_handle a handle to an open hypervisor interface |
---|
| 99 | * @parm domid the id of the domain |
---|
| 100 | * @parm mem_mb memory size in megabytes |
---|
| 101 | * @parm image_buffer buffer containing kernel image |
---|
| 102 | * @parm image_size size of the kernel image buffer |
---|
| 103 | * @parm initrd_buffer name of the ramdisk image file |
---|
| 104 | * @parm initrd_size size of the ramdisk buffer |
---|
| 105 | * @parm cmdline command line string |
---|
| 106 | * @parm flags domain creation flags |
---|
| 107 | * @parm store_evtchn the store event channel for this domain to use |
---|
| 108 | * @parm store_mfn returned with the mfn of the store page |
---|
| 109 | * @parm console_evtchn the console event channel for this domain to use |
---|
| 110 | * @parm conole_mfn returned with the mfn of the console page |
---|
| 111 | * @return 0 on success, -1 on failure |
---|
| 112 | */ |
---|
| 113 | int xc_linux_build_mem(int xc_handle, |
---|
| 114 | uint32_t domid, |
---|
| 115 | unsigned int mem_mb, |
---|
| 116 | const char *image_buffer, |
---|
| 117 | unsigned long image_size, |
---|
| 118 | const char *initrd_buffer, |
---|
| 119 | unsigned long initrd_size, |
---|
| 120 | const char *cmdline, |
---|
| 121 | const char *features, |
---|
| 122 | unsigned long flags, |
---|
| 123 | unsigned int store_evtchn, |
---|
| 124 | unsigned long *store_mfn, |
---|
| 125 | unsigned int console_evtchn, |
---|
| 126 | unsigned long *console_mfn); |
---|
| 127 | |
---|
| 128 | int xc_hvm_build(int xc_handle, |
---|
| 129 | uint32_t domid, |
---|
| 130 | int memsize, |
---|
| 131 | const char *image_name); |
---|
| 132 | |
---|
| 133 | int xc_hvm_build_mem(int xc_handle, |
---|
| 134 | uint32_t domid, |
---|
| 135 | int memsize, |
---|
| 136 | const char *image_buffer, |
---|
| 137 | unsigned long image_size); |
---|
| 138 | |
---|
| 139 | /* PowerPC specific. */ |
---|
| 140 | int xc_prose_build(int xc_handle, |
---|
| 141 | uint32_t domid, |
---|
| 142 | unsigned int mem_mb, |
---|
| 143 | const char *image_name, |
---|
| 144 | const char *ramdisk_name, |
---|
| 145 | const char *cmdline, |
---|
| 146 | const char *features, |
---|
| 147 | unsigned long flags, |
---|
| 148 | unsigned int store_evtchn, |
---|
| 149 | unsigned long *store_mfn, |
---|
| 150 | unsigned int console_evtchn, |
---|
| 151 | unsigned long *console_mfn); |
---|
| 152 | |
---|
| 153 | #endif /* XENGUEST_H */ |
---|