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.


4db6088587692263a1f4fa269f02b7b4c2c277b0
[palacios.git] / palacios / include / gears / syscall_hijack.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) 2011, Kyle C. Hale <kh@u.northwestern.edu> 
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Kyle C. Hale <kh@u.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 #ifndef __SYSCALL_HIJACK_H__
21 #define __SYSCALL_HIJACK_H__
22
23 #define STAR_MSR                 0xc0000081 /* Legacy mode SYSCALL target */
24 #define LSTAR_MSR                0xc0000082 /* Long mode SYSCALL target */
25 #define CSTAR_MSR                0xc0000083 /* compat mode SYSCALL target */
26 #define SF_MASK_MSR              0xc0000084 /* EFLAGS mask for syscall */
27 #define SYSENTER_CS_MSR          0x00000174 /* SYSENTER/EXIT are for legacy mode only on AMD */
28 #define SYSENTER_ESP_MSR         0x00000175
29 #define SYSENTER_EIP_MSR         0x00000176
30
31 /* Intel specific */
32 #define IA32_SYSENTER_CS_MSR     0x00000174
33 #define IA32_SYSENTER_ESP_MSR    0x00000175
34 #define IA32_SYSENTER_EIP_MSR    0x00000176
35
36 #define MAX_CHARS 256
37 #ifndef max
38     #define max(a, b) ( ((a) > (b)) ? (a) : (b) )
39 #endif
40
41 #define SYSCALL_INT_VECTOR   0x80
42 #define SYSCALL_CPUID_NUM    0x80000001
43 #define SYSENTER_CPUID_NUM   0x00000001
44
45 #define SYSCALL_MAGIC_ADDR       0xffffffffffffffff
46
47 #define KERNEL_PHYS_LOAD_ADDR    0x1000000
48
49
50 struct v3_syscall_info {
51     uint64_t target_addr;
52     uint8_t  syscall_map_injected;
53     char * syscall_page_backup;
54     uint8_t * syscall_map;
55     addr_t syscall_stub;
56     // state save area
57     addr_t ssa;
58 };
59
60 int v3_hook_syscall (struct guest_info * core,
61     uint_t syscall_nr,
62     int (*handler)(struct guest_info * core, uint_t syscall_nr, void * priv_data), 
63     void * priv_data);
64
65 int v3_hook_passthrough_syscall (struct guest_info * core, uint_t syscall_nr);
66 int v3_syscall_handler (struct guest_info * core, uint8_t vector, void * priv_data);
67
68 #endif