Version française
Home     About     Download     Resources     Contact us    
Browse thread
[hack] OCaml can be used to write kernel modules into KOS
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David MENTRE <dmentre@l...>
Subject: [hack] OCaml can be used to write kernel modules into KOS
Hello,

For the fun, I have ported the asmrun/ directory of OCaml to a small
operating system, KOS (http://kos.enix.org/). This allows to run native
mode OCaml programs (i386 arch) as KOS kernel modules.

The binding is rather limited, it is more a quick & dirty hack:

 - no I/O;

 - no threads;

 - no access to KOS ressources;

 - no floats;

 - no int64;

 - due to lack of realloc, I have hacked the GC code and I'm pretty sure
   I have overlooked details;

 - other missing things I have forgotten...

Most of those missing functionalities could be implemented, either by
stealing code from glibc/gcc or by writing emulation code.  However I do
not plan to do that job. OCaml badly supports concurrent accesses due to
locking in GC (if I have understood correctly) so it can be of dubtious
use in an operating system. Note however that, as written, this code
could be used to write several /independent/ modules written in ocaml.

I have put modified source code at:
 http://www.linux-france.org/~dmentre/kos/module_ocaml_asmrun.tar.gz
(asmrun license: LGPL)

This tarball includes a diff that documents changes I've made on
original ocaml source code. It could be of some use if somebody wants to
do the same hack in another operating system.

Yours,
david
-- 
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <dmentre@linux-france.org>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A