status_t arch_init(vmi_instance_t vmi) { status_t ret = VMI_FAILURE; if (vmi->arch_interface != NULL) { dbprint(VMI_DEBUG_CORE, "Resetting architecture interface"); bzero(vmi->arch_interface, sizeof(struct arch_interface)); } if(vmi->page_mode == VMI_PM_UNKNOWN) { if(VMI_FAILURE == find_page_mode_live(vmi)) { return ret; } } switch(vmi->page_mode) { case VMI_PM_LEGACY: case VMI_PM_PAE: ret = intel_init(vmi); break; case VMI_PM_IA32E: ret = amd64_init(vmi); break; default: break; } return ret; }
status_t arch_init(vmi_instance_t vmi) { status_t ret = VMI_FAILURE; if (vmi->arch_interface != NULL) { dbprint(VMI_DEBUG_CORE, "-- Clearing and setting new architecture interface\n"); bzero(vmi->arch_interface, sizeof(struct arch_interface)); } if(vmi->page_mode == VMI_PM_UNKNOWN) { if(VMI_FAILURE == find_page_mode_live(vmi)) { return ret; } } switch(vmi->page_mode) { case VMI_PM_LEGACY: /* fallthrough */ case VMI_PM_PAE: ret = intel_init(vmi); break; case VMI_PM_IA32E: ret = amd64_init(vmi); break; case VMI_PM_AARCH32: ret = aarch32_init(vmi); break; case VMI_PM_UNKNOWN: /* fallthrough */ default: ret = VMI_FAILURE; break; } if(VMI_FAILURE == ret) { vmi->page_mode = VMI_PM_UNKNOWN; } return ret; }