Category Archives: programming

Entry into os2ldr

Using Bochs I have the entry values into os2ldr when booted with BootJFS. One important note is that any of the filetable structure len fields will depend on the module version. Also, the 0x8800 segment might vary with machine types in the real world. It is calculated:

  1. uses INT 12 to find the top of low memory in continuous 1k blocks
  2. subtract 0x54
  3. AND with 0xFFF0
  4. Shift left 6

DX == 0x1480 (00010100 10000000)
DH boot mode flags == mini-FSD is present, micro-FSD is present
DL drive number for the boot disk == 0x80

DS:SI is a pointer to the BOOT Media’s BPB 8800:000B (0x8800B)

ES:DI pointer to a filetable structure 8800:124A (0x8924A), filetable structure has the following format:

; module locations

8924A ft_cfiles dw 3
8924C ft_ldrseg dw 0x1000
8924E ft_ldrlen dd 0x0000AE00
89252 ft_museg dw 0x8800
89254 ft_mulen dd 0x00005000
89258 ft_mfsseg dw 0x7C00
8925A ft_mfslen dd 0x0000EAE9
8925E ft_ripseg dw 0
89260 ft_riplen dd 0

; microFSD vector table

89264 ft_muOpen_OFF dw 0x1A9C
89266 ft_muOpen_SEG dw 0x8800
89268 ft_muRead_OFF dw 0x1BD4
8926A ft_muRead_SEG dw 0x8800
8926C ft_muClose_OFF dw 0x1DAE
8926E ft_muClose_SEG dw 0x8800
89270 ft_muTerminate_OFF dw 0x1DD4
89272 ft_muTerminate_SEG dw 0x8800

ah… BootJFS and the process

I’m going to plagiarize from www.osfree.org and modify the text to fit my adventures with BootJFS.

At the end of POST procedure the ROM BIOS initializes devices and gives control to int 19h interrupt routine, which loads 1st sector of the 1st boot device (a floopy, HDD or another). If the device was the HDD, then the Master boot record (MBR) is loaded from the 1st sector. The ROM BIOS loads it at address 07C0:0000. The MBR has a Non-System Bootstrap (NSB) routine in it, and the Partition Table (PT). The NSB code relocates MBR to 07E0:0000, jumps to 07E0:0020 and checks for a Boot Manager partition, and checks for a bootable partition on the first or second disk if present. Next the bootsector of boot HDD partition is loaded at 07C0:0000.

One of the interesting things that happens is the following:

1. Find the top continuous low memory (conventional 640k), number of 1K blocks. On my Bochs drive 639 is returned.

2. Calculate a load segment. The result of #1 – 54h, AND result with FFF0h, and then shifted left 6 bits. This will be the load segment and with the Bochs drive equates to 8800.

3. The bootsector of boot HDD plus an additional 31 sectors are loaded at the address (segment) calculated in #2, approximately 16K.

4. A jump to the segment from #2 offset 199Ch is made.

Now things have and continue to divert from IBM documentation. The code loaded in #3 contains MicroFSD. It loads os2boot and os2ldr using MicroFSD functions, which look like C code. Finally, the structure and registers are setup for entry into os2ldr.

One of my issues is that the structure I am finding does not seem to match documentation:

124A ft_cfiles dw 0
124C ft_ldrseg dw 0
124E ft_ldrlen dd 0
1252 ft_museg dw 0
1254 ft_mulen dd 0
1258 ft_mfsseg dw 0
125A ft_mfslen dd 0
125E ft_ripseg dw 0
1260 ft_riplen dw 0
1262 db 0
1263 db 0

; microFSD vector table
12641264 ft_muOpen_OFF dw 0
1266 ft_muOpen_SEG dw 0
1268 ft_muRead_OFF dw 0
126A ft_muRead_SEG dw 0
126C ft_muClose_OFF dw 0
126E ft_muClose_SEG dw 0
1270 ft_muTerminate_OFF dw 0
1272 ft_muTerminate_SEG dw 0

Notice 1262h and 1263h, I do not know what they are used for…

Easy gcc build environment

Open Office for eCS-OS/2 2.4 Beta1 is available (news post) and I installed it on my old SMP PIII box. Seems to work well! I guess the big milestone was just getting it going in the previous version.

Also, Pasha has his updated os2ldr on hobbes (here). No chance to try it yet, but I wish it was open source. Guess that is up to ecomstation.ru.

I am in the process of rebuilding my sandbox system and I reached the point where I setup the gcc environment. The easiest way to do this, especially since I rarely use gcc, is to use Paul Smedley’s build environment, currently buildenv_20071022.zip and a size of 234,635,207 bytes.

I know Paul has it on his U: drive and that the setup could be changed to use another drive, but I don’t want to invest the time. So, I created a U: drive during the system setup.

First thing to do was to unzip the file. A quick dir /s gave me the unarchived space required:

686,439,038 bytes in 26,738 files and 8,057 dirs

So, plan ahead because the zip file contains gcc, qt, perl, and all kinds of other libraries and executables.

First thing was to cd into extraslib and run makeomflibs, as instructed on Paul’s site. I got this at the end but I believe it is expected:

warning: one or more operations failed, check the above output. :-).

Also, if you look in gcc335.cmd there are a bunch of e:python25 statements, but python is not in the zip archive. I just grabbed Paul’s Python v2.5.1 for OS/2 & eComStation. I just did:

unzip python-2.5.1-os2-20071223.zip

and changed the references in gcc335.cmd from e: to u:.

With that done I gave it an easy test, compiling nasm-2.02. I first ran sh ./configure
and after it finished make. The problem I ran into is that Paul’s gcc335.cmd defines tmp to u:tmp which did not exist:

‘set tmp=u:/tmp’
‘SET TEMP=%TMP%’
‘SET TMPDIR=%TMP%’

I thought it was a good idea to keep the tmp drive on u: for my gcc stuff so a quick md tmp and I was off to run make again. The result was an complete nasm.exe build so I was happy.

Things to note: Paul has a newer version of perl on his site and I think qt has been updated, but I have yet to download them. There may even be an updated gcc package on netlabs by now.

Anyway, that’s it – short and sweet. Thanks to both Knut and Paul.

Other stuff:
100,000 customers tell Microsoft to save XP

Subversion hosting – free

I decided to try the free hosting provided by assembla. The first project I committed is rexxutil located here:

WIKI: http://www.assembla.com/wiki/show/rexxutil
TRAC: http://trac2.assembla.com/rexxutil
SVN: http://svn2.assembla.com/svn/rexxutil

Some misc blogs with recent OS/2-eCS content:

Storm…

Lucky me! While I was out of town Tuesday night we had the mother of all storms. It didn’t whack me through the power cords, but rather through a hub. My 8 port hub was fried and every network item attached to it was trashed. This includes the network card on my old server, the network connection on the old MPro, a 5 port hub, and (Damn it!) the network connection on the xbox 360. So, I have been recovering the last couple days.

But, on the bright side Brendan released uniaud rc3. This comes after a lot of work and testing by Allan, Andy, Steven and others. My build system for uniaud16 was committed using all Open Watcom tools. But all the credit goes to Brendan who picked up this project.

Last, Open Watcom 1.7 has been released! In a world of gcc, Open Watcom is a breath of fresh air…