Mail Archives: djgpp/2002/02/06/03:05:32
On Wed, 6 Feb 2002, hskim wrote:
> meminfo.handle = 0xf5800000;
> meminfo.size = 0x200000;
> meminfo.address = 0;
>
> nRet = __dpmi_physical_address_mapping(&meminfo);
>
> printf("Result = %d, %08x,%08x,%08x\n",
> nRet,
> meminfo.handle,
> meminfo.size,
> meminfo.address);
> if (nRet)
> return;
>
> p = meminfo.address;
>
> p[0] = 0; // program is crashed!
That's because you didn't allocate a selector for accessing this
memory, and didn't set up that selecor's segment to span the range of
addresses you want to access. __dpmi_physical_address_mapping only
creates a mapping between physical addresses and logical addresses,
but doesn't provide a selector to access the mapped memory.
See section 18.7 of the DJGPP FAQ list, it shows a skeleton of code
that does all of the above.
- Raw text -