Hi, I should have known that it was all in SDA... In MS DOS, SDA is
at dosds:320, so I have an instant explanation for "saveds", "savebx",
"user id", "computer id", "psp vs user id" and several other questions.

Format of DOS 4.0-6.0 swappable data area:
Offset  Size    Description     (Table 01690)
...
 -11  5 WORDs   zero-terminated list of offsets which need to be patched to
                  enable critical-section calls (see INT 2A/AH=80h)
                (all offsets are 0D0Ch, but this list is still present for
                  DOS 3.x compatibility)
...
---start of actual SDA---
 00h    BYTE    critical error flag ("ErrorMode")
 01h    BYTE    InDOS flag (count of active INT 21 calls)
 02h    BYTE    drive on which current critical error occurred or FFh
                (DR DOS 3.41/5.0 set this to 00h when no critical error)
 03h    BYTE    locus of last error
...
 10h    WORD    current PSP
...
---remainder need only be swapped if in DOS---
 1Ah    WORD    value of AX on call to INT 21
                Note:   does not contain correct value on functions 00h-0Ch,
                          50h, 51h, 59h, or 62h                 
 1Ch    WORD    PSP segment for sharing/network (0000h = local)
 1Eh    WORD    network machine number for sharing/network (0000h = local)
...
 92h  3 BYTEs   24-bit user number (see AH=30h)
 95h    BYTE    OEM number (see #01394 at AH=30h)
...
27Eh    DWORD   pointer to current SFT
282h    DWORD   pointer to current directory structure for drive being accessed
...
(then you have many things which smell like fnode contents)
...
2C6h    DWORD   pointer to working SFT
2CAh    WORD    used by INT 21 dispatcher to store caller's BX
2CCh    WORD    used by INT 21 dispatcher to store caller's DS
2CEh    WORD    temporary storage while saving/restoring caller's registers
2D0h    DWORD   pointer to prev call frame (offset 264h) if INT 21 reentered
                also switched to for duration of INT 24
...

In other words:
SAVEDS = SDA[2cc]
SAVEBX = SDA[2ce]
userid = SDA[1c]
         (and PSP has indeed a separate variable)
INDOS  = SDA[1]
CritSectPatchTable = SDA[-b]
... so in fact int 2f.1607.15.0 just returns a pick of SDA values!
In Toms 2035 version, SDA[-b] are already 4 times d0c *BUT* there is
the bug that instead of the terminating 0 WORD there is ANOTHER d0c word.
The userid word is called owning_psp, and the machine id is _MachineId.
The SAVEDS / SAVEBX are in a hole between _current_filepos and _prev_user_r,
so we could fill the hole and add them.
And of course there is _InDOS :-).
As we have no real int 21.5dxx support yet, it seems, owning_psp is never
touched and just stays 0 (meaning "local"). _MachineId is pushed / popped
around calls to int 28 (in _DosIdle_int) and around int 24 calls (in
_CriticalError). but apart from that, again nothing really uses _MachineId.


Dosds:aac is the first byte after the (quite long) SDA, finally.

Really weird that DOSes have to clone more or less the entire
data segment of MS DOS, although different implementations would
often be far more straightforward, and although this means
that you sometimes have to pipeline values through LoL / SDA for
no good reason apart from being compatible to undocumented DOS.

Eric


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to