From: "q.kontinuum" <achsis_of_elvis@yahoo.co.uk>
Subject: Re: Linux kernel module - memory allocation
Date: Mon, 18 May 2015 09:19:05 +0000 (UTC)
Date: 2015-05-18T09:19:05+00:00 [thread overview]
Message-ID: <slrnmljbka.9gf.achsis_of_elvis@tmoeller-laptop.ad.here.com> (raw)
In-Reply-To: crtnpmFj143U1@mid.individual.net
Hi, thanks a lot for the fast reply.
In comp.lang.ada, you wrote:
> On 15-05-18 11:27 , q.kontinuum wrote:
> Do you mean a real "driver", either kernel-linked or a loadable module?
Yes, I'm aiming for a loadable kernel module.
> Which Ada compiler are you using? Do you use some specific compiler
> switches to adapt it to the driver environment?
I'm using gnat. Command line to compile a
gnatmake -a -s -mcmodel=kernel ...
> But GNAT can also translate some C headers into Ada
> declarations automatically.
I should look into that. Good to know.
> You could try with a constrained string subtype, say String(1 .. 10),
I assume if I use that within a function, I'd run into the same problem
because the function might be called more often, thus still requiring
dynamic allocation. Since I know that only one instance of the driver
will be used single threaded, and only one buffer is used, I could
declare it in the modules declaration section rather than the function.
> what you should use. Perhaps you can wrap it up as a user-defined Ada
> "storage pool" (see the Ada RM 13.11) which would let you use the "new"
> statement
This sounds like just what I need - I will definitely have a closer look
at it, thanks a bunch!
> or you can write an Ada binding in the same way as for your C
> wrappers. kmalloc seems to return a C "void *". Assuming that this is
> implemented as an address, you should be able to use the predefined Ada
> package System.Address_To_Access_Conversions to convert the kmalloc
> result to a pointer of any type you want (but beware memory alignment
> errors -- the documentation for kmalloc that I found did not promise to
> return memory aligned in any particular way).
Thanks, sounds like a good starting point to gather some further
information myself.
next prev parent reply other threads:[~2015-05-18 9:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 8:27 Linux kernel module - memory allocation q.kontinuum
2015-05-18 8:56 ` Niklas Holsti
2015-05-18 9:19 ` q.kontinuum [this message]
2015-05-18 16:02 ` Niklas Holsti
2015-05-18 17:34 ` Simon Clubley
2015-05-18 19:25 ` jan.de.kruyf
2015-05-19 5:30 ` q.kontinuum
2015-05-19 7:18 ` jan.de.kruyf
2015-05-19 7:56 ` q.kontinuum
2015-05-19 8:06 ` jan.de.kruyf
2015-05-19 10:20 ` Mart van de Wege
2015-05-19 11:14 ` jan.de.kruyf
2015-05-19 11:16 ` G.B.
2015-05-19 9:52 ` Simon Wright
2015-05-19 11:11 ` jan.de.kruyf
2015-05-18 19:48 ` q.kontinuum
2015-05-18 20:18 ` rrr.eee.27
2015-05-18 21:09 ` q.kontinuum
2015-05-18 19:35 ` q.kontinuum
2015-05-18 20:19 ` jan.de.kruyf
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox