Tag Archives: os2ldr

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.

Study of the OS/2-eCS Boot Process

Published by mgreene on 05/21/2008 – 00:00

My OS/2-eCS boot process notes using Bootable JFS.

My main point of curiosity is the operation of the os2ldr file and I found that it is hard to get far without understanding the steps getting to executing os2ldr. The point leading up to os2ldr is considered the “Black Box” because there are a number of ways to boot eCS-OS/2 for example FAT, IFS, or Remote IPL. The major issue is that the “Black Box” sets up the system and provides all information os2ldr requires.

Just for by own interest I pulled the MBR from my eCS 2.0 RC4 driving using DFSee and disassembled. What follows is the result and some comments from noted sources. Since I am not very good at reading decompiled code I went to the next level, trying to step through the boot using a MBR, BPB and os2boot running in Bochs on my one of my Linux systems.

I found an old 630 meg IDE hard drive and installed in the system. The system was booted using the current eCS 2.0 RC4 CD. I then ran LVM and made bootable compatible partition and wrote the MBR. Next, I did a long JFS format of the partition and then ran sysinstx.com against it to get os2boot installed. I did forget to set the partition active, but later corrected using DFSee. The hard drive was pulled and install in my LINUX system and I used dd to image the drive.

This image will boot through the running of os2boot, but will quit due to the lack of an os2ldr file. That will come later. So if anyone is interested the image can be downloaded here: harddrive.zip When setting up in Bochs the correct drive settings are 1240 cyl 16 heads 63 sectors. Here is a quick howto in getting started with Bochs.

This is a work in progress, subject to change daily. It is for my own information and if it helps or be an interest others then that would be a bonus.

Changes

21 May 2008:
I updated my Bochs image with the UNI os2ldr and os2krnl from the eCS RC4. These are not the latest but I can trace from boot through os2ldr. The file is 1.6 meg and unzips to 630 Meg and can be downloaded here: newdrive.zip.

Note!!! download DFSee iso and boot it as the CDROM to set the hard drive image active if it will not boot.