delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/02:56:37

From: Neil Goldberg <ngoldber AT mitre DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Accessing memory above an adress of 1MB (read this and check my reasoning)
Date: Mon, 09 Aug 1999 12:29:04 +0100
Organization: The MITRE Corporation
Lines: 49
Message-ID: <37AEBB80.602B@mitre.org>
References: <37aeb1ba DOT 11535499 AT NotesXNT> <37AEBCD0 DOT 52AE AT surfsouth DOT com>
NNTP-Posting-Host: mm58842-pc.mitre.org
Mime-Version: 1.0
X-Trace: top.mitre.org 934216039 16417 128.29.96.60 (9 Aug 1999 16:27:19 GMT)
X-Complaints-To: usenet AT news DOT mitre DOT org
NNTP-Posting-Date: 9 Aug 1999 16:27:19 GMT
Cc: Martin_Czamai AT peak-service DOT com
X-Mailer: Mozilla 3.04 (WinNT; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Holmes wrote:
> 
> Martin Czamai wrote:
> >
> > Hello!
> >
> > I want to access the memory space given from a BAR (base adress
> > register) of a PCI controller. (the adress is dynamic allocated by the
> > system)
> > Therefore I wrote a function that returns the (absolute) adress that
> > has to be accessed. Usually it is around 0xFFFFF000 .
> > I used __djgpp_map_physical_memory (mappedBAR, NoBytes, BaseAdr) for
> > mapping the device to a created memory block named 'mappedBAR'; the
> > number of bytes to map (NoBytes) is a multiple of a mem-page found
> > with __dpmi_get_page_size(&NoBytes)  (4096 bytes) and the base adress
> > (BaseAdr) is equal the absolute address of the BAR.
> > My problem is, that the __djgpp_map_physical_memory (mappedBAR,
> > NoBytes, BaseAdr) returns EACCES as errno, wich is a rejection of the
> > request to the  DPMI server. What does this message exactly mean?
> > Who could help me getting started to access this memory?
> > I am using RHIDE 1.4.
> > Please send your reply to Martin_Czamai AT peak-service DOT com .
> > Thank you!
> 
>   Wow... FFFFF000 is pretty near the 4 gig limit.  Unless you have
> 4 gig of ram, I think the PCI controller is lying to you.
> 
No, this is not true. In fact, any card on your system bus can respond
to memory access requests (of which physical RAM is just one kind). The
reason why it is so high is so that it does not interfere (or become
masked) by physical RAM. Case in point:
SVGA Linear Framebuffers; they indicate what memory range the video
card will respond to as writes/reads into it's internal video RAM.
Those can appear just above your physical RAM size (mine's around
0x0C000000).

Note that __djgpp_map_physical_memory requires a DPMI 1.0 server, and
only of the two commonly used ones (windows, cwsdpmi) is 1.0, while the
other is .9. I can't remember which is which, but to check, try running
the program in the OTHER environment to see if that works.
If neither works do it the old skool way:
new_descriptor = __dpmi_allocate_segment_descriptor(1);
__dpmi_set_segment_base(new_descriptor,
that_place_the_PCI_controller_says_to_map);
__dpmi_set_segment_limit(new_descriptor, size_of_pages_in_bytes);
Now you have a good descriptor. If EACCESS happens again after all this,
then your PCI card is lying to you.

moogla

- Raw text -


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