comp.lang.ada
 help / color / mirror / Atom feed
From: gerhard.nospam@bigfoot.de (Gerhard Häring)
Subject: Re: Using GNAT in Linux kernel modules, was: Re: Free RTOS with support for Ada ?
Date: Sat, 26 May 2001 05:35:00 +0200
Date: 2001-05-26T05:35:00+02:00	[thread overview]
Message-ID: <slrn9gudg6.183.gerhard.nospam@lilith.hqd-internal> (raw)
In-Reply-To: 1UxP6.158$rn5.2018@www.newsranger.com

>I was also aware (from the Ada Linux Programming book from
>www.adapower.com) that you need to use a pragma to disable the Ada runtime
>when doing Linux kernel modules.
>
>However, this book does not cover kernel programming in any detail and the
>GNAT reference manual just refers you to the GNORT documentation, which does
>not appear to be publically available, so I had dismissed this as an option.
>
>However, since this option is mentioned above, I wonder if I have missed
>something.
>
>Has anybody successfully implemented a Linux/RTlinux kernel module in Ada
>using just the public GNAT and freely available documentation and what problems
>did you have ?

FWIW, I have once implemented a toy Linux kernel module with the publicly
available version of GNAT. I also started to port a relatively simple Linux
kernel module to Ada (the driver for the bttv video cards).

I can tell you that it's possible. But for me, it was quite frustrating,
because I had to "fake" C a lot, I couldn't get rid of C completely because the
Linux kernel uses lots of #defines and you have to wrap these at least to Ada
functions/procedures.

It would be nice if the complete Linux kernel API were available as an Ada
binding, but this would be a tremendous effort and would have to be updated for
every new kernel version. Not quite realistic. I have only translated the C
stuff on a as-needed basis.

Wrt to the PRAGMA No_Run_Time, it wasn't available with GNAT 3.12p and I could
do without. I still don't quite get the point of it: it still lets you use
features that need the Ada runtime.

Gerhard

PS: You can't allocate stuff on the heap. (Part of) The GNAT runtime would need
to be ported to the Linux kernel environment, so that it uses kmalloc instead
of the C library's malloc.
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://highqualdev.com              public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



      reply	other threads:[~2001-05-26  3:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tAbP6.6660$r4.413599@www.newsranger.com>
     [not found] ` <3B0D7877.4AE1FBCC@gsde.hou.us.ray.com>
2001-05-25 18:54   ` Using GNAT in Linux kernel modules, was: Re: Free RTOS with support for Ada ? Simon Clubley
2001-05-26  3:35     ` Gerhard Häring [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox