www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/06/03:05:32

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Wed, 6 Feb 2002 10:01:29 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: hskim <hskim AT future DOT co DOT kr>
cc: djgpp AT delorie DOT com
Subject: Re: PCI Memory mapping?
In-Reply-To: <_q%78.2592$4o2.105655@news.bora.net>
Message-ID: <Pine.SUN.3.91.1020206100111.1770H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 6 Feb 2002, hskim wrote:

>                 meminfo.handle = 0xf5800000;
>                 meminfo.size = 0x200000;
>                 meminfo.address = 0;
> 
>                 nRet = __dpmi_physical_address_mapping(&meminfo);
> 
>                 printf("Result = %d, %08x,%08x,%08x\n",
>                                nRet,
>                                meminfo.handle,
>                                meminfo.size,
>                                meminfo.address);
>                 if (nRet)
>                    return;
> 
>                 p = meminfo.address;
> 
>                 p[0] = 0;  // program is crashed!

That's because you didn't allocate a selector for accessing this
memory, and didn't set up that selecor's segment to span the range of
addresses you want to access.  __dpmi_physical_address_mapping only
creates a mapping between physical addresses and logical addresses,
but doesn't provide a selector to access the mapped memory.

See section 18.7 of the DJGPP FAQ list, it shows a skeleton of code
that does all of the above.

- Raw text -


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