System Specification
Last update: 2000-12-19
Copyright © 2000 Luca Abeni
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included by reference.
The FreeDOS 32 System Specification describes the FreeDOS-32 system, introducing all the most important concepts and system components, and defining the system architecture. All the technical aspects concerning the various components will be described in separate documents: see Document Organization.
Introduction
FreeDOS-32 (FD32) is a 32 bit operating system designed to be a "32 bit DOS": the main goal of the FD32 project is to extend the MSDOS/FreeDOS concepts to work in a 32 bit environment.
Goals
When an x86 (x >= 3) CPU works in Protected Mode (PM), an application can take advantage of some capabilities not present in Real Mode (RM), like the possibility to access up to 4 GiBytes of memory, the possibility to use 32 bit optimized device drivers, and so on. FreeDOS-32 aims to make these capabilities accessible to applications without incurring in the overhead introduced by OSs which enforce strong protection like Windows or unix-like OSs. Moreover, it will do it using an extension of the good, old, DOS interface (the DPMI interface), and will support all the DOS protected mode applications that use DPMI.
For these reasons, FD32 could be a good environment for running DPMI applications, but also for developing embedded systems based on low-cost x86 boards.
Philosophy
All the design choices and the development of all the specifications should be inspired to some basic and consistent ideas, that can be summarized in the following guidelines:
- Simplicity - Everything should be designed in order to be as simple as possible (but not simpler... :)
- Efficiency & speed - Since one of the goals of the FD32 project is to remove the overhead introduced by most PM OSs, each design choice should go in the direction of increasing the efficiency and speed of the system (everything that can reduce the efficiency should be removed from the kernel)
- Modularity - The kernel should contain only basic mechanisms, leaving everything else to external drivers or applications
- Generality - None of the design choices should impose some specialized environment or programming model
- DOSability :) - When all the previous guidelines are not useful to decide between different possibilities, the most similar to the DOS philosophy/structure must be chosen.
Document Organization
The FreeDOS-32 Specifications are a set of documents describing the system in all its aspects. They are organized as follows:
- The System Specification (this document)
is a general specification giving a broad view of FreeDOS-32. In particular, the System Specification defines the project goals, the philosophy behind each particular choice, and the system structure. - The Kernel Specification
is a detailed description of the FD32 kernel internals and programming interface. - The Drivers Specification
describes the the loadable drivers interface.
Other documents will be added as soon as we will define new aspects of the system.
System Structure
Being FreeDOS-32 a DOS system (also known as a non-kernel system), any application should have complete access to the hardware, and should be free to manage it as it prefers (this comes from design guidelines 2, 3, 4, and 5).
That is to say, there is not any protection mechanism that limits application operations: applications can run at system priviledge level (ranging from ring 0 to 3). This is the biggest difference respect to all the conventional PM OSs.
Goal
The first goal of FreeDOS-32 is to support 32 bit DOS applications using the DPMI (DOS Protect Mode Interface) interface. This can be done directly by the kernel or using some wrappers/drivers.
Architecture
FreeDOS-32 is a modular system, based on a small core (the FD32 kernel, from now) that implements only basic functionality, and a set of dynamically loadable modules, the drivers, that implement all additional functionality.
In FD32, the driver concept is more general than in classical 16 bit DOSes, since drivers can be either used to manage hardware resources or to extend the FD32 kernel implementing new features (this comes from guideline 3). An example can be a multithreading driver.
Kernel Environment
The FD32 kernel provides a very simple and basic execution environment (see the Kernel Specification for details about it), that can be modified and enhanced by drivers and applications (this comes from guidelines 1 and 3).
In addition (or in alternative) to the "legacy" DPMI interface, FD32 will provide a FD32 native interface, that could be used by native or embedded applications for accessing system services with a smaller overhead (this comes from guidelines 2 and 3).
System Functionality
At boot time, the FD32 kernel is loaded and initialized, setting the kernel environment up, then some drivers could be loaded to handle physical devices and/or modify/enhancing the kernel environment. Finally, a program (very likely, the FD32 shell) is started. When this program ends, the system is halted/rebooted.
Executable Formats
In order to complete the boot process described above, the FD32 kernel must be able to parse at least one executable file format. ELF parsing is natively supported in the kernel (see the Kernel Specification), but there is some request to support COFF too (this comes from guideline 1). Other executable formats (16 bit exe for "stubbed" DPMI applications, PE, ...) will be supported by external programs/wrappers/drivers (this comes from guidelines 3 and 4).
The Operating System
Our first effort is intended to provide the FD32 kernel and all the most important drivers, so that DPMI applications (one example for all: DOOM) can be run unmodified. However, and OS is more than a kernel: it is composed by the kernek itself, by a shell, and by some other additional programs. For all the programs other than kernel and drivers, we can use the regular FreeDOS distribution, by simply recompiling FreeDOS programs in the FreeDOS-32 environment. In this way, the FD32 kernel can be seen as an alternative to the traditional 16 bit FreeDOS kernel, while the rest of the OS can remain unchanged.
Development Tools
The FD32 kernel will be developed in C and Assembly and compiled using the gcc toolchain. For what concerns the gcc "incarnation", our final goal is to recompile gcc under FreeDOS-32 and to use this gcc port to compile the kernel. However, in a first stage crosscompilation is needed.
Our original idea was to use DJGPP, but it cannot generate ELF executables, hence it will not be useful to compile drivers and FD32 native applications. In order to compile drivers and FD32 native applications, we can use:
- the Linux gcc
- DJGPP + binutils targetted to ELF
Applications to be run in FD32 can be developed using the developers' favorite language/compiler, as far as they can run in the kernel environment or are supported by some wrapper.