os2ldr entry values

Using the Bochs image the entry values for os2ldr are:

eax: 0x00000000
ecx: 0x00000000
edx: 0x00001480
ebx: 0x00000000
esp: 0x00005000
ebp: 0x00000000
esi: 0xFFFF000B
edi: 0x0000124A
eip: 0x00000000
eflags 0x00000246
IOPL=0 id vip vif ac vm rf nt of df IF tf sf ZF af PF cf
cs:s=0x1000, dl=0x0000ffff, dh=0x00009b01, valid=1
ds:s=0x8800, dl=0x8000ffff, dh=0x00009308, valid=7
ss:s=0x8800, dl=0x8000ffff, dh=0x00009308, valid=7
es:s=0x8800, dl=0x8000ffff, dh=0x00009308, valid=1
fs:s=0x3000, dl=0x0000ffff, dh=0x00009303, valid=7
gs:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=1
ldtr:s=0x0000, dl=0x0000ffff, dh=0x00008200, valid=1
tr:s=0x0000, dl=0x0000ffff, dh=0x00008300, valid=1
gdtr:base=0x000faeb2, limit=0x30
idtr:base=0x00000000, limit=0x3ff

DH boot mode flags:

  • bit 0 (NOVOLIO) on indicates that the mini-FSD does not use MFSH_DOVOLIO.
  • bit 1 (RIPL) on indicates that boot volume is not local (RIPL boot)
  • bit 2 (MINIFSD) on indicates that a mini-FSD is present.
  • bit 3 (RESERVED)
  • bit 4 (MICROFSD) on indicates that a micro-FSD is present.
  • bits 5-7 are reserved and MUST be zero.
DH = b X X X 1 X 1 0 0 = MINIFSD | MICROFSD

DL drive number for the boot disk. This parameter is ignored if either the NOVOLIO or MINIFSD bits are zero. 

DL = b 10000000 = 0x80

DS:SI is a pointer to the BOOT Media’s BPB. This parameter is ignored if either the NOVOLIO or MINIFSD bits are zero. 

8800:000B (0x8800B)

ES:DI is a pointer to a filetable structure. 

8800:124A (0x8924A)

The filetable structure has the following format:

struct FileTable {
    unsigned short ft_cfiles; /* # of entries in this table             */
    unsigned short ft_ldrseg; /* paragraph # where OS2LDR is loaded     */
    unsigned long  ft_ldrlen; /* length of OS2LDR in bytes              */
    unsigned short ft_museg;  /* paragraph # where microFSD is loaded   */
    unsigned long  ft_mulen;  /* length of microFSD in bytes            */
    unsigned short ft_mfsseg; /* paragraph # where miniFSD is loaded    */
    unsigned long  ft_mfslen; /* length of miniFSD in bytes             */
    unsigned short ft_ripseg; /* paragraph # where RIPL data is loaded  */
    unsigned long  ft_riplen; /* length of RIPL data in bytes           */
    /* The next four elements are 16:16 pointers to microFSD entry points     */
    unsigned short (far *ft_muOpen) (char far *pName, unsigned long far *pulFileSize);
    unsigned long (far *ft_muRead) (long loffseek, char far *pBuf, unsigned long cbBuf);
    unsigned long (far *ft_muClose)(void);
    unsigned long (far *ft_muTerminate)(void);
}

Bochs values:

filetable structure value
ft_cfiles 0x0003
ft_ldrseg 0x1000
ft_ldrlen 0x0000A800
ft_museg 0x8800
ft_mulen 0x00005000
ft_mfsseg 0x007C
ft_mfslen 0x0000EAE9
ft_ripseg 0x0000
ft_riplen 0x00000000
ft_muOpen 8800:1A9C
ft_muRead 8800:1BD4
ft_muClose 8800:1DAE
ft_muTerminate 8800:1DD4

The microFSD entry points interface is defined as follows:
mu_Open – is passed a far pointer to name of file to be opened and a far pointer to a ULONG to return the file’s size. The returned value (in AX) indicates success(0) or failure(non-0).
mu_Read – is passed a seek offset, a far pointer to a data buffer, and the size of the data buffer. The returned value(in DX:AX) indicates the number of bytes actually read.
mu_Close – has no parameters and expects no return value. It is a signal to the micro-FSD that the loader is done reading the current file.
mu_Terminate – has no parameters and expects no return value. It is a signal to the micro-FSD that the loader has finished reading the boot drive.
The loader will call the micro-FSD in a Open-Read-Read-….-Read-Close sequence with each file read in from the boot drive.