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.


memory lookup refactorization
[palacios.git] / palacios / src / palacios / vmm_config_class.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) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #include <palacios/vm_guest_mem.h>
21
22
23 static int pre_config_pc_core(struct guest_info * info, v3_cfg_tree_t * cfg) { 
24
25
26     info->cpu_mode = REAL;
27     info->mem_mode = PHYSICAL_MEM;
28
29
30     info->vm_regs.rdi = 0;
31     info->vm_regs.rsi = 0;
32     info->vm_regs.rbp = 0;
33     info->vm_regs.rsp = 0;
34     info->vm_regs.rbx = 0;
35     info->vm_regs.rdx = 0;
36     info->vm_regs.rcx = 0;
37     info->vm_regs.rax = 0;
38
39     return 0;
40 }
41
42 static int post_config_pc_core(struct guest_info * info, v3_cfg_tree_t * cfg) { 
43
44     v3_print_mem_map(info->vm_info);
45     return 0;
46 }
47
48 static int post_config_pc(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
49
50 #define VGABIOS_START 0x000c0000
51 #define ROMBIOS_START 0x000f0000
52     
53     /* layout vgabios */
54     {
55         extern uint8_t v3_vgabios_start[];
56         extern uint8_t v3_vgabios_end[];
57         addr_t vgabios_dst = 0;
58
59         if (v3_gpa_to_hpa(&(vm->cores[0]), VGABIOS_START, &vgabios_dst) == -1) {
60             PrintError("Could not find VGABIOS destination address\n");
61             return -1;
62         }
63
64         memcpy(V3_VAddr((void *)vgabios_dst), v3_vgabios_start, 
65                v3_vgabios_end - v3_vgabios_start);      
66     }
67     
68     /* layout rombios */
69     {
70         extern uint8_t v3_rombios_start[];
71         extern uint8_t v3_rombios_end[];
72         addr_t rombios_dst = 0;
73         
74         if (v3_gpa_to_hpa(&(vm->cores[0]), ROMBIOS_START, &rombios_dst) == -1) {
75             PrintError("Could not find ROMBIOS destination address\n");
76             return -1;
77         }
78
79         memcpy(V3_VAddr((void *)rombios_dst), v3_rombios_start, 
80                v3_rombios_end - v3_rombios_start);
81     }
82
83     return 0;
84 }
85