Exemplo n.º 1
0
/**
 * Get the PXE entry point address.
 *
 * @return              Whether the entry point could be found.
 */
static bool get_entry_point(void) {
  bios_regs_t regs;
  pxenv_t *pxenv;
  pxe_t *pxe;

  /* Use the PXE installation check function. */
  bios_regs_init(&regs);
  regs.eax = INT1A_PXE_INSTALL_CHECK;
  bios_call(0x1a, &regs);
  if (regs.eax != INT1A_PXE_INSTALL_CHECK_RET || regs.eflags & X86_FLAGS_CF) {
    dprintf("pxe: loaded via PXE but PXE not available\n");
    return false;
  }

  /* Get the PXENV+ structure. */
  pxenv = (pxenv_t *)segoff_to_linear((regs.es << 16) | regs.bx);
  if (memcmp(pxenv->signature, PXENV_SIGNATURE, sizeof(pxenv->signature)) != 0) {
    boot_error("PXENV+ structure has incorrect signature");
  } else if (!checksum_range(pxenv, pxenv->length)) {
    boot_error("PXENV+ structure is corrupt");
  }

  /* Get the !PXE structure. */
  pxe = (pxe_t *)segoff_to_linear(pxenv->pxe_ptr);
  if (memcmp(pxe->signature, PXE_SIGNATURE, sizeof(pxe->signature)) != 0) {
    boot_error("!PXE structure has incorrect signature");
  } else if (!checksum_range(pxe, pxe->length)) {
    boot_error("!PXE structure is corrupt");
  }

  pxe_entry_point = pxe->entry_point_16;
  return true;
}
Exemplo n.º 2
0
static const struct acpi_rsdp *scan_for_rsdp(uint32_t base, uint32_t end)
{
    for (base &= ~15; base < end-20; base += 16) {
	const struct acpi_rsdp *rsdp = (const struct acpi_rsdp *)base;

	if (memcmp(rsdp->magic, "RSD PTR ", 8))
	    continue;

	if (checksum_range(rsdp, 20))
	    continue;

	if (rsdp->rev > 0) {
	    if (base + rsdp->len >= end ||
		checksum_range(rsdp, rsdp->len))
		continue;
	}

	return rsdp;
    }

    return NULL;
}
Exemplo n.º 3
0
static enum tbl_errs is_valid_table(const void *ptr)
{
    const struct acpi_hdr *hdr = ptr;

    if (hdr->sig[0] == 0)
	return ERR_NOSIG;

    if (hdr->len < 10 || hdr->len > (1 << 20)) {
	/* Either insane or too large to dump */
	return ERR_SIZE;
    }

    return checksum_range(hdr, hdr->len) == 0 ? ERR_NONE : ERR_CSUM;
}