- Real-time operating system written in C/C++/assembly for x86 platform:
- Created for CS 452 class during Fall 2005 term with one other group member (see his website).
- Uses GNU GRUB with Multiboot as primary boot loader.
- Uses Newlib as base for standard C libraries, no slow STL C++ libraries used.
- Supports i586 ELF binaries for kernel and user application modules, loading code and data segments.
- Custom built GNU C/C++ tool chain (gcc-3.3.4, binutils-188.8.131.52.8, newlib-1.12.0) for cross compiling and linking of i586 ELF binaries under i686 CYGWIN platform.
- Strong use of standard object oriented design patterns, including: singleton, factory, observer, composite, template, memento, etc...
- Custom templated list/vector, map, queue, and stack classes with static/dynamic memory allocation.
- Multitasking kernel with priority scheduling and fast process context-switching:
- Runs in protected mode, managing segmentation through the global descriptor table (GDT), with kernel and system processes (drivers) running at ring 0 (full priviledge).
- Scheduling involves use of ready queue per priority level with round robin scheduling in constant time.
- ELF binary modules instantiated as processes and used as kernel drivers and user applications.
- Modules binaries images pre-loaded into memory following kernel image to enable fast creation and shared code/readonly segments.
- Processes each maintain private address spaces for module data, BSS data, heap, and stack, while code/readonly data is publically shared.
- Process context switching written in raw x86 assembler and GCC GAS formatted x86 assembler, involves storing/restoring general purpose registers, segment registers (code and data/stack), stack pointer, etc...
- Created ASCII-based TETRIS game as first application. Beside games, what else is an OS good for? ;)
- Hardware and software interrupt handling:
- Maintains interrupt handler entry points and related information in the interrupt descriptor table (IDT).
- Software interrupt used to enter kernel on system calls, passing syscall index and argument list pointer.
- Exception handling for all 19 exceptions, including dump of CPU state with all general purpose, segment, pointer, index, and eflags registers.
- Ability to recover from exceptions caused by user processes.
- Windows 9x-like Blue Screen Of Death exception screen for novelty purposes ;) Enhanced to also provide CPU register states.
- Software interrupts registered for process debugging and assertion handling.
- Hardware interrupt handling with ICU0 and ICU1 masking/unmasking for:
- Programmable Interval Timer (PIT): with 10Hz timing precision used for synchronization, delays, and forced process pre-emption.
- Keyboard: with key input buffering, scancode-to-ASCII remapping, and LED manipulation.
- Serial Ports 1 & 2: with ready data buffering and handling of transit holding empty register.
- Event waiting & signaling system to block processes while waiting for interrupt related events to happen (e.g. waiting for the next timer tick or keyboard press).
- Inter-process communication (IPC) functionality for messaging:
- Uses send/receive/reply mechanism where sending process is blocked until receiving process receives and replies, while receiving process is blocked until any process sends to it.
- Receiving processes maintain queues of sending processes.
- Used as basis for asynchronous message/event handling loops within some user processes.
- Priority inversion scenerios generate assertions so that they can be corrected by carefull design.
- Text mode video system with 80x25 character resolution, supporting:
- Printing of characters and formatted string with forecolour (16), backcolour (8), and blinking attributes.
- Screen buffer storing/restoring and pushing/popping functionality.
- Hardware cursor positioning.
- SVGA graphics using VESA 2.0 with VBE 1.2 for direct access to video frame buffer:
- Supports 640x480 and higher screen resolution at 16-bit (RGB565) and 24/32-bit (RGB888) pixel depths.
- Back buffering support with fast MMX-based memcpy/memset 32-bit block transfer flipping routines.
- Supports drawing of pixels, lines, solid/outlined rectangles and circles, pixel masks, and images.
- Bitmapped font support using 8x8 pixel font character masks generated by custom TTF font conversion Win32 console utility.
- Text mode emulation that overlays graphical representation of text mode buffer into frame buffer.
- Memory manager for allocating and freeing memory:
- Overloads C++ new/delete operators enabling true object oriented design within kernel.
- Allocates blocks within 16 MB memory pool (kernel heap), maintaining allocation descriptors in linked list with nodes allocated along side of blocks.
- Tracks size, filename, and line number of each allocation to assist with debugging.
- Simplified version also used to manager heap space in user address spaces, exposed with Malloc and Free system calls.
- System command console/shell with fast parser/tokenizer/interpreter that handles:
- Commands: that support multiple arguments and are directly linked to functions prototyped with the function(int argc, char *argv) syntax.
- Variables: that can be strings, integers, or booleans and are directly linked to in-code variables.
- Aliases: that can define new commands as sequences of multiple commands seperated by semicolons (e.g. alias "abort" "gdt; idt; processlist; reboot").
- System services used by user processes include:
- Name Server: allows processes to register themselves so that other processes can find them by name.
- Clock Server: enables a process to synchronously delay its execution with millisecond precision, or asynchronously timeout and wake up another process.
- Serial Server: used to read/write data from/to the serial ports, pre-empting processes as they wait for data transfer operations to complete. Uses an independent serial server per port with read and write guard processes for queuing read/write requests.
- Full-featured user API with header files and linkable libraries for:
- Process create, destroy, pass, exit, and pid/priority querying.
- IPC send, receive, and reply.
- Name server registration, process register as, and who is.
- Event await, signal, and occurred querying.
- Dynamic memory allocation malloc and free.
- Standard library includes (stdio, stdlib, stdarg, and string).
- System wide typedefs: byte, word, dword, short, uint, ushort, etc...
- Debug and assertion macros.
- Clock server message structures and constants.
- Time delay, delay until, asynchronous timeout delay, and get ticks functions.
- Keyboard has key (i.e. kbhit) and get key (i.e. getch).
- System console key input and toggling.
- Text mode video clearing, printing, and cursor positioning.
- Screen buffer pushing/popping and storing/loading.
- Display mode information querying (screen size and colour depth).
- Screen buffer clearing and flipping.
- Pixel, line, rectangle, circle, and image drawing.
- Font typeface/colour changing and printing.
- Serial server message structures and constants.
- Serial get, put, read, write, and flush buffer functions.
- WYSE (VT100 terminal on serial connection):
- WYSE terminal command formats/constants.
- Screen clearing, resolution changing, positioned printing, and key polling.
- Track model and tracking/routing application data structures and constants.
- Track model traversal and utility functions.
- Track controller interface sensor polling, train speed, and switch changing functions.
- Real-time HyperTransit application for routing trains between virtual stations controlled by a simulation of a transit system:
- Facilitates routing of multiple trains at the same time on a single track.
- Finds optimal routes for trains using modified shortest path algorithm, based on Dijkstra's algorithm, that also handles the locking/releasing of track nodes (sensors and switches) during specific time intervals.
- Monitors all sensor triggering activity with queryable monitor process, allowing a notificiation for a certain sensor trigger to be requested with a timeout.
- Dispatches track controller interface commands for train speed changing and switch direction flipping on a priority basis.
- Track status display including sensor triggers times, switch direction, train speeds, and estimated train positions. Draws graphical representation of track with sensors, switches, and moving trains.
- Train routing system wrapped in clean API to simplify implementation of future train track based applications.
- Developed under Windows XP w/ SP2 platform with custom development environment:
- Used Microsoft Visual Studio 7.1 .NET as primary IDE, with custom compile events for using external MAKE-based build process.
- Piped GCC compiler output to custom gcc2msvc (Win32-based console application) for conversion to MSVC-like output resulting in ability to trace compile errors/warnings in MSVC IDE (i.e. clicking on errors/warnings in the build output log goes to the culprit source files and line numbers).
- Created shell script to bake OS binaries and GRUB/Multiboot boot loader into ISO 9660 CD-ROM image using CYGWIN-based cdrtools mkisofs utility and GRUB stage2_eltorito binary.
- Used Microsoft Virtual PC 2004 as primary simluator for testing OS with custom terminal display and train controller simulators using Win32 named pipes for simulated serial port communications.
- Created HyperWYSE simulator for VT100 WYSE terminal display w/ keyboard:
- Coded in C/C++ using pure Win32 API for windowing and graphics.
- Emulates 9600 baud duplex serial connection through Win32 named pipe connection.
- Maintains virtual representation of WYSE terminal, supporting:
- Subset of VT100 escape seqeuences, including screen clearing, cursor positioning, and display mode changing.
- 80x24 and 132x24 fixed width character display modes.
- Keyboard input that translates extended keys (arrows, page up/down, etc...) into proper escape sequences.
- Copying of screen buffer to clipboard.
- Created HyperTrack simulator for Märklin train track with Märklin 60XX digital interface:
- Coded in C/C++ using pure Win32 API for windowing and graphics.
- Uses GDI back buffering for graphics and multimedia timing for smooth animation.
- Emulates 2400 baud duplex serial connection through Win32 named pipe connection.
- Maintains virtual representation of train tracks including their switch states and supports:
- Adding and removing or multiple trains that can have their speeds and directions changed manually or externally, and detect crashes between each other.
- Querying and triggering of sensor modules, including ability to stick sensors.
- Changing of switch directions manually and externally, tracking how long ago solenoid was turned off (since leaving it on for extended periods of time can burn it out on the real hardware).
- Export of raw track node graph/model structures to file for pre-loading OS track API.
- Used Perforce SCM system under Windows for source control.