Re: Exit from linux Kernel back to dos.

Kurt Garloff (garloff@kg1.ping.de)
Thu, 17 Dec 1998 22:47:10 +0100


On Thu, Dec 17, 1998 at 03:10:44PM -0500, Richard B. Johnson wrote:
> On Thu, 17 Dec 1998, Kenny Thomas wrote:
>
> > I am working on a project where I would like to be able to load up a
> > minimum linux kernel with a small ramdisk similer to what is used for
> > install puposes. But I need to be able to shutdown linux and return
> > back to dos without rebooting. Is this possible, practical or remotely
> > doable?
> > Kenny Thomas
> > ADMINKT@flint.umich.edu
> >
>
> ``BACK to DOS?'' Unless you use ``jboot'', a DOS program I wrote several
> years ago, you do not start at DOS, so regardless of what you do, you
> can't get ``back''. Jboot only works with zImage, not bzImage, so you
> are limited here.

well, there are other Linux loaders starting from DOS like loadlin etc.

> That said, it IS possible to get back from protected mode to real-mode.
> You can even restore the whole 16-bit environment (IDTs, GDTs, etc),
> if you saved them somewhere. The problem is that Linux may have used
> your secret memory location(s) for something else, and the state of
> the hardware in undefined. To reinitialize the hardware, you've got
> to either let the BIOS do it (cold boot), or do it all yourself from
> some launch/restore program.

This is the really bad part of the story. In principal, yes, you setup up
everything like before and clear some bit of the CR0 register to get back to
real mode. (The 286 funnily didn't allow that; you needed to play tricks with
soft processor resetes to get back ... Seems the intel engineers just could
not imagine one would really want to go back to this inferior Real Mode.
They didn't expect the power with which M$ could keep people using their
Real Mode OSes,. which really only used a small part of the processors
power. The 386 was first sold in 1985, IIRC!)

I think the restoring of the descriptors (GDT, ...) and the memory,
processor state would be some work to be done but not that hard. The really
bad thing is hardware! There are devices with write only registers ...
(OK, it should be forbidden by law to built such hardware, but reality
differs from what I think it should be.)

Maybe you can use some of the BIOS' routines to set them to the intial
state, before DOS was loaded. On a clean DOS installation, i.e. without
CONFIG.SYS and AUTOEXEC.BAT, there are almost no device drivers which could
change the state of the hardware from the inital state ...
On a DOS with plenty of drivers in C.SYS/A.BAT, it's hopeless.

So far my thoughts ...

-- 
Kurt Garloff <K.Garloff@ping.de>  (Dortmund, FRG)
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff

There is something frustrating about the quality and speed of Linux development. I.e. the quality is too high and the speed is too high, in other words, I can implement this XXXX feature, but I bet someone else has already done it and is just about to release his patch to Linus soon... [From a posting of Tigran Aivazian to linux-kernel, XXXX = disk stat]

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/