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) 2011, Kyle C. Hale <kh@u.northwestern.edu>
11 * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Kyle C. Hale <kh@u.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 #ifndef __CODE_INJECT_H__
21 #define __CODE_INJECT_H__
23 int v3_insert_code_inject (void *ginfo, void *code, int size, char *bin_file,
24 int is_dyn, int is_exec_hooked, int func_offset);
31 #define MUNMAP_SIZE 22
32 #define VMMCALL_SIZE 10
35 #define ELF_MAG_SIZE 4
37 #define MMAP_COMPLETE 1
39 struct v3_code_injects {
40 struct list_head code_inject_list;
41 struct list_head hooked_code_injects;
46 // TODO: adjust size of boolean members
47 struct v3_code_inject_info {
49 // pointer to ELF and its size
54 // indicates this is a hooked inject
58 // important offsets to ELF sections
59 // for the injected code
66 addr_t code_region_gva;
67 // continuation-style function for
68 // page fault handling
72 // the following are for saving context
75 struct v3_ctrl_regs ctrl_regs;
78 struct list_head inject_node;
85 int (*cont_func)(struct guest_info * core, struct v3_code_inject_info * inject,
89 int v3_remove_code_inject(struct v3_vm_info * vm, struct v3_code_inject_info * inject);
90 int v3_do_inject(struct guest_info * core, struct v3_code_inject_info * inject, int mmap_state);
91 int v3_do_static_inject(struct guest_info * core, struct v3_code_inject_info * inject,
92 int mmap_state, addr_t region_gva);
93 int v3_handle_guest_inject(struct guest_info * core, void * priv_data);
95 #endif /* ! __V3VEE__ */