X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=0e37c4cdda8e3d09d5264d5c8d6d1a0298238732;hb=3650bf4aaa4f83afae52c8fee98fce6e3ee68deb;hp=ede619bbd12dbf425c605b7931cda453b09bf1e1;hpb=1675f10b6a5173570788c4fc5e013925c0189fea;p=palacios.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index ede619b..0e37c4c 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -53,6 +53,10 @@ #include +#ifdef V3_CONFIG_MEM_TRACK +#include +#endif + #ifdef V3_CONFIG_TM_FUNC #include #endif @@ -290,11 +294,13 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * core) { PrintDebug(core->vm_info, core, "Created\n"); core->ctrl_regs.cr0 |= 0x80000000; - core->ctrl_regs.cr3 = core->direct_map_pt; + + v3_activate_passthrough_pt(core); ctrl_area->cr_reads.cr0 = 1; ctrl_area->cr_writes.cr0 = 1; - //ctrl_area->cr_reads.cr4 = 1; + //intercept cr4 read so shadow pager can use PAE independently of guest + ctrl_area->cr_reads.cr4 = 1; ctrl_area->cr_writes.cr4 = 1; ctrl_area->cr_reads.cr3 = 1; ctrl_area->cr_writes.cr3 = 1; @@ -631,12 +637,17 @@ int v3_svm_enter(struct guest_info * info) { // Conditionally yield the CPU if the timeslice has expired v3_schedule(info); +#ifdef V3_CONFIG_MEM_TRACK + v3_mem_track_entry(info); +#endif + // Update timer devices after being in the VM before doing // IRQ updates, so that any interrupts they raise get seen // immediately. v3_advance_time(info, NULL); v3_update_timers(info); + // disable global interrupts for vm state transition v3_clgi(); @@ -797,6 +808,7 @@ int v3_svm_enter(struct guest_info * info) { // reenable global interrupts after vm exit v3_stgi(); + // Conditionally yield the CPU if the timeslice has expired v3_schedule(info); @@ -806,6 +818,7 @@ int v3_svm_enter(struct guest_info * info) { v3_advance_time(info, NULL); v3_update_timers(info); + { int ret = v3_handle_svm_exit(info, exit_code, exit_info1, exit_info2); @@ -821,6 +834,10 @@ int v3_svm_enter(struct guest_info * info) { v3_handle_timeouts(info, guest_cycles); } +#ifdef V3_CONFIG_MEM_TRACK + v3_mem_track_exit(info); +#endif + return 0; } @@ -832,6 +849,25 @@ int v3_start_svm_guest(struct guest_info * info) { PrintDebug(info->vm_info, info, "Starting SVM core %u (on logical core %u)\n", info->vcpu_id, info->pcpu_id); + +#ifdef V3_CONFIG_MULTIBOOT + if (v3_setup_multiboot_core_for_boot(info)) { + PrintError(info->vm_info, info, "Failed to setup Multiboot core...\n"); + return -1; + } +#endif + +#ifdef V3_CONFIG_HVM + if (v3_setup_hvm_hrt_core_for_boot(info)) { + PrintError(info->vm_info, info, "Failed to setup HRT core...\n"); + return -1; + } +#endif + + + + + while (1) { if (info->core_run_state == CORE_STOPPED) { @@ -881,7 +917,6 @@ int v3_start_svm_guest(struct guest_info * info) { info->core_run_state = CORE_STOPPED; break; } - #ifdef V3_CONFIG_PMU_TELEMETRY v3_pmu_telemetry_start(info);