# HG changeset patch # User Windel Bouwman # Date 1384514810 -3600 # Node ID c9781c73e7e254599f9c870ba9773be4ecf6df23 # Parent c137f1fe3e65846f5fe36705ea67a297ebdf6c18 Added first kernel files diff -r c137f1fe3e65 -r c9781c73e7e2 LICENSE --- a/LICENSE Fri Nov 15 09:32:37 2013 +0100 +++ b/LICENSE Fri Nov 15 12:26:50 2013 +0100 @@ -1,25 +1,26 @@ -Copyright 2011 The lcfOS Project. All rights reserved. +Copyright (c) 2013, Windel Bouwman +All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: +Redistribution and use in source and 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. +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 SOFTWARE IS PROVIDED BY THE LCFOS PROJECT ''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 LCFOS PROJECT OR -CONTRIBUTORS 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 SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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 +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of the lcfOS Project. \ No newline at end of file +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. diff -r c137f1fe3e65 -r c9781c73e7e2 cos/Makefile --- a/cos/Makefile Fri Nov 15 09:32:37 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -# vim: set noexpandtab: - -all: - make -C kernel - make -C hello - python ../python/makeinitrd.py lcfosinitrd.img hello/hello.bin - cp grub/emptybootdisk.img bootdisk.img - mcopy -D o -i bootdisk.img kernel/lcfos.bin :: - mcopy -D o -i bootdisk.img lcfosinitrd.img :: - mcopy -D o -i bootdisk.img grub/menu.lst ::/grub - diff -r c137f1fe3e65 -r c9781c73e7e2 cos/grub/emptybootdisk.img Binary file cos/grub/emptybootdisk.img has changed diff -r c137f1fe3e65 -r c9781c73e7e2 cos/grub/makegrubfloppy.sh --- a/cos/grub/makegrubfloppy.sh Fri Nov 15 09:32:37 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#!/bin/bash -# Creates an empty floppy with grub loader on it. - -# Filename: -FLOPPYFILE=emptybootdisk.img - -# Create file of 1.44M size: -dd if=/dev/zero of=$FLOPPYFILE bs=512 count=2880 - -# Create filesystem: -mkfs.msdos $FLOPPYFILE - -# Create grub directory: -mmd -i $FLOPPYFILE grub - -# Copy grub files: -mcopy -i $FLOPPYFILE /usr/lib/grub/i386-pc/* ::/grub - -# Run grub commands in batch mode: -grub --batch <id = next_pid; + next_pid++; + return p; +} + + +public func void Kill(process_t* p) +{ + // clean memory +} + + diff -r c137f1fe3e65 -r c9781c73e7e2 kernel/syscall.c3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/syscall.c3 Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,9 @@ +module syscall; + + +// System call handlers. System calls are made from user space. + +func void handle_system_call() +{ +} + diff -r c137f1fe3e65 -r c9781c73e7e2 os/os.lcp --- a/os/os.lcp Fri Nov 15 09:32:37 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - diff -r c137f1fe3e65 -r c9781c73e7e2 python/isa/openrisc.lidl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/isa/openrisc.lidl Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,26 @@ + +// Openrisc description in lidl (lcfos isa description language) + +// Register storage: +storage r { + width: 32 + size: 32 +} + + +instruction add { + encoding: '111111111DDDDDDAAAAAABBBBBB' + semantics: D = A + B +} + + +// ... + +instruction push { + encoding: '' + semantics: { + sp = X + sp = sp - 4 + } +} + diff -r c137f1fe3e65 -r c9781c73e7e2 python/iso9660.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/iso9660.py Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,49 @@ + +import argparse + +""" + ISO 9660 filesystem utility. +""" + +def read_vol_desc(f): + s = f.read(2048) + ty = s[0] + Id = s[1:6] + assert Id == 'CD001'.encode('ascii') + ver = s[6] + assert ver == 1 + data = s[7:] + assert len(data) == 2041 + return ty, Id, s + +def parse_boot_record(sec): + boot_sys_id = sec[7:39] + boot_id = sec[39:71] + print(boot_sys_id) + print(boot_id) + +def parse_primary_volume(sec): + sys_id = sec[8:40] + vol_id = sec[40:72] + print(sys_id) + print(vol_id) + +def read_iso(f): + # System area + system = f.read(16 * 2048) + while True: + ty, Id, dat = read_vol_desc(f) + print(ty, Id) + if ty == 255: + break + elif ty == 0: + parse_boot_record(dat) + elif ty == 1: + parse_primary_volume(dat) + + +if __name__ == '__main__': + with open('mikeos.iso', 'rb') as f: + read_iso(f) + + diff -r c137f1fe3e65 -r c9781c73e7e2 readme.rst --- a/readme.rst Fri Nov 15 09:32:37 2013 +0100 +++ b/readme.rst Fri Nov 15 12:26:50 2013 +0100 @@ -5,23 +5,21 @@ Project goals ------------- -* To write a microkernel OS. -* Write the kernel in C3 ('cos') -* Write a kernel in oberon like language and be able to compile this with the ide. -* Create python scripts that form the major part of the OS. -* Make IDE in python that can compile the OS. +* To write a microkernel based OS +* Write the kernel in the c3 language +* Create a c3 compiler in python Directory structure ------------------- -'os' contains the os written in oberon like language. -'ide' contains the python3 qt4 ide to build the os. -'cos' contains the os written in C and assembler. +'kernel' contains the microkernel. +'python' contains the python utilities. Software dependencies --------------------- - * python3 - * pyqt4 + +* python3 +* (optional) pyqt5, pyqt4 or pyside How to start the IDE -------------------- @@ -36,6 +34,7 @@ python -m unittest .. image:: https://drone.io/bitbucket.org/windel/lcfos/status.png + .. image:: https://codeship.io/projects/f4a4da90-2ffd-0131-58c6-5ea61a10d89b/status diff -r c137f1fe3e65 -r c9781c73e7e2 user/hello.c3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/user/hello.c3 Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,12 @@ +module hello; +import lib; + +/* + Demo program running in userspace. +*/ + +func void start() +{ + lib.print("Hello space"); +} + diff -r c137f1fe3e65 -r c9781c73e7e2 user/lib.c3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/user/lib.c3 Fri Nov 15 12:26:50 2013 +0100 @@ -0,0 +1,13 @@ +module lib; + +/* +Runtime library. + +*/ + +func void print(string txt) +{ + // TODO +} + +