[comp.os.minix] Running 32-bit software under a 16-bit kernel

HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (01/07/91)

I want to let 32-bit software run under a 32-bit kernel.
This is what I did:
   - changed 'int' to 'short' in the message structs
   - changed catchsig.s crtso.s etc

It works well, but I think read() and write() are problematic since
read(fd,buf, 100000) will fail.

Am I correct that read and write are the only problematic calls?
file descriptors, m_type etc can safely be short.

If I am correct, it might be useful to have wrappers that divide a long
read request into shorter ones.
C.v.W.

MDOELL%DOSUNI1.BITNET@cunyvm.cuny.edu (Magnus Doell) (01/09/91)

On Mon, 7 Jan 91 12:55:26 GMT Christoph van Wuellen said:

>I want to let 32-bit software run under a 32-bit kernel.

Why that? The other way round seems to be OK but I guess that a 16-bit
kernel couldn't manage a 32-bit process or you have to restrict the
32-bit process in size and (for the Intel 386) in the instruction set.
But then you will loose most of the reasons for 32-bit processes, won't you?

>Am I correct that read and write are the only problematic calls?
>file descriptors, m_type etc can safely be short.

Changing some types from int to short isn't enough. 32-bit compilers will
normally align their data to 32-bit boundaries so it might be impossible
to simulate a 16-bit structure with a 32-bit compiler due to the 32-bit
padding without using some dirty tricks.
Although this isn't the case for ordinary message structures it may (and
do) happen in structures passed by pointers. While implementing the other
way round (that is running 16-bit processes under a 32-bit OS) I found this
problem with the stat-structure. Fortunately this padding problem within
the stat structure could be easily solved by rearranging the structure
and correcting some types to what they should be. Unfortunately the binary
compatibility will be lost at that moment. Fortunately again the only bin-only
program (that is the MINIX c-compiler) didn't use the stat or fstat-call
(but the ANSI c-compiler will contain aal which uses them? :-(). Unfortunately
again their are some programs using these system calls, which aren't easily
compilable with vanilla MINIX 1.5 (PC) :-(, so ... (I don't support these
system-calls for foreign processes with my special 32-bit OS).

Ma.D.

P.S.: For a deeper discussion mail me direct.

-------------------------------------------------------------
Magnus Doell                   <MDOELL@DOSUNI1.BITNET>
Parkstr. 7a
D-4500 Osnabrueck (Germany)