Example #1
0
File: vm.c Project: kkaneda/tvmm
/* See Multiboot Specification Manual */
static void
set_state_save_area ( struct vmcb *vmcb )
{
	vmcb->cpl = 0; /* must be equal to SS.DPL  */

	/* Must contatin the magin value */
	vmcb->rax = MULTIBOOT_BOOTLOADER_MAGIC;

	/* The OS image must create its own stack as soon as it needs one. */
	vmcb->rsp = 0;

	/* Bit 31 (PG) must be cleared.  Bit 0 (PE) must be set. Other bits are all undefined. */
	vmcb->cr0 = X86_CR0_PE | X86_CR0_PG; 
	vmcb->cr3 = 0x200000 + PAGE_SIZE * 3; // dummy
	vmcb->cr4 = X86_CR4_PAE;

	/* Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared.  Other bits are all undefined */
	vmcb->rflags = 2; /* set the reserved bit */

	vmcb->g_pat = 0x7040600070406UL; // ???

	vmcb->efer = EFER_LME | EFER_LMA | EFER_SVME;

	set_descriptors ( vmcb );
}
Example #2
0
int main() {
  init_state_descriptors();
  set_descriptors(triples);  
  print_descriptors();

  build_tables();
  print_tables();
  check_tables();
  return 0;
}