Virtual Adress Space

Hi all,

I always thought that Windows NT/2000/XP doesn’t allow access to the
physical hardware from a user-space application. And I guess, this is not
wrong generally :wink:

I have a 16bit application that reads the physical memory between 0-1MB ?
with success under Windows NT (I haven’t tried under 2000/XP yet).

When I try to compile this application as a 32 bit applicaion, I get a
protection fault ? ok, because I’ve tried to access the memory (that is
in fact virtual memory). I understand this…

But now the question: why can the 16bit application success? And is there
a simple way to do the save from a 32bit applicaion (as a regular user)?
Maybe there is a virtual address space range for “compatibility” with
16bit applications?

I hope someone can tell me so I don’t have to die dumb :slight_smile:

Thanks,
Michael

>I have a 16bit application that reads the physical memory between
0-1MB -

How have you managed to create a selector in Win16 app to point to
physical memory?

Max

Hi,

How have you managed to create a selector in Win16 app to point to
physical memory?

Oh, sorry, it is a 16bit **DOS** Application, not a Win16 Application.
Sorry, I forgot to mention that…

int main()
{
int loop1;
int loop2;
char huge *ptr;

for(ptr=0,loop1=0; loop1<1024; loop1++)
for(loop2=0; loop2<1024; loop2++,ptr=ptr+1)
if(memcmp(ptr, “SM”, 4) == 0)
printf(“SMBIOS found…\n”);

return(0);
}

Yes… I know that this peace of code can never run as a Win32-App, but
what I want to understand is:

Why is it running as a DOS-Application? Why doesn’t Win2k respond with a
GPF? Is there a virtual address range that maps the physical ram between
0-1 MB? And could I use this in a real Win32 App?

Bye
Michael

If I remember correctly, the WOW subsystem creates an environment that provides the virtual to physical mapping that is expected by 16 bit applications (i.e. it looks like a DOS physical environment). I believe your program will fault if it tries to access IO ports or memory mapped registers that have been claimed by an NT driver or kernel.

-----Original Message-----
From: Michael Knigge [mailto:xxxxx@gmx.de]
Sent: Wednesday, December 11, 2002 4:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Virtual Adress Space

Hi,

How have you managed to create a selector in Win16 app to point to
physical memory?

Oh, sorry, it is a 16bit **DOS** Application, not a Win16 Application.
Sorry, I forgot to mention that…

int main()
{
int loop1;
int loop2;
char huge *ptr;

for(ptr=0,loop1=0; loop1<1024; loop1++)
for(loop2=0; loop2<1024; loop2++,ptr=ptr+1)
if(memcmp(ptr, “SM”, 4) == 0)
printf(“SMBIOS found…\n”);

return(0);
}

Yes… I know that this peace of code can never run as a Win32-App, but
what I want to understand is:

Why is it running as a DOS-Application? Why doesn’t Win2k respond with a
GPF? Is there a virtual address range that maps the physical ram between
0-1 MB? And could I use this in a real Win32 App?

Bye
Michael


You are currently subscribed to ntdev as: xxxxx@infiniconsys.com
To unsubscribe send a blank email to %%email.unsub%%

>Why is it running as a DOS-Application? Why doesn’t Win2k respond
with a

GPF? Is there a virtual address range that maps the physical ram
between
0-1 MB?

Maybe it maps the BIOS, or maps some NTVDM’s BIOS emulation. Win32 app
will have nothing mapped in the first 1MB.

Max