[comp.os.minix] Minix compiles under Microsoft C 4.0!

ericr@ipmoea.UUCP (Eric Roskos) (07/24/87)

Good news!  After many *days* of work, I finally have Minix compiling and
booting using Microsoft C 4.0, compiling it under DOS.  I have recompiled
the entire OS (everything).  The resulting load image (including fsck) is
113536 bytes, compared to 115888 on the shipped boot disk; this is when
it's compiled with the /Ox optimization option.

You'll recall that when I last posted, I couldn't get it to boot, due to
some strange problem where the boot loader was loading blocks in a permuted
order.  As I suspected, this turned out to be because build wasn't writing
the sectors in the same order the boot loader expected them.  I am not sure
why this is; maybe build was written under a different version of DOS, which
wrote the sectors in a different physical order from DOS 3.2.

I fixed this problem by writing DOS-independent absread and abswrite routines,
and including them in build.c.  They are written in C; I'll post them in
a few days, as soon as I get things cleaned up.  They do use MSC's "int86"
routine to generate the call to the BIOS, though.  Apparently the absread
and abswrite in the diskio.asm file that comes with Minix (in the C86
directory) will *not* work with MS-DOS 3.2.  I couldn't test it with DOS 2.0,
since my hard disk is formatted with DOS 3.2 and is not readable with 2.0.

I determined that the sectors were in the wrong order by reading the shipped
Minix boot disk's boot block, calculating the sector and offset for fsck,
and then reading the first block of fsck.  When I looked at this with the
debugger, I got a sector that had been formatted and never written!  Since
the debugger uses the same DOS calls that absread and abswrite uses, this
was a definite indication that something was different.  So I rewrote the
routines using the same sector numbering the Minix boot block uses.

There were a fairly large number of changes which I made in order to get
Minix to compile under MSC; I am not sure what the best way to post these
would be, or if there is sufficient interest (I've gotten about 5 queries
about it so far).  I think it would be best to post the files mpx88.asm,
klib88.asm, prologue.h, and the new absio routines for build.c; would that
be a reasonable (and permissible) thing to do?  Some of the changes I made
were things like rearranging the order in which segments occurred in
the .ASM files, in order to eliminate forward references and to make some
debug macros I wrote work (they inserted things into the data segment, so
the data segment had to appear before the code segment), so a simple "diff"
would have a lot of changes just due to rearrangement.  However, if it is
not permissible to post these files, I can make a diff (or just a verbal
description of the changes)...

In any case, I'll post a *summary* of the changes & problem areas sometime
this weekend.

Now if I can only get it to work with my disk controller...

-- Eric Roskos
   uw-beaver!tikal!amc!ipmoea!ericr