X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: Accessing absolute address above 1MB Date: Thu, 9 Nov 2006 05:57:10 -0500 Organization: experimental IPv6 InterNetNews for thur.de Lines: 61 Message-ID: References: <1162915098 DOT 476438 DOT 52420 AT k70g2000cwa DOT googlegroups DOT com> <4550adea DOT sandmann AT clio DOT rice DOT edu> <1162922909 DOT 133028 DOT 98340 AT f16g2000cwb DOT googlegroups DOT com> NNTP-Posting-Host: c-68-60-59-250.hsd1.mi.comcast.net X-Trace: ltw.loris.tv 1163069834 6004 68.60.59.250 (9 Nov 2006 10:57:14 GMT) X-Complaints-To: usenet AT news DOT erfurt DOT thur DOT de NNTP-Posting-Date: Thu, 9 Nov 2006 10:57:14 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "James" 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