On Tue, Aug 18, 2009 at 04:21:16PM +0100, Richard Jones wrote:
> On Tue, Aug 18, 2009 at 09:07:23PM +1000, Erik de Castro Lopo wrote:
> > Florian Hars wrote:
> >
> > > Erik de Castro Lopo schrieb:
> > > > That makes sense. I do quite low level stuff as well, even Linux device
> > > > drivers and that is not ever going to be done in Ocaml or Haskell :-).
> > >
> > > People do use Haskell in developing OS kernels, and you can't get more
> > > low-level than that:
> > >
> > > http://ertos.nicta.com.au/research/l4.verified/approach.pml
> >
> > The Linux kernel which is the one I am interested in is C only. For
> > the Linux kernel I very much doubt it is ever going to be possible to
> > write drivers in Ocaml or Haskell even if that is possible for other
> > kernels now.
>
> Kernel hackers would hate people using any language other than C for
> Linux kernel modules. But that doesn't mean a modified OCaml is a bad
> choice for writing a kernel.
>
> It's relatively low-level when you need it to be, and it wouldn't be
> too much work to separate out the runtime and reimplement it on top of
> baremetal. It would also be interesting to see if the supposed
> massive overheads of garbage collection are in reality better than
> bloating every structure with an additional reference count field.
>
> There are some missing features to really make it possible though:
>
> - inline assembly
>
> - support for ELF (eg. putting code/data directly into named sections)
>
> - bit fields / bit twiddling (can probably be done with macros)
>
> - better optimization of int32 and int64 types
>
> Of the above, inline assembly is the one I'd really like to see added
> to OCaml. And having int32 be optimized to an int on 64 bit
> platforms.
>
> Rich.
two interesting projects in that direction:
c-- (cminusminus)
bit-c by jonathan shapiro
--
Philippe Strauss
http://philou.ch