Question

I'm trying to (m)map the following address into virtual address space :

---Phys Address is 0xf6c50 --- This address is the sum of the EBDA Base Pointer and the Higher Bios Memory Window (ACPI_HI_RSDP_WINDOW_BASE)

The purpose is to map the ACPI tables into the process' address space and use it later.

    acpi_mem_fd = open("/dev/mem", O_RDONLY);

I open a file descriptor to read "/dev/mem" .I reach the address using pread and read the ACPI header structure,once the signature matches I wish to map it into Virtual Address space,but when I do that I get an error like : "Cannot allocate memory"

I'm using FreeBSD 8.x . I can confirm that in general mmap works. The call that leads to an error is as follows :

    map->va = mmap(0, size, PROT_READ, MAP_PRIVATE, acpi_mem_fd, pa);

I've tried even using MAP_SHARED,but that din't somehow change much.

Here pa is the address above defined by 'ACPI_HI_RSDP_WINDOW_BASE' macro. Can anybody shed some light on this or how to workaround this.

Was it helpful?

Solution

Per your comment that size is 36: size must be a multiple of the system page size. See C - why I cannot mmap a small (256UL or smaller) size of memory?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top