Code Monkey home page Code Monkey logo

saturn's Introduction

Saturn

Saturn is a new operating system I started in Oct 2017. It is a 64-bit microkernel with multitasking and IPC based around asynchronous message passing. With the exception of LLVM's libc++ and FreeType, the entire system and services are being written from scratch by me in C++. Saturn is not just the kernel, it encompases all the services and drivers needed to provide a complete desktop system.

The repository is organized into simple sections. The entire kernel is under src/kernel, all services including Apollo are under src/services, and applications can be found in src/applications.

Features

Latest Screenshot
Dsky application demonstrating Gemini interpreter

Apollo

Apollo is Saturn's UI framework. Apollo has a tiled window manager that divides up the screen into tiles. One of the main goals of Apollo is to support rapid UI prototyping. To accomplish this, Apollo uses a declarative layout language called Mercury. By editing Mercury files you can easily create and modify an application's UI.

(grid

    (rows (fixed-height 50) (proportional-height 1))
    (columns (fixed-width 50) (proportional-width 1))

    (items
        
        (label (caption "This is a label")
            (alignment (vertical center))
            (padding (horizontal 10))
            (meta (grid (column 1))))

        (list-view
            (meta (grid (row 1) (column-span 2)))
            (item-source (bind entries))

            (item-template
                (label (caption (bind content))
                    (background (bind background))
                    (font-colour (bind fontColour)))))))

Apollo also makes heavy use of databinding. Certain UI elements like Labels expose properties that are 'bindable', such as caption and background. You can define properties in your application and then 'bind' them to elements, and when your values change it automatically updates the appropriate UI element.

Note that the example also shows item templates. You can create a collection of some user-defined struct, and by defining an item template you tell Apollo how to create UI elements from that struct.

Vostok

Vostok is Saturn's Virtual Object System. It allows you to access objects exposed to the virtual file system just like files. Objects can have properties as well as callable functions, providing an RPC mechanism. By opening an object and writing arguments to one of its functions, you can invoke a function call in a separate process and read the results, just by using the filesystem. In the Dsky screenshot above, /system/hardware/cpu is actually a Vostok object, with a nested Id object that has a brand property.

A core feature of Vostok is introspection. By reading a Vostok object, you can discover all of the properties and functions they expose, as well as their types. By reading a function you get the function's signature, ie its input and output types.

/system/hardware/pci/host0/2/0 is the first PCI function on the third device. As you can see from the screenshot, by reading an object itself, you can find out what an object supports and how to interact with it.

Latest Screenshot

This screenshot shows the new Taskbar app that lists open applications and highlights the app with input focus. It also shows the Transcript app which creates structured logs events from the EventSystem, and allows you to filter the logs using a Gemini expression.

Testing

As Saturn is still in its very early stages, there are no releases yet.

Building

Saturn is currently undergoing a major overhaul and thus isn't runnable, but the build system has now been improved to the point where user builds are possible. This section is just for reference for the time being.

Requirements

  • clang >= 5.0
  • svn
  • yasm >= 1.3
  • cmake >= 3.11
  • patch >= 2.7.6
  • automake exactly 1.15
  • autoconf exactly 2.69
  • grub2-mkrescue

Setup

git clone https://github.com/patrick-lafferty/saturn.git

cd saturn

make

Running

Qemu:

make qemu

Bochs:

make bochs

VirtualBox:

make virtualbox

License

Saturn uses the 3-clause BSD license.

saturn's People

Contributors

patrick-lafferty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

saturn's Issues

Redesign how ShareMemory works

The way ShareMemory works right now is the sender knows the recipient's shared address and by sending the message to the service registry, the appropriate recipient page tables are modified whether the recipient accepts/knows or not. Change it so the owner of the memory to be shared initiates a share memory request with its owned memory address and the task id of the recipient, the service registry then forwards the request to the recipient on the owner's behalf and if the recipient accepts then only is the memory shared.

Optimize memset

Rewrite memset to use enhanced rep stosb similar to memcpy.

Overhaul the heap

The current heap is slow, and doesn't really support freeing memory. Add fixed-size bins with free lists for each size to optimize finding free chunks.

Support loadable programs

Need to implement an ELF loader so that all the services can be built and loaded separately which will clean up a number of issues.

Unable to build toolchain

Attempting to build the toolchain by running make toolchain results in the following error for me:

make[5]: *** No rule to make target 'eelf_x86_64_saturn.o', needed by 'ld-new'.

Any suggestions to allow it to compile?

Implement a Label element

A Label is a UI Element that displays a block of text. The text can be changed at runtime with code, but isn't user interactive like a textbox is.

New VFS message: ReadStreamRequest

ReadStream takes a memory address to write to, as well as a max length. Then instead of fread issuing (dataSize / 512) separate ReadRequests, it would issue just one ReadStreamRequest. The VFS would wait until all the requested data is available, then memcpy the whole shebang into the buffer at once, and issue one response.

Implement Layout loading from a string

Apollo UI Layouts will be stored as text files formatted as s-expressions. Once the text has been loaded into a string, parse the string to get the s-expressions, and then walk through the s-expression tree to create all known containers and other ui elements.

Create a new kernel loader

Now that the 64-bit rewrite is happening, Saturn needs a 32-bit loader to replace the old pre_kernel hacks. It will handle setting up the free physical page stacks and other low-level things, and ensure that the kernel starts in a stable and well-known state, or doesn't start at all and lets the user know why.

Capcom: Add a text area showing available commands

The layout should be like:

"Menu"

[command line]

{
commands
}

Commands are organized into different categories and have a unique shortcut, so for example one category could be Container [ (S)plit, (C)hange split]. Initially the text area would show:

C -> Container

pressing C would change the area to show

S -> Split C -> Change split

Implement a List container

Dsky will need a List to display labels of user text input and the resulting output. List items don't need to be uniform in size, and will be culled to only render the items visible.

Add an S-Expression parsing api to libSaturn

A number of new features in the works - a shell language, UI layout format ala XAML, perhaps logging and configuration files - will be based off of S-Expressions. So it is imperative that a functional parsing framework exists, and putting it in libSaturn is an easy way to make it accessible to all services/applications.

Add taskbar application

Something that shows a list of running applications that highlights the application with input focus.

Add serial port support

QEMU has a handy feature where it can redirect everything written to COM1 to a logfile, so make use of that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.