* Re: Using GNAT in Linux kernel modules, was: Re: Free RTOS with support for Ada ?
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
0 siblings, 0 replies; 2+ messages in thread
From: Gerhard Häring @ 2001-05-26 3:35 UTC (permalink / raw)
>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')))
^ permalink raw reply [flat|nested] 2+ messages in thread