Here are a few trick to free as much DOS memory as possible:
- Tunes installs as high as possible in real and extended
memory
- We can intercept all interrupts, with the real-mode IDT being in
extended memory; real-mode interrupts jump to the same
physical code portion that just jumps into
protected mode for PM interrupt management;
interrupts are differentiated by the code segment
with which the code portion was reached: 5F21 for int 21,
5F33 for int 33, etc: the same few bytes need not be
replicated 256 times !
i386 Difficulties
See LLL difficulties...
Having some efficient code, but limit hardware dependence to the least
possible.
Supporting all the various kinds of existing hardware on PC
compatible stuff
Perhaps supporting that DOS runs below TUNES.
We need some standard object encoding for our modules.
See GOOSE subproject.
The Bootstrap Sequence
Only the very first steps of the boot sequence have already been implemented,
and the initial kernel is still to complete.
Here are the first steps of the boot sequence:
- The ROM-based BIOS, or some boot multiplexer
(e.g. LILO the LInux LOader, or OS/2's boot manager)
loads our 512-byte long boot sector at 0:7C00,
and jumps into it.
- The boot sector just chains into the ~2K boot loader that
it read from disk according to information written in
the boot sector during the TUNES installation.
It also installs a BIOS extension to allow reading floppies
that were overformatted (>1.44MB),
using fdformat, or Linux utilities.
- The boot loader tests the CPU type, the amount of available
memory, and retrieves a small kernel from disk,
and jumps into it with proper parameters.
- Alternatively, LILO or LOADLIN (from DOS prompt) loaded the kernel,
that was faking a Linux kernel, and jumped into the boot
loader. The boot loader is able to detect it and will load
the small kernel from memory rather than disk; it will even
recognize command-line parameters given by such a loader.
- A simple initial kernel, as loaded by the loader, is run.
It manages:
- real-mode<->protected-mode switching
- A 32-bit FORTH kernel
- hooks for TUNES to intercept hardware interrupts
- calling the BIOS from protected mode
- A simple console video output module using the BIOS
- A simple console keyboard input module using the BIOS
- A simple disk I/O module using the BIOS
- real-memory/extended-memory dynamic linking
- loading of the remaining of TUNES according to modules
that were concatenated to the initial kernel.
- When the initial kernel finished installing itself,
it consecutively installs all the modules that were
concatenated to it during system installation, and loaded
after it by the boot loader. The last one will presumably
load ever more modules until all wanted modules are installed,
and the system is ready to begin or resume actual work.
Some of these modules will be i386 specific; others may be
architecture-independent.
Modules
Implemented Modules
Here is a list of implemented i386 specific modules:
- Booting
- The boot record and boot loader, with corresponding
installation tools.
- A very simple protected mode program that
makes segment, paging, tasking, and
interrupt management,
and transmode (real/protected) calling
just possible.
reflects
interrupts to real-mode and allows to call
real-mode routines or interrupts.
Modules still to implement
Here is a list of i386 specific modules to implement:
- Memory management
- An interface to the i386 MMU
- An interface to the i386 segmenting
- Interrupt sharing manager
- i386 specializations of more generic modules
- An i386-optimized instance of the generational garbage collector
that checkpoints objects for persistency.
- support for chunks i386 executable binary
- full support for GOOSE modules.
- Raw drivers for console interface
- A simple parametrizable raw keyboard manager
- Some keyboard cooking to obtain national keyboard mapping
- A simple interface to text-mode video
- I/O drivers:
- Generic and specific disk drivers, that may be using the BIOS,
or directly talking to the adapter, using a SCSI interface,
etc. Perhaps stealing it from Linux.
- Drivers for serial ports
- Drivers for parallel ports
- Drivers for ethernet adapters
- Sound drivers
- Graphic card drivers
Bibliography
Here is a list of sources of useful information to write the i386 project:
Sources of various 32-bit FORTH systems:
Win32FORTH, FORTH/2, OOF
Various free DOS extenders:
PMODE, CODE32, 386p, DOS32
(look around
there)
The PC Game Programmer Encyclopaedia (GPE),
Ralph Brown's Interrupt List and HelpPC
(same as above)
The sources of the
Linux
and
VSTa
OSes.
To Do on this page
set up standard memory segmenting and mapping
set up GC implementation
set up calling conventions
study how all the above can be done independently
from the underlying system, be it direct hardware, BIOS, DOS, Linux, etc.
Write the Tunes/i386 BIOS-extender (almost done)
First application of Tunes/i386: a Linux loader that works for
large kernels (> 512KB compressed), so that kernel size is no
more a problem. It could be extended later to a more general
parametrizable boot loader. The configuration tool would use Tunes/OTOP
Write the i386 stuff as a Linux kernel module ?
Back to the
TunesLLL subproject.
Page Maintainer:
Faré
-- rideau@clipper.ens.fr