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) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vm_guest_mem.h>
23 static int pre_config_pc_core(struct guest_info * info, v3_cfg_tree_t * cfg) {
25 if (info->cpu_id!=0) {
26 // I am an AP, so I will start in INIT mode,
27 // not in real mode. This means I will wait for
28 // an INIT and then for a SIPI. The SIPI will
29 // tell me where to start executing in real mode
30 info->cpu_mode = INIT;
32 // I am the MP, so I will start as normal
33 info->cpu_mode = REAL;
36 info->mem_mode = PHYSICAL_MEM;
39 info->vm_regs.rdi = 0;
40 info->vm_regs.rsi = 0;
41 info->vm_regs.rbp = 0;
42 info->vm_regs.rsp = 0;
43 info->vm_regs.rbx = 0;
44 info->vm_regs.rdx = 0;
45 info->vm_regs.rcx = 0;
46 info->vm_regs.rax = 0;
51 static int post_config_pc_core(struct guest_info * info, v3_cfg_tree_t * cfg) {
53 v3_print_mem_map(info->vm_info);
57 static int post_config_pc(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
59 #define VGABIOS_START 0x000c0000
60 #define ROMBIOS_START 0x000f0000
64 extern uint8_t v3_vgabios_start[];
65 extern uint8_t v3_vgabios_end[];
66 void * vgabios_dst = 0;
68 if (v3_gpa_to_hva(&(vm->cores[0]), VGABIOS_START, (addr_t *)&vgabios_dst) == -1) {
69 PrintError("Could not find VGABIOS destination address\n");
73 memcpy(vgabios_dst, v3_vgabios_start, v3_vgabios_end - v3_vgabios_start);
78 extern uint8_t v3_rombios_start[];
79 extern uint8_t v3_rombios_end[];
80 void * rombios_dst = 0;
82 if (v3_gpa_to_hva(&(vm->cores[0]), ROMBIOS_START, (addr_t *)&rombios_dst) == -1) {
83 PrintError("Could not find ROMBIOS destination address\n");
87 memcpy(rombios_dst, v3_rombios_start, v3_rombios_end - v3_rombios_start);