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, Steven Jaconette <stevenjaconette2007@u.northwestern.edu>
11 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
12 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
13 * All rights reserved.
15 * Author: Steven Jaconette <stevenjaconette2007@u.northwestern.edu>
17 * This is free software. You are permitted to use,
18 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <palacios/vmm_direct_paging.h>
22 #include <palacios/vmm_paging.h>
23 #include <palacios/vmm.h>
24 #include <palacios/vm_guest_mem.h>
25 #include <palacios/vm_guest.h>
27 static addr_t create_generic_pt_page() {
29 page = V3_VAddr(V3_AllocPages(1));
30 memset(page, 0, PAGE_SIZE);
35 // Inline handler functions for each cpu mode
36 #include "vmm_direct_paging_32.h"
37 #include "vmm_direct_paging_32pae.h"
38 #include "vmm_direct_paging_64.h"
41 addr_t v3_create_direct_passthrough_pts(struct guest_info * info) {
42 return create_generic_pt_page();
45 int v3_handle_passthrough_pagefault(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) {
46 v3_vm_cpu_mode_t mode = v3_get_cpu_mode(info);
51 return handle_passthrough_pagefault_32(info, fault_addr, error_code);
56 // Long mode will only use 32PAE page tables...
57 return handle_passthrough_pagefault_32pae(info, fault_addr, error_code);
60 PrintError("Unknown CPU Mode\n");
68 int v3_handle_nested_pagefault(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) {
70 v3_vm_cpu_mode_t mode = LONG;
73 PrintDebug("Nested PageFault: fault_addr=%p, error_code=%u\n",(void*)fault_addr, *(uint_t *)&error_code);
78 return handle_passthrough_pagefault_32(info, fault_addr, error_code);
81 return handle_passthrough_pagefault_32pae(info, fault_addr, error_code);
85 return handle_passthrough_pagefault_64(info, fault_addr, error_code);
88 PrintError("Unknown CPU Mode\n");