Welcome to FoolOS ================= Disclaimer ---------- THIS IS A WORK IN PROGRESS. This is a simple and useless "operating system", with very basic features, sorry. It is the fruit of my fundamental explorations of the x86 architectures, 32-bit protected mode, interrupt handling, memory management, the floppy disk controller, networking as well as a couple of other things. ![Screenshot of FoolOS](/screenshots/foolos.png?raw=true "FoolOs Kernel") Copyright M.Idziorek 2014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Features -------- All features are only very rudiemntary and buggy. * PIT support / Timing * PIC support & Interrupt handling framework * PCI bus scanning * Physical memory manager * Floppy disk driver TODOS ----- Some things I would like to add someday: * Filesystem (probably FAT) * e1000 driver * networking stack / webserver * virtual memory managment / paging * user space / ELF binaries support * multitasking Issues ------ * memory map may be larger than mbr, but 0x0000 is used to check for end. * memory map location is hardcoded * the first ~4mb of physical mem are reserved by mem manager (hardcoded) * bootloader loads only 50 sectors of kernel into mem. 25KB! * Makefile is hardcoded and contains some mistakes too! * size of bitmap to track free blocks of physical memory is hardcoded to max. * physical memory manager allocator naively implemented. * kernel should run in high memory (~3gb) virutal mem. why? except v86 tasks? * redesign keyboard interrupt handler (faster!) * redesign command handling (not inside the interrupt!!!) * implement a real shell (in user mode) MEMORY LAYOUT ============= FLOPPY IMAGE ------------ 0x0000 - MASTER BOOT RECORD 0x0200 - kernel image (contains sotrage for interrupt desc. table) 0x8000 - file system will go here RAM --- 0x1000 boot loader puts the kernel here. 0x7c00 first stage boot loader (loaded by bios) boot/mbr.asm includes initial Global Descriptor Table! 0x7c00 + 3 boot loader puts number of boot floppy disk here. 0x7c00 + 0x140 the boot loader puts the memory map obtained from the bios here before switching to protected mode. 0xb000 memory above this is used for dma (by our floppy.c driver) REFERENCES ========== * LINUX KERNEL * GNU HURD * MINIX * FreeBSD etc. * xv6 * distributed OS? * e1000 driver * http://www.brokenthorn.com/Resources/OSDev17.html * http://www.jamesmolloy.co.uk/tutorial_html/9.-Multitasking.html * http://pdos.csail.mit.edu/6.828/2011/labs/lab6/ * http://wiki.osdev.org/Virtual_8086_Mode * http://pdos.csail.mit.edu/6.828/2011/xv6.html * man syscalls (posix syscalls?) MY NOTES BELOW THIS LINE ======================== Keyboard Driver --------------- //some thoughts on redesign of the keyboard driver //use uint8_t for proc_pos and buff_pos and a BUF_SIZE of 256 for auto wrap!? // kb input ringbuffer #define BUF_SIZE 256 kb_scancode kb_buff[BUF_SIZE]; buff_pos=0; proc_pos=0; buffered=0; void kb_irq() { cli //we get one interrupt for EACH scancode! kb_scancode val=get_scancode(); // think about race condition if called while inside kb_proc(); if(buffered+1