Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Multiboot enhancements
[palacios.git] / palacios / include / palacios / vmm_multiboot.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2015, The V3VEE Project <http://www.v3vee.org> 
11  * All rights reserved.
12  *
13  * Author: Peter Dinda <pdinda@northwestern.edu>
14  *
15  * This is free software.  You are permitted to use,
16  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
17  */
18
19
20 #ifndef __VMM_MULTIBOOT_H
21 #define __VMM_MULTIBOOT_H
22
23
24 #ifdef __V3VEE__ 
25
26 #include <palacios/vmm_types.h>
27
28
29 typedef struct mb_header {
30     uint32_t magic;
31     uint32_t arch; 
32 #define ARCH_X86 0
33     uint32_t headerlen;
34     uint32_t checksum;
35 } __attribute__((packed)) mb_header_t;
36
37 typedef struct mb_tag {
38     uint16_t type;
39     uint16_t flags;
40     uint32_t size;
41 } __attribute__((packed)) mb_tag_t;
42
43 #define MB_TAG_INFO    1
44 typedef struct mb_info_req {
45     mb_tag_t tag;
46     uint32_t types[0];
47 } __attribute__((packed)) mb_info_t;
48
49
50 typedef uint32_t u_virt, u_phys;
51
52 #define MB_TAG_ADDRESS 2
53 typedef struct mb_addr {
54     mb_tag_t tag;
55     u_virt   header_addr;
56     u_virt   load_addr;
57     u_virt   load_end_addr;
58     u_virt   bss_end_addr;
59 } __attribute__((packed)) mb_addr_t;
60
61 #define MB_TAG_ENTRY 3
62 typedef struct mb_entry {
63     mb_tag_t tag;
64     u_virt   entry_addr;
65 } __attribute__((packed)) mb_entry_t;
66
67 #define MB_TAG_FLAGS 4
68 typedef struct mb_flags {
69     mb_tag_t tag;
70     uint32_t console_flags;
71 } __attribute__((packed)) mb_flags_t;
72
73 #define MB_TAG_FRAMEBUF 5
74 typedef struct mb_framebuf {
75     mb_tag_t tag;
76     uint32_t width;
77     uint32_t height;
78     uint32_t depth;
79 } __attribute__((packed)) mb_framebuf_t;
80
81 #define MB_TAG_MODALIGN 6
82 typedef struct mb_modalign {
83     mb_tag_t tag;
84     uint32_t size;
85 } __attribute__((packed)) mb_modalign_t;
86
87
88 // For HVM, which can use a pure 64 bit variant
89 // version of multiboot.  The existence of
90 // this tag indicates that this special mode is
91 // requested
92 #define MB_TAG_MB64_HRT 0xf00d
93 typedef struct mb_mb64_hrt {
94     mb_tag_t       tag;
95     uint32_t       hrt_flags;
96 } __attribute__((packed)) mb_mb64_hrt_t;
97
98 typedef struct mb_data {
99     mb_header_t   *header;
100     mb_info_t     *info;
101     mb_addr_t     *addr;
102     mb_entry_t    *entry;
103     mb_flags_t    *flags;
104     mb_framebuf_t *framebuf;
105     mb_modalign_t *modalign;
106     mb_mb64_hrt_t *mb64_hrt;
107 } mb_data_t;
108
109 struct v3_vm_multiboot {
110     uint8_t   is_multiboot;
111     struct v3_cfg_file *mb_file;
112     mb_data_t mb_data;
113     // GPA where we put the MB record, GDT, TSS, etc
114     // The kernel load address and size are as in mb_data
115     void     *mb_data_gpa; 
116 };
117
118 // There is no core structure for
119 // multiboot capability
120
121 struct v3_xml;
122
123 int v3_init_multiboot();
124 int v3_deinit_multiboot();
125
126 int v3_init_multiboot_vm(struct v3_vm_info *vm, struct v3_xml *config);
127 int v3_deinit_multiboot_vm(struct v3_vm_info *vm);
128
129 int v3_init_multiboot_core(struct guest_info *core);
130 int v3_deinit_multiboot_core(struct guest_info *core);
131
132 int v3_setup_multiboot_vm_for_boot(struct v3_vm_info *vm);
133 int v3_setup_multiboot_core_for_boot(struct guest_info *core);
134
135 int v3_handle_multiboot_reset(struct guest_info *core);
136
137 // The following are utility functions that HVM builds on
138 int      v3_parse_multiboot_header(struct v3_cfg_file *file, mb_data_t *result);
139 int      v3_write_multiboot_kernel(struct v3_vm_info *vm, mb_data_t *mb, struct v3_cfg_file *file, 
140                                    void *base, uint64_t limit);
141 // The multiboot table is prepared from the perspective of the given
142 // core - this allows it to be generated appropriately for ROS and HRT cores
143 // when used in an HVM
144 uint64_t v3_build_multiboot_table(struct guest_info *core, uint8_t *dest, uint64_t size);
145
146 #endif /* ! __V3VEE__ */
147
148
149 #endif