Take the 2-minute tour ×

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.

share|improve this question
cdev mappings (and /dev/mem is a character device) do not allow MAP_PRIVATE, but MAP_SHARED should work, if everything else is OK. You say pa is 0xf6c50; what is size? –  torek Jul 29 '13 at 22:01
Size is 36 @torek –  Rohit Jul 29 '13 at 22:33

1 Answer 1

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?

share|improve this answer

Your Answer


