www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/06/10:12:22

Message-ID: <D1FB30BBA491D1118E6D006097BCAE39082D08@Probe-nt-2a.Probe.co.uk>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: phys. & linear addressing?
Date: Fri, 6 Feb 1998 15:10:33 -0000
MIME-Version: 1.0

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 -


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