* All rights reserved.
*
* Author: Jack Lange <jarusl@cs.northwestern.edu>
+ * Peter Dinda <jarusl@cs.northwestern.edu> (Reset)
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "V3VEE_LICENSE".
// I could be a ROS core, or I could be in a non-HVM
// either way, if I'm core 0, I'm the leader
if (core->vcpu_id==0) {
+ uint64_t mem_size=core->vm_info->mem_size;
+
+#ifdef V3_CONFIG_HVM
+ // on a ROS reset, we should only
+ // manipulate the part of the memory seen by
+ // the ROS
+ if (core->vm_info->hvm_state.is_hvm) {
+ mem_size=v3_get_hvm_ros_memsize(core->vm_info);
+ }
+#endif
core->vm_info->run_state = VM_RESETTING;
// copy bioses again because some,
// like seabios, assume
// this should also blow away the BDA and EBDA
PrintDebug(core->vm_info,core,"Clear memory (%p bytes)\n",(void*)core->vm_info->mem_size);
- if (v3_set_gpa_memory(core, 0, core->vm_info->mem_size, 0)!=core->vm_info->mem_size) {
+ if (v3_set_gpa_memory(core, 0, mem_size, 0)!=mem_size) {
PrintError(core->vm_info,core,"Clear of memory failed\n");
}
PrintDebug(core->vm_info,core,"Copying bioses\n");
core->cpl = 0;
core->cpu_mode = REAL;
core->mem_mode = PHYSICAL_MEM;
- core->num_exits=0;
+ //core->num_exits=0;
PrintDebug(core->vm_info,core,"Machine reset to REAL/PHYSICAL\n");
info->intr_core_state.irq_pending = 1;
info->intr_core_state.irq_vector = irq;
+
+ break;
}
case V3_NMI:
vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data));
addr_t exit_code = 0, exit_info1 = 0, exit_info2 = 0;
uint64_t guest_cycles = 0;
- struct Interrupt_Info exit_int_info;
// Conditionally yield the CPU if the timeslice has expired
exit_code = guest_ctrl->exit_code;
exit_info1 = guest_ctrl->exit_info1;
exit_info2 = guest_ctrl->exit_info2;
- exit_int_info = guest_ctrl->exit_int_info;
#ifdef V3_CONFIG_SYMCALL
if (info->sym_core_state.symcall_state.sym_call_active == 0) {
PrintError(info->vm_info, info, "Error in SVM exit handler (ret=%d)\n", ret);
PrintError(info->vm_info, info, " last Exit was %d (exit code=0x%llx)\n", v3_last_exit, (uint64_t) exit_code);
- //V3_Sleep(5*1000000);
-
return -1;
}
}
// So the selector needs to be VV00
// and the base needs to be VV000
//
- V3_Print(core->vm_info,core,"SVM Reset to RIP %p\n",(void*)rip);
core->rip = 0;
core->segments.cs.selector = rip << 8;
core->segments.cs.limit = 0xffff;