[comp.os.xinu] XINU on 80286 in protected mode

csgr@alpha.cs.ru.ac.za (Geoff Rehmet) (05/13/91)

I am at the moment looking into porting the PX-XINU sources to the
80286 running in protected mode, with the intention of making use
of the 286's hardware task management and memory protection features.

A major problem which I forsee is in compiling the XINU C sources, as
I do not have a C compiler available for the 80286.  (The main problem
is that existing C compilers generate code which will run fine in real mode
but which does not handle the 286's memory management features - resulting
in problems with segment references.)

(I have thought of tricks such as modifying the objects and executables
generated by existing DOS C compilers, such as Turbo C, but I would like
to try and find a cleaner method.)

I was wandering if anybody else had looked into the idea of porting XINU
to the 80286, and if so, if they have any suggestions on how I could get
around the problem of compiling the C sources.  (I do not have a problem
of getting into protected mode as such, as I have the beginnings of a 
protected mode bios under development.)

Any suggestions would be welcomed.

Thanks.

Cheers, Geoff.

--
===============================================================================
 Geoff Rehmet, Botha House,    |Internet : csgr@alpha.cs.ru.ac.za 
 Private Bag 1028,             |uucp     : ..uunet!m2xenix!quagga!alpha!csgr
 Grahamstown, 6140, RSA        +----------------------------------------------

erick@sunee.waterloo.edu (Erick Engelke) (05/14/91)

In article <csgr.674122345@alpha> csgr@alpha.cs.ru.ac.za (Geoff Rehmet) writes:
>I am at the moment looking into porting the PX-XINU sources to the
>80286 running in protected mode, with the intention of making use
>of the 286's hardware task management and memory protection features.
>
>A major problem which I forsee is in compiling the XINU C sources, as
>I do not have a C compiler available for the 80286.  (The main problem
>is that existing C compilers generate code which will run fine in real mode
>but which does not handle the 286's memory management features - resulting
>in problems with segment references.)
>
>(I have thought of tricks such as modifying the objects and executables
>generated by existing DOS C compilers, such as Turbo C, but I would like
>to try and find a cleaner method.)
>
>I was wandering if anybody else had looked into the idea of porting XINU
>to the 80286, and if so, if they have any suggestions on how I could get
>around the problem of compiling the C sources.  (I do not have a problem
>of getting into protected mode as such, as I have the beginnings of a 
>protected mode bios under development.)
>
>Cheers, Geoff.
>

Try the Lattice C 286 compiler.  I believe it does exactly what you are
asking.  It generates code which can access full 286 memory, and is 
not just the word alignment and enter/leave calls enhacement of other
C compilers.  I have not used it, I'm mentioning this on memory of a
much relieved friend.
 
Erick

-- 
----------------------------------------------------------------------------
Erick Engelke                                       Watstar Computer Network
Watstar Network Guy                                   University of Waterloo
Erick@Development.Watstar.UWaterloo.ca              (519) 885-1211 Ext. 2965

stuebing@eniac.fmi.uni-passau.de (Andreas Stuebinger) (05/15/91)

Hello,

In article <csgr.674122345@alpha> csgr@alpha.cs.ru.ac.za (Geoff Rehmet) writes:
>I am at the moment looking into porting the PX-XINU sources to the
>80286 running in protected mode, with the intention of making use
>of the 286's hardware task management and memory protection features.
>
>A major problem which I forsee is in compiling the XINU C sources, as
>I do not have a C compiler available for the 80286.  (The main problem
>is that existing C compilers generate code which will run fine in real mode
>but which does not handle the 286's memory management features - resulting
>in problems with segment references.)
It's possible to do a port of PC-XINU into 80286 protected mode without
special C-compilers. I did a port of PC-XINU Version 6 with Turbo-C V2.0.
But: I did it only in small-memory model, no large-memory version. I
also used the hardware task management and some of the memory protection
features available by the 80286.

>(I have thought of tricks such as modifying the objects and executables
>generated by existing DOS C compilers, such as Turbo C, but I would like
>to try and find a cleaner method.)
No special tricks were needed for the port, just some thoughts.

You have to compile all the C sources in Turbo-C's tiny model and link
it with the small memory startup-code to get enough memory. You HAVE
to compile in tiny model, because Turbo-C calls some runtime-routines
with a "jmp far xxx". In tiny model Turbo-C uses the following sequence:

	push	cs
	call	near <routine>

With Turbo-C++ this trick won't help because Borland did another
trick in their runtime library.

Sorry for my bad english, but perhaps I could help you. For more
questions just contact me by email.

Ciao
	Andreas
*************************************************************************
* Andreas Stuebinger	Rosstraenke 9	D-8390 Passau	**49-851-35600	*
* email:	stuebing@eniac.fmi.uni-passau.de	let's try MINIX	*
* Zur Not auch: or90020@ibm.rz.uni-passau.de	or90020@dpaurz1.bitnet	*
*************************************************************************