Mail Archives: djgpp/2006/11/09/06:03:57
"James" <countingtoten AT gmail DOT com> wrote in message
news:1162922909 DOT 133028 DOT 98340 AT f16g2000cwb DOT googlegroups DOT com...
> Charles Sandmann wrote:
> > > I am trying to access the memory address 0x3FFF0000 in DOS using dpmi.
> > ..
> > > buffer[0] = _farpeekb(selector, mi.address);
> >
> > mi.address should be 0 here, since the offset is built into the selector
> > you just set up
>
> I tried that and still receive the same error message.
>
That's really strange, because that's the only error I could find. The
offset, where you have mi.address, should be between 0 to 0xfff (segment
limit-1).
buffer[0] = _farpeekb(selector, 0);
Perhaps, you're using a RM address currently and tripping the same line in
the RM section?
Your PM code should work for address below 1Mb as long as you don't call
__dpmi_physical_address_mapping (shouldn't be used below 1Mb per DPMI
specs.). I commented out the RM section, the
__dpmi_physical_address_mapping, and then used mi.address = 0xB8000
(screen), and added a _farpokeb(selector, 0, 0x66) which output to the
screen. I also added the physical address mapping back w/0x3FFF0000 and no
longer received the SIGSEGV.
What OS are you running the code under? RM DOS, FreeDOS, Win3.1/95/98/2k
console, WinNT/2k/XP console, Linux/DOSEMU? Are you running the code under
an emulator (Bochs, QEMU, etc.)?
Also, do you want 1Gb-1 (0x3FFF0000) or 256Kb-16 (3FFF:0000h, i.e.,
0x0003FFF0) ? Most memory mapped devices are usually mapped below 1Mb.
From this (first post):
> fs: sel=01cf base=3fff0000 limit=00000fff
The fs selector is set to what you coded, but it doesn't show the access
rights...
If you're still having problems, I'd recommend adding a call to
__dpmi_set_descriptor_access_rights and moving the
__dpmi_physical_address_mapping call after the
__dpmi_allocate_ldt_descriptors call.
__dpmi_set_descriptor_access_rights(selector,0xC0F3) /* need to check value
for your segment */
I'd recommend reading the last two paragraphs of the first post of mine, and
all of the second.
http://groups.google.com/group/comp.os.msdos.djgpp/msg/fa3f19efbcba7754?hl=en
http://groups.google.com/group/comp.os.msdos.djgpp/msg/3b2927a76908742a?hl=en
Rod Pemberton
- Raw text -