Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>__djgpp_map_physical_memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
__djgpp_map_physical_memory
===========================

Syntax
------

     #include <dpmi.h>
     
     int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
                                  unsigned long phys_addr);

Description
-----------

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.

Example
-------

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


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson