| 558 | } |
| 559 | |
| 560 | static caddr_t |
| 561 | xen_pvh_parse_preload_data(uint64_t modulep) |
| 562 | { |
| 563 | caddr_t kmdp; |
| 564 | vm_ooffset_t off; |
| 565 | vm_paddr_t metadata; |
| 566 | char *envp; |
| 567 | char acpi_rsdp[19]; |
| 568 | |
| 569 | if (start_info->modlist_paddr != 0) { |
| 570 | struct hvm_modlist_entry *mod; |
| 571 | const char *cmdline; |
| 572 | |
| 573 | mod = (struct hvm_modlist_entry *) |
| 574 | (start_info->modlist_paddr + KERNBASE); |
| 575 | cmdline = mod[0].cmdline_paddr ? |
| 576 | (const char *)(mod[0].cmdline_paddr + KERNBASE) : NULL; |
| 577 | |
| 578 | if (strcmp(cmdline, "header") == 0) { |
| 579 | struct xen_header *header; |
| 580 | |
| 581 | header = (struct xen_header *)(mod[0].paddr + KERNBASE); |
| 582 | |
| 583 | if ((header->flags & XENHEADER_HAS_MODULEP_OFFSET) != |
| 584 | XENHEADER_HAS_MODULEP_OFFSET) { |
| 585 | xc_printf("Unable to load module metadata\n"); |
| 586 | HYPERVISOR_shutdown(SHUTDOWN_crash); |
| 587 | } |
| 588 | |
| 589 | preload_metadata = (caddr_t)(mod[0].paddr + |
| 590 | header->modulep_offset + KERNBASE); |
| 591 | |
| 592 | kmdp = preload_search_by_type("elf kernel"); |
| 593 | if (kmdp == NULL) |
| 594 | kmdp = preload_search_by_type("elf64 kernel"); |
| 595 | if (kmdp == NULL) { |
| 596 | xc_printf("Unable to find kernel\n"); |
| 597 | HYPERVISOR_shutdown(SHUTDOWN_crash); |
| 598 | } |
| 599 | |
| 600 | /* |
| 601 | * Xen has relocated the metadata and the modules, so |
| 602 | * we need to recalculate it's position. This is done |
| 603 | * by saving the original modulep address and then |
| 604 | * calculating the offset from the real modulep |
| 605 | * position. |
| 606 | */ |
| 607 | metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, |
| 608 | vm_paddr_t); |
| 609 | off = mod[0].paddr + header->modulep_offset - metadata + |
| 610 | KERNBASE; |
| 611 | } else { |
| 612 | preload_metadata = (caddr_t)(mod[0].paddr + KERNBASE); |
| 613 | |
| 614 | kmdp = preload_search_by_type("elf kernel"); |
| 615 | if (kmdp == NULL) |
| 616 | kmdp = preload_search_by_type("elf64 kernel"); |
| 617 | if (kmdp == NULL) { |
nothing calls this directly
no test coverage detected