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.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2015, The V3VEE Project <http://www.v3vee.org>
11 * All rights reserved.
13 * Author: Peter Dinda <pdinda@northwestern.edu>
15 * This is free software. You are permitted to use,
16 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #ifndef __VMM_MULTIBOOT_H
21 #define __VMM_MULTIBOOT_H
26 #include <palacios/vmm_types.h>
29 typedef struct mb_header {
35 } __attribute__((packed)) mb_header_t;
37 typedef struct mb_tag {
41 } __attribute__((packed)) mb_tag_t;
44 typedef struct mb_info_req {
47 } __attribute__((packed)) mb_info_t;
50 typedef uint32_t u_virt, u_phys;
52 #define MB_TAG_ADDRESS 2
53 typedef struct mb_addr {
59 } __attribute__((packed)) mb_addr_t;
61 #define MB_TAG_ENTRY 3
62 typedef struct mb_entry {
65 } __attribute__((packed)) mb_entry_t;
67 #define MB_TAG_FLAGS 4
68 typedef struct mb_flags {
70 uint32_t console_flags;
71 } __attribute__((packed)) mb_flags_t;
73 #define MB_TAG_FRAMEBUF 5
74 typedef struct mb_framebuf {
79 } __attribute__((packed)) mb_framebuf_t;
81 #define MB_TAG_MODALIGN 6
82 typedef struct mb_modalign {
85 } __attribute__((packed)) mb_modalign_t;
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
92 #define MB_TAG_MB64_HRT 0xf00d
93 typedef struct mb_mb64_hrt {
96 } __attribute__((packed)) mb_mb64_hrt_t;
98 typedef struct mb_data {
104 mb_framebuf_t *framebuf;
105 mb_modalign_t *modalign;
106 mb_mb64_hrt_t *mb64_hrt;
109 struct v3_vm_multiboot {
110 uint8_t is_multiboot;
111 struct v3_cfg_file *mb_file;
113 // GPA where we put the MB record, GDT, TSS, etc
114 // The kernel load address and size are as in mb_data
118 // There is no core structure for
119 // multiboot capability
123 int v3_init_multiboot();
124 int v3_deinit_multiboot();
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);
129 int v3_init_multiboot_core(struct guest_info *core);
130 int v3_deinit_multiboot_core(struct guest_info *core);
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);
135 int v3_handle_multiboot_reset(struct guest_info *core);
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);
146 #endif /* ! __V3VEE__ */