+/* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
+/* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
+
#ifndef __VMCB_H
#define __VMCB_H
-#include <palacios/vmm_types.h>
+#ifdef __V3VEE__
+#include <palacios/vmm_types.h>
+#include <palacios/vm_guest.h>
#define VMCB_CTRL_AREA_OFFSET 0x0
#define VMCB_STATE_SAVE_AREA_OFFSET 0x400
struct Exception_Vectors {
- uint_t de : 1 PACKED; // divide by zero
- uint_t db : 1 PACKED; // Debug
- uint_t nmi : 1 PACKED; // Non-maskable interrupt
- uint_t bp : 1 PACKED; // Breakpoint
- uint_t of : 1 PACKED; // Overflow
- uint_t br : 1 PACKED; // Bound-Range
- uint_t ud : 1 PACKED; // Invalid-Opcode
- uint_t nm : 1 PACKED; // Device-not-available
- uint_t df : 1 PACKED; // Double Fault
+ uint_t de : 1 PACKED; // (0) divide by zero
+ uint_t db : 1 PACKED; // (1) Debug
+ uint_t nmi : 1 PACKED; // (2) Non-maskable interrupt
+ uint_t bp : 1 PACKED; // (3) Breakpoint
+ uint_t of : 1 PACKED; // (4) Overflow
+ uint_t br : 1 PACKED; // (5) Bound-Range
+ uint_t ud : 1 PACKED; // (6) Invalid-Opcode
+ uint_t nm : 1 PACKED; // (7) Device-not-available
+ uint_t df : 1 PACKED; // (8) Double Fault
uint_t ex9 : 1 PACKED;
- uint_t ts : 1 PACKED; // Invalid TSS
- uint_t np : 1 PACKED; // Segment-not-present
- uint_t ss : 1 PACKED; // Stack
- uint_t gp : 1 PACKED; // General Protection Fault
- uint_t pf : 1 PACKED; // Page fault
+ uint_t ts : 1 PACKED; // (10) Invalid TSS
+ uint_t np : 1 PACKED; // (11) Segment-not-present
+ uint_t ss : 1 PACKED; // (12) Stack
+ uint_t gp : 1 PACKED; // (13) General Protection Fault
+ uint_t pf : 1 PACKED; // (14) Page fault
uint_t ex15 : 1 PACKED;
- uint_t mf : 1 PACKED; // Floating point exception
- uint_t ac : 1 PACKED; // Alignment-check
- uint_t mc : 1 PACKED; // Machine Check
- uint_t xf : 1 PACKED; // SIMD floating-point
+ uint_t mf : 1 PACKED; // (15) Floating point exception
+ uint_t ac : 1 PACKED; // (16) Alignment-check
+ uint_t mc : 1 PACKED; // (17) Machine Check
+ uint_t xf : 1 PACKED; // (18) SIMD floating-point
uint_t ex20 : 1 PACKED;
uint_t ex21 : 1 PACKED;
uint_t ex22 : 1 PACKED;
uint_t ex27 : 1 PACKED;
uint_t ex28 : 1 PACKED;
uint_t ex29 : 1 PACKED;
- uint_t sx : 1 PACKED; // Security Exception
+ uint_t sx : 1 PACKED; // (30) Security Exception
uint_t ex31 : 1 PACKED;
};
* But it does say that the EXITINTINFO field is in bits 63-1
* ALL other occurances mention a 1 bit reserved field
*/
- uint_t rsvd5 : 1 PACKED;
- ullong_t exit_int_info : 63 PACKED;
+ // uint_t rsvd5 : 1 PACKED;
+ //ullong_t exit_int_info : 63 PACKED;
/* ** */
+ // AMD Manual 2, pg 391, sect: 15.19
+ struct Interrupt_Info exit_int_info PACKED;
+
// uint_t NP_ENABLE : 1 PACKED;
//ullong_t rsvd6 : 63 PACKED; // Should be 0
ullong_t NP_ENABLE PACKED;
void PrintDebugVMCB(vmcb_t * vmcb);
+void set_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs);
+void get_vmcb_segments(vmcb_t * vmcb, struct v3_segments * segs);
+
+#endif // ! __V3VEE__
+
#endif