Mail Archives: djgpp/1998/02/06/10:12:22
Fadi Rifai writes:
> I have allocated Memory space like these way:
>
> host_meminfo.size=2*_256Kbyte;
> if(__dpmi_allocate_memory(&host_meminfo)==-1){
> printf(" Allocating memory failed!\n",host_meminfo.size);
> exit(2);
> };
[...]
> How can I get the physical address of the memory base?
In general you cannot. This memory may not be a contiguous
block of physical addresses at all: it is quite likely to
be scattered around in many small pieces, some of which may
be swapped out to disk, and it can be moved around at any
point while your program is running.
If you can say exactly why you need to know this address,
someone will probably be able to suggest a better way of
doing this. For programming DMA transfers, which is the
most common reason people need to work with physical memory
addresses, by far the easiest solution is to use
__dpmi_allocate_dos_memory() to get a block of conventional
memory (in the first megabyte).
Shawn.
- Raw text -