| 379 | } |
| 380 | |
| 381 | static int |
| 382 | vmm_handler(module_t mod, int what, void *arg) |
| 383 | { |
| 384 | int error; |
| 385 | |
| 386 | switch (what) { |
| 387 | case MOD_LOAD: |
| 388 | if (vmm_is_hw_supported()) { |
| 389 | vmmdev_init(); |
| 390 | error = vmm_init(); |
| 391 | if (error == 0) |
| 392 | vmm_initialized = 1; |
| 393 | } else { |
| 394 | error = ENXIO; |
| 395 | } |
| 396 | break; |
| 397 | case MOD_UNLOAD: |
| 398 | if (vmm_is_hw_supported()) { |
| 399 | error = vmmdev_cleanup(); |
| 400 | if (error == 0) { |
| 401 | vmm_resume_p = NULL; |
| 402 | iommu_cleanup(); |
| 403 | if (vmm_ipinum != IPI_AST) |
| 404 | lapic_ipi_free(vmm_ipinum); |
| 405 | error = vmmops_modcleanup(); |
| 406 | /* |
| 407 | * Something bad happened - prevent new |
| 408 | * VMs from being created |
| 409 | */ |
| 410 | if (error) |
| 411 | vmm_initialized = 0; |
| 412 | } |
| 413 | } else { |
| 414 | error = 0; |
| 415 | } |
| 416 | break; |
| 417 | default: |
| 418 | error = 0; |
| 419 | break; |
| 420 | } |
| 421 | return (error); |
| 422 | } |
| 423 | |
| 424 | static moduledata_t vmm_kmod = { |
| 425 | "vmm", |
nothing calls this directly
no test coverage detected