• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    C
  • Created over 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The functional Haskell kernel

Hos: A Haskell operating system

The kernel is written in mainly JHC Haskell, with fallbacks to C where necessary (biggest one being the garbage collector and rts). JHC was chosen because it produces ANSI C code which is easy to compile with a cross-compiler.

There are some bugs with monad transformers in JHC which make the compiler crash. You may see a funny idiom where we bind monadic calls to variables x1, x2, etc. and then seq them together before returning. This prevents an over-eager optimization from running which messes up the compile. At some point, I will spend time to patch JHC, but until then, the code compiles and seems to run.

Dependencies

  • Latest version of the JHC compiler.
  • GNU Xorriso (tested on 1.3.8)
  • GNU compatible make
  • A clang cross-compiler
  • GNU binutils (needed to run ld linker scripts)

Build System

The regular JHC make system is useless to us, because it wasn't designed to compile operating systems (duh!). Instead, we use the JHC -C flag to create ANSI C sources from the kernel and user-space haskell sources. We then compile these sources using a clang cross-compiler, and finally link them together to produce the output.

If you have everything necessary to build, modify build.opts to make sure everything points to the right locations, and type make at the top-level. Get a cup of tea, because JHC takes its time.

Run it

The easiest way to run Hos for testing is to use the supplied ISO. Hos has been tested only on VirtualBox. Currently, it only produces output via the serial port, which isn't very exciting, but it is what it is. If someone would like to write a text or graphics subsystem, we're looking for volunteers!

Steps to set it up with VirtualBox:

  1. Open VirtualBox, and hit 'New'
  2. Name the virtual machine, choose 'Other' as the type, and choose 'Other/Unknown (64-bit)' as the version.
  3. Give it at least 256 MB to play with.
  4. Create a new hard drive in any format, and make it 2GB in size. WE currently don't use it but our ATA driver presumes the existence of one
  5. Hit settings to set the serial port information.
  6. Open the 'ports' pane and select 'Enable serial port' for COM1. The IRQ should be 4 and the port should be 0x3f8
  7. Change 'Port Mode' to 'Raw file' and set 'Port/File Path' to a suitable output file location (you'll have to type it in).
  8. Hit run. Since your VM has no hard drive, VirtualBox should prompt you to choose an ISO
  9. Hit the browse button and choose the hos.iso from github
  10. Open your terminal and run 'tail -f name-of-serial-port-output'
  11. Hit enter in the virtual box window, if all goes well you should see text streaming out of the file. If all goes well it should end with a message that the kernel has completed.

Voilà, you've run a Haskell kernel!

More Repositories

1

generic-lens

Automatically make lenses from data structures implementing Generic
Haskell
26
star
2

react.hs

Simple FRP implementation for Haskell. See blog post at http://travis.athougies.net/
Haskell
14
star
3

hquant-state

Time series database built on acid-state
Haskell
14
star
4

beam-mysql

Beam MySQL compatibility layer
Haskell
10
star
5

closed-world

Recover Haskell instances at run-time
Haskell
9
star
6

hstradeking

Haskell TradeKing API bindings
Haskell
3
star
7

tightrope

Haskell library for constructing dynamic web interfaces, with support for server-side rendering
Haskell
3
star
8

tds

Low-level Haskell interface to the Tabular Data Streams wire protocol (MS SQL Server, Sybase, etc.)
Haskell
3
star
9

beam-mssql

Beam backend for Microsoft SQL server and compatible databases
Haskell
2
star
10

Eddy

A usable interface to SEC EDGAR
Haskell
2
star
11

zynx-se-bootcamp

Groovy
2
star
12

hdeq

Haskell Distributed Event Queue
Haskell
2
star
13

zippy

Haskell NoSQL database based on multi-holed zippers
Haskell
2
star
14

Unicalc

Repository for unicalc collaboration
Racket
2
star
15

extsort

External sorting in Haskell
Haskell
2
star
16

thc

The easy-going Haskell compiler (short for Travis's Haskell Compiler)
Haskell
1
star
17

crane

Crane is a type-safe Haskell web library
Haskell
1
star
18

hapi

API integration layer in Haskell
Haskell
1
star
19

travis-athougies-blog

My blog at http://travis.athougies.net/
Haskell
1
star
20

flow

A lazy, extensible, lightweight, dynamically- and weakly-typed scripting language for Haskell
Haskell
1
star
21

sys

A dependently-typed systems programming language with optional garbage collection and a stable ABI
Haskell
1
star
22

esper-amqp-shim

A simple utility that uses Esper to let you set up simple dataflows to manipulate AMQP streams
Scala
1
star
23

DIME

Distributed in-memory environment
Haskell
1
star
24

HLSL-test

A test suite for WINE's future implementation of an HLSL compiler
C
1
star
25

constraints

Haskell linear programming solver
Haskell
1
star