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".
21 #ifndef __VMM_MEM_HOOK_H
22 #define __VMM_MEM_HOOK_H
32 /* Scratch memory pages for full hooks (1 per core) */
35 /* A second set of scratch memory pages */
36 /* The ONLY reason this exists is because of 'rep cmps'... */
40 struct list_head hook_list;
42 /* We track memory hooks via a hash table */
43 /* keyed to the memory region pointer */
44 struct hashtable * reg_table;
46 int inited; // structure needs to be deinited
50 int v3_init_mem_hooks(struct v3_vm_info * vm);
51 int v3_deinit_mem_hooks(struct v3_vm_info * vm);
53 int v3_hook_full_mem(struct v3_vm_info * vm, uint16_t core_id,
54 addr_t guest_addr_start, addr_t guest_addr_end,
55 int (*read)(struct guest_info * core, addr_t guest_addr, void * dst, uint_t length, void * priv_data),
56 int (*write)(struct guest_info * core, addr_t guest_addr, void * src, uint_t length, void * priv_data),
59 int v3_hook_access_mem(struct v3_vm_info * vm, uint16_t core_id,
60 addr_t guest_addr_start, addr_t guest_addr_end,
61 int (*access)(struct guest_info * core,
64 struct v3_mem_region *reg,
65 pf_error_t access_info,
69 int v3_hook_write_mem(struct v3_vm_info * vm, uint16_t core_id,
70 addr_t guest_addr_start, addr_t guest_addr_end, addr_t host_addr,
71 int (*write)(struct guest_info * core, addr_t guest_addr, void * src, uint_t length, void * priv_data),
75 int v3_unhook_mem(struct v3_vm_info * vm, uint16_t core_id, addr_t guest_addr_start);
81 #endif /* ! __V3VEE__ */