Mail Archives: djgpp/1999/10/05/03:40:49
--- Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> > I mapped the entire extended memory (my RAM size
> -
> > 1M) to some variable "x". I'm using nearptr. But I
> get
> > a SIGSEGV when I try to access the address
> > x[__djgpp_base_address].
>
> Please post a short complete test program that shows
> how do you do this.
> It is possible that you didn't do everything to
> allow access to all
> memory.
>
Hi Eli,
This is the code I have problems with.
#include <stdio.h>
#include <stdlib.h>
#include <dpmi.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/nearptr.h>
#include <sys/farptr.h>
int main()
{
char *base;
// Prints "Nearptr enabled".
printf("Nearptr %s\n", (__djgpp_nearptr_enable()) ?
"Enabled" : "Disabled");
base = (char *)(__djgpp_conventional_base);
// Map extended memory to &base[0x100000].
printf("Physical mapping %s\n",
(!__djgpp_map_physical_memory(&base[0x100000],
0x3f00000, 0x100000)) ?
"OK" : "failed");
// I have 64MB RAM. Prints "Physical mapping OK".
// Even this doesn't help.
// mprotect(&base[__djgpp_base_address], 0x100000,
PROT_NONE);
base[0x2000000] = base[0x2000000]; // This works.
(32MB)
// Debugging this with FSDB shows that reading the
memory causes the exception.
base[__djgpp_base_address] =
base[__djgpp_base_address]; // Causes SIGSEGV.
return 0;
}
> > I know it's in use by the
> > program code, but is there a work around to this ?
>
> Work-around for what? If you did everything
> correctly, you should be
> able to access the program's code without a SIGSEGV.
>
I mentioned this because in the previous mail you told
me that you can access all physical memory _except_
the portion in use by the code and the DPMI host.
This seems true. I'm having trouble here.
Thanks,
Prashant TR
=====
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
- Raw text -