| DOSferatu minneapolis, mn usa, 27.08.2010, 00:57 |
32bit pointers, GPFs and real mode (Developers) |
hi gang. I've got a real mode DOS app that I'm writing (x86 assembly) that needs to manipulate some data in 256k chunks. Since the data is larger than 64k segments, it's a bit of a pain to have to use normal ds/es segments and work on everything using 16 bit pointers. So, I switched to setting gs=0 and addressing things with gs:[esi] which is significantly easier. I'm not using memory above 1mb, and I don't really want to switch into unreal mode at the top of my program to be compatible on the most machines. The machine I first developed this code on had absolutely no problems doing all the work it needed to do, so I thought I was done. I run the program on a different machine, and I get a general protection fault (GPF) every time I try and access any 32bit pointer. I am admittedly *very* protected mode dumb, so my question are: 1) why does this work on some machines and not others? Are they already in unreal mode, left that way by the BIOS? 2) what is causing the GPF? I mean, is there a CPU register bit set or something in some GDT that is detecting this and causing it? 3) any other ways to do 32bit pointers? I don't want to use any libraries or extenders to do this work-the code is already 100% done, it just doesn't work the same on every platform. thanks! |
| DOS386 27.08.2010, 03:04 @ DOSferatu |
Don't do this!!! 32bit pointers, GPFs and real mode |
> So, I switched to setting gs=0 and addressing things with gs:[esi] which is
> significantly easier.
Don't do this. Real mode has a 64 KiB segment limit. Having (ESI+size)<=65535 will work but there is no point to do, just use plain SI.
> I'm not using memory above 1mb, and I don't really want to switch into
> unreal mode at the top of my program to be compatible on the most machines.
Removing 64 KiB segment limit needs at least 80386, sorry (so does GS).
> The machine I first developed this code on had absolutely no problems doing
> all the work it needed to do, so I thought I was done. I run the program
> on a different machine, and I get a general protection fault (GPF) every
> time I try and access any 32bit pointer.
> I am admittedly *very* protected mode dumb, so my question are:
> 1) why does this work on some machines and not others? Are they already in
> unreal mode, left that way by the BIOS?
Someone (most likely BIOS or XMS host) left the unreal mode enabled.
> 2) what is causing the GPF? I mean, is there a CPU register bit set or
> something in some GDT that is detecting this and causing it?
64 KiB segment limit, stored in the "hidden part" of segment registers.
> 3) any other ways to do 32bit pointers? I don't want to use any libraries
> or extenders to do this work-the code is already 100% done, it just doesn't
> work the same on every platform.
What does the code do ? To remove the 64 KiB segment limit, you MUST set up PM or unreal mode some way, sorry (and preferably check for 80386 before using any 8086-incompatible instruction). Relying on "someone" enabling the unreal mode for you is a very bad idea. Also ASS'uming "code 100% done" and then finding a horrible bug needing to rewrite 99% of the code to fix it is a "known issue". --- |
| DOSferatu minneapolis, mn usa, 27.08.2010, 19:27 @ DOS386 |
Don't do this!!! 32bit pointers, GPFs and real mode |
>
> Removing 64 KiB segment limit needs at least 80386, sorry (so does GS).
that's ok. this code is only used on pentium class machines.
>
> What does the code do ? To remove the 64 KiB segment limit, you MUST
it's an internal program for my work, so it is in a very controlled environment. You will never run this code. |
| DOS386 28.08.2010, 01:09 @ DOSferatu |
Don't do this!!! 32bit pointers, GPFs and real mode |
> The compatibility issue that I'm worried about is that it seems that a "dos
> boot disk" as prepared by later versions of windows
don't use such "DOS" --- |
| bretjohn Rio Rancho, NM, 29.08.2010, 17:59 @ DOSferatu |
32bit pointers, GPFs and real mode |
> the code is already 100% done, it just doesn't work the same on every
> platform.
Well, then, apparently it's not 100% done. |
Thread view
P.S. what about the updated sound stuff ? I never got any mail except one with very little text and no attach.
It may be used on a variety of motherboards, but I know that they are all new machines.
???
