Mail Archives: djgpp/2008/03/30/18:45:54
"James" <countingtoten AT gmail DOT com> wrote in message
news:c76e39a6-8268-4d92-9ed7-f4a8eaf568f6 AT m36g2000hse DOT googlegroups DOT com...
> When I try to read a memory address higher than 0xFFFFF000 directly
> using DJGPP in DOS the program seg faults, but if I step up to that
> address by reading the addresses before it, the program works fine.
> Why does stepping up to the address work but not reading the address
> directly and is there a fix to just read the address directly?
>
Have you found the problem or a solution?
After adding includes, a main(), and the declaration for selector:
unsigned short selector;
I was able to get it to compile. I wasn't seeing the SIGSEGV in MS-DOS. I
was able to get it to fault in a Windows 98 SE dos console. I also changed
x to an unsigned long and checked all the dpmi calls for -1 error...
Of course, when the app is run in Windows it's not using CWSDPMI, but
Windows' internal DPMI... Unfortunately, my machine seems to SIGSEGV for
any address over 1Mb + 144k (wierd...), not just those around 0xFFFFF000. I
don't have time to look at it further for a while. I'm assuming it's some
other protection related mechanism to prevent access to Windows code or non
existant memory. Maybe the memory just needs to be mapped into Windows
paging tables somehow...
However, I did come across something else that was interesting. When I
added a call to __dpmi_set_descriptor_access_rights(), and it didn't fix the
problem, I decided to see what values where actually being set for the
selector (my own trusted assembly, not DJGPP). It turns out the way you
have the dpmi calls ordered, that Windows doesn't set the requested base
address. It kept setting the upper three nybbles of the base address to
0xC4_ (forget the third) instead 0xfff. The only way I could get Windows 98
SE to set the base address of the selector to the value passed to
__dpmi_set_segment_base_address(), was to reorder the dpmi calls like so:
__dpmi_allocate_ldt_descriptors()
__dpmi_set_descriptor_access_rights()
__dpmi_set_segment_base_address()
__dpmi_set_segment_limit()
__dpmi_physical_address_mapping()
Rod Pemberton
- Raw text -