delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/15/18:32:13

From: hung vo <hungvo AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Help on Accessing Physical Memory
Date: Thu, 12 Jun 1997 14:42:25 -0700
Organization: Jet Propulsion Laboratory - Pasadena CA
Lines: 35
Message-ID: <33A06D41.66EB@earthlink.net>
Reply-To: hungvo AT earthlink DOT net
NNTP-Posting-Host: starsun.jpl.nasa.gov
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi everyone,
My program compiled with DJGPP that is trying to access a range of
Physical Address in the upper 4GB (start from 0xFFBEC000).
The sequence that I call is:
__dpmi_allocate_ldt_descriptors(1);	/* to allocate a descriptor */
__dpmi_physical_address_mapping (_info) /* to map physical to linear */
__dpmi_lock_linear_region (_info)	/* to lock the linear */
__dpmi_set_segment_base_address (selector, adr); /*set segment, limit */
__dpmi_set_segment_limit (selector, lim);

And... after finish, I of course do the followings:
__dpmi_unlock_linear_region (_info)
__dpmi_free_physical_address_mapping 
__dpmi_free_ldt_descriptor(selector);

After allocated, and set the address and limit for the  selector as
above, I set my pointer points to the selector, and trying to access
(write to) the memory.

When I run my program under a Dos box from Win95, I always get the
message "Can't map physical to linear address". So obviously, it failed
on "__dpmi_physical_address_mapping (_info)"

Do You have any idea of what going on? Am I missing somethings?

By the way, I compiled my code with the option -m386...
Also my other question is once I got the selector, how do I use it to
access to the Physical location? Presently I do this:
      DWORD *my_ptr = (DWORD*) selector; 
Is this correct ?

Thanks a lots for your time.
Hungvo
Jet Propulsion Laboratory
Email: hungvo AT rolans DOT jpl DOT nasa DOT gov

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019