From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C3A7CBC8C for ; Sun, 16 Jan 2005 15:11:43 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0GEBdVD011884 for ; Sun, 16 Jan 2005 15:11:39 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA14592 for ; Sun, 16 Jan 2005 15:11:38 +0100 (MET) Received: from smtp7.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.24]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0GEBc4J024839 for ; Sun, 16 Jan 2005 15:11:38 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0709.wanadoo.fr (SMTP Server) with ESMTP id 59AEE1C000A0; Sun, 16 Jan 2005 15:11:38 +0100 (CET) Received: from morgana (ARennes-351-1-57-164.w82-126.abo.wanadoo.fr [82.126.61.164]) by mwinf0709.wanadoo.fr (SMTP Server) with ESMTP id 21EBA1C00094; Sun, 16 Jan 2005 15:11:38 +0100 (CET) Received: from david by morgana with local (Exim 4.34) id 1CqB7w-0002ea-4J; Sun, 16 Jan 2005 15:11:36 +0100 To: caml-list@inria.fr Cc: Thomas Petazzoni , david.decotigny@free.fr Subject: [hack] OCaml can be used to write kernel modules into KOS From: David MENTRE Organization: none Date: Sun, 16 Jan 2005 15:11:36 +0100 Message-ID: <877jmdfopz.fsf@linux-france.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 41EA761B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41EA761A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 asmrun:01 ocaml:01 threads:01 hacked:01 gcc:01 asmrun:01 lgpl:01 tarball:01 ...:98 tar:01 floats:01 glibc:01 kernel:01 kernel:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: 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 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A