📄 readme.txt
字号:
Cosmos: a small open source operating system written in C
Copyright (C) 2001 - Christopher Giese <geezer@execpc.com>
http://www.execpc.com/~geezer/os/index.htm#cosmos
To build this kernel, you need DOS and these free tools:
- GCC for DOS (DJGPP) http://www.delorie.com/djgpp
- NASM http://www.web-sites.co.uk/nasm
- Turbo C 2.01 http://community.borland.com/museum
(you must register to download Turbo C 2.01)
To make a bootable floppy disk, put a blank 1.44 meg DOS-
formatted floppy in drive A: and type
make -f dj.mak install
To run the OS from real DOS (not a Windows DOS box), assemble
LOAD.ASM to a DOS .COM file:
nasm -f bin -o load.com load.asm
then type
krnl
================================================================
FEATURES
================================================================
NEW in release 9b:
- Fixed a bug that made tasks die just as they started up
(I was overwriting the initial RAM disk)
- Stand-alone bootloader. You need NASM and Turbo C 2.01
to build it.
- Keyboard line buffering in the kernel; can be turned on
and off with ioctl()
- Added select() and read() syscalls, got rid of getch()
Tetris re-written to use ioctl(), select(), and read()
- Now using the keyboard controller to reboot, instead of
triple fault.
- Initial page tables are now built by the asm startup code,
instead of using C code. The startup phase no longer uses
segment-based address translation.
Old features:
- 32-bit protected mode OS
- Movable kernel; can be loaded into contiguous RAM on any
page (4K) boundary
- Unified IRQ/exception/fault/interrupt handler
- Simple initial RAM disk contains user tasks to be run
- Separate kernel- and user-privilege stacks for each task
- Preemptive multitasking, driven by timer interrupt.
Simple round-robin scheduling for now.
- Tasks run at user privilege (ring 3). If a task performs an
illegal operation, it is killed (the kernel keeps running).
- Paging. Tasks run in their own paged address spaces.
- Demand-loading. Still no block devices or filesystems;
the "load" is actually a memcpy()
- Kernel memory (code and data) that is used only during kernel
initialization is freed after use.
- Text-mode VGA virtual consoles, with software scrolling
and a subset of ANSI escapes
- Realtime clock driver. time() syscall; uses unique JDN algorithm
- Tinylib, a small C library (libc)
- Make process creates kernel disassembly and symbol table files
- Ctrl+Alt+Del reboots
================================================================
BUGS/NOTES/GOTCHAS
================================================================
The bootloader is too slow.
Because it moves the text-mode framebuffer from B800:0000 to
A000:0000, Cosmos will not run properly with some versions of
the Bochs PC simulator.
The resolution of the Cosmos virtual consoles is that of the PC
screen before the OS starts. If you want to see lots of text on
the screen at once, compile 90X60.C in the UTIL directory, and
run that before typing 'krnl' (DOS only).
There are MinGW32 makefiles and support for PE executables, but
Cosmos built with MinGW32 crashes at startup. I don't know why.
Tetris seems to freeze up after a while.
================================================================
TO DO
================================================================
Find out why MinGW32 version crashes.
See if ELF version (compiled with GCC for Linux) still works.
Add device architecture, starting with console character device.
Besides being slow, the bootloader has some other problems.
Restore the grim reaper task to free resources used by dead
tasks.
Yielding by using INT 20h to simulate a timer interrupt: is this
a crock?
Add a read-only RAM disk, read-only VFS layer, read-only FAT12
filesystem, and read-only command-line shell.
LOADER.C should probably do more validation of executable files
LOAD.ASM should be updated.
Paging:
- Map all free memory into the kernel heap
- Get rid of all far pointers (peek() and poke() calls)
- Get rid of memory accesses that use physical addresses,
remove code in STARTUP.ASM that identity-maps extended memory
- kmalloc(), krealloc(), kfree()
- Figure out when you need to do invalidates
- Add support for shared memory
Tinylib:
- movedata() should handle overlapping src and dst
- Port string functions to asm for speed
- Rename functions insb(), insw(), insl(), outsb(), outsw(), outsl()
Video:
- Back VCs with kernel memory so you can have any number of them.
- Support mixed text- and graphics-mode VCs
- Support non-US characters (needs graphics), using UTF-8
Keyboard:
- Restore shift, alt, and control conversion
- Support non-US keyboards with installable conversion tables
and UTF-8
- Test code on latop/notebook PC; maybe switch to scancode set 2
if necessary
- ioctl() to set delay, repeat, and possibly which keys repeat
Add V86 mode monitor
Add message queues
Add driver for IDE hard disk (read-only at first), disk cache.
Add support for memory-mapped files.
================================================================
LICENSE
================================================================
Copyright 2001 by Christopher E. Giese
Non-exclusive rights for redistribution and use of this material,
in source or binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions, and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
THIS MATERIAL IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS MATERIAL, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Have fun!
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -