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 __SYSCALL_HIJACK_H__
21 #define __SYSCALL_HIJACK_H__
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
32 #define IA32_SYSENTER_CS_MSR 0x00000174
33 #define IA32_SYSENTER_ESP_MSR 0x00000175
34 #define IA32_SYSENTER_EIP_MSR 0x00000176
38 #define max(a, b) ( ((a) > (b)) ? (a) : (b) )
41 #define SYSCALL_INT_VECTOR 0x80
42 #define SYSCALL_CPUID_NUM 0x80000001
43 #define SYSENTER_CPUID_NUM 0x00000001
45 #define SYSCALL_MAGIC_ADDR 0xffffffffffffffff
47 #define KERNEL_PHYS_LOAD_ADDR 0x1000000
50 struct v3_syscall_info {
52 uint8_t syscall_map_injected;
53 char * syscall_page_backup;
54 uint8_t * syscall_map;
60 int v3_hook_syscall (struct guest_info * core,
62 int (*handler)(struct guest_info * core, uint_t syscall_nr, void * priv_data),
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);