On Wed, 10 May 2006, Johnson Lam wrote:

Quote a few lines from his email:

=====
I did not "model" QHIMEM after Microsoft HIMEM V2.03, like you know.
QHIMEM's source or binary files are very different from V2.03 HIMEM.
Disassemblies may only confuse folks.   But they are welcome to try.
=====

Hey, I always like a challenge, so if I was welcome to try, I disassembled a bit.

Some observations:

QHIMEM is indeed not modelled after MS HIMEM. You can see that the MS source has been referenced, e.g. in the algorithm for allocating an EMB (very similar) and how to decide when to use PS/2 A20 switching (the "MCA" bit for int15/ah=c0). It certainly doesn't have a "clean-room" feel (purely coded from XMS spec), but that may not be necessary.

Just like FD-HIMEM and FDXMS it either uses INT15/AH=87, or temporarily switches to protected mode (almost the same GDT setup) to copy. However, and that is what the interrupt stuff is all about, it copies in chunks of 8K: for every 8K it returns to real mode, STI's, CLI's and gets back into protected mode. QHIMEM, unlike MS-HIMEM, does not use flat real mode (aka unreal mode).

I'm not sure where Jack got the 8K from -- maybe the timing on the slowest possible machine (386SX 16MHz) has something to do with it.

The value for int15/87 is 1K, where FD-HIMEM and FDXMS use 8K chunks.

QHIMEM uses a few tricks to save memory, e.g.:
* the KBD A20 switching code is overwritten with PS/2 A20 switching code
  when necessary
* eax is initialized to 0 and is exploited that way (saves 1-3 bytes in
  various asm instructions, versus an immediate 0 operand)
* comparisons versus number of handles are patched in the code to save on
  an extra variable in the data segment
* the XMS spec requires that " In order to maintain compatibility with
  existing device drivers, DOS XMS drivers must not hook INT 15h until
  the first non-Version Number call to the control function is made."
  the "hook int15" code + various other delayed init code is copied to
  (hardcoded) segment 0x7030, and called from there so it does not stay
  resident.
  This is somewhat risky: it relies on the fact that the DOS kernel does
  not overwrite anything there, and will make XMS calls itself.
  That usually happens, or QHIMEM would crash.
  Segment 7030 is also used for communication between QHMBOOT and QHIMEM.

That's the gist of it, at least from my mileage.

Bart


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to