www.delorie.com/djgpp/doc/libc/libc_136.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <dpmi.h>

int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
			        unsigned long phys_addr);


This function attempts to map a range of physical memory over the specified addresses. One common use of this routine is to map device memory, such as a linear frame buffer, into the address space of the calling program. our_addr, num_bytes, and phys_addr must be page-aligned. If they are not page-aligned, errno will be set to EINVAL and the routine will fail.

This routine properly handles memory ranges that span multiple DPMI handles, while __dpmi_map_device_in_memory_block does not.

Consult DPMI documentation on function 0508H for details on how this function works. Note: since 0508H is a DPMI service new with DPMI 1.0, this call will fail on most DPMI 0.9 servers. For your program to work on a wide range of systems, you should not assume this call will succeed.

Even on failure, this routine may affect a subset of the pages specified.

Return Value

0 on success, -1 on failure. On failure, errno will be set to EINVAL for illegal input parameters, or EACCES if the DPMI server rejected the mapping request.




if (__djgpp_map_physical_memory (my_page_aligned_memory, 16384,
  printf ("Failed to map physical addresses!\n");

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004