><
jimmy...@gmail.com> wrote in message
>news:3f7ac344-a8b1-4300...@googlegroups.com...
>> Let's suppose your computer has 4GB physical memory. Typically between
>> 2.5GB and 3.5GB of that memory is actually below the 4GB address point.
>> The
>> remaining typically starts at the 4GB address point. On this computer
>> you
>> could just sbrk() up to 4092K,
>> then touch the memory in order (first byte in each 4MB aligned page).
>
> I think what you want to express is: the remaining memory will be
> "re-mapped" to above 4GB address via sbrk(). Am I correct ?
No - DJGPP only works with 32-bit addresses. As far as it is concerned,
there is nothing beyond 4GB. PC hardware on the other hand typically stops
with memory at 3GB. CWSDPMI works with memory mapping via page tables, so
can collect memory from wherever it exists to make a virtual contiguous 4GB
address space (even if there are memory holes in the physical memory).
Even though memory is allocated it is not committed into memory until it is
accessed (which makes lots of sense in a tight memory system with paging to
disk, but provides weird physical mapping if unaware of this behavior -
pages may appear to not exist until they are touched).
The trick for knowing about memory over 4GB is looking at the page tables
(an Intel hardware feature). So DJGPP may say
that memory lives at the 3GB mark, but in reality the physical address is at
4GB.
>> If you then look at the physical map, you will very likely
>> have at least a 500MB buffer you can configure that actually is above the
>> 4GB address.
>
> Here "at least a 500MB buffer you can configure" means: application(or
> program) can access this buffer using "indirect" way, am I correct ?
> (where indirect way means you have to invoke api(or system call) to get
> pointer first, then access it...)
There are many ways to set up the mapping. Unless you have very specific
size needs the easiest way is to allocate
memory with sbrk() and look for the memory chunk above 4GB and use it. More
specific needs means more programming. In any case you just use an ordinary
pointer to access it under DJGPP.
> If above is correct, then can I get the "physical memory address" of that
> buffer ?
As referred to in the previous post, a modified copy of
http://homer.rice.edu/~sandmann/djgpp/cwsdma2.zip
would give you the physical memory mapping.
> (the reason I ask is: H/W DMA transfer requires only the physical memory
> address !)
Which is why the code above has the letters DMA in the title.