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, Andy Gocke <agocke@gmail.com>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Andy Gocke <agocke@gmail.com>
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/vmm.h>
21 #include <palacios/vm_guest.h>
24 static int update_map(struct guest_info * info, uint_t msr, int hook_reads, int hook_writes) {
27 int index = get_bitmap_index(msr);
28 uint_t major = index / 4;
29 uint_t minor = (index % 4) * 2;
32 uint8_t * bitmap = (uint8_t *)(info->msr_map.arch_data);
42 *(bitmap + major) &= ~(mask << minor);
43 *(bitmap + major) |= (val << minor);
49 int v3_init_vmx_msr_map(struct guest_info * info) {
50 struct v3_msr_map * msr_map = &(info->msr_map);
52 msr_map->update_map = update_map;
54 msr_map->arch_data = V3_VAddr(V3_AllocPages(1));
55 memset(msr_map->arch_data, 0, PAGE_SIZE_4KB);