public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* extending callbacks?
@ 2002-03-19 10:23 Matthias Scheidegger
  2002-03-19 23:08 ` H. Peter Anvin
  2002-03-20 15:59 ` Eric W. Biederman
  0 siblings, 2 replies; 7+ messages in thread
From: Matthias Scheidegger @ 2002-03-19 10:23 UTC (permalink / raw)
  To: linux-kernel

Hi,

I've got the following problem: I want to register a callback in a kernel
structure, but I need to supply an additional argument to my own code. I.e. I
need a callback

int (*cb)(int u)

to really call

int (*real_cb)(int u, void* my_arg)

At the moment, I'm only focussing on the i386 architecture.
In user space, I'd do this by generating some machine code, which takes the
original args, pushes my_fixed_arg and calls real_cb (using mprotect to make
the generated code callable). That way I'd use a function

int (*)(int) create_callback(int (*real_cb)(int, void*), void *arg);

Is there a good way to do that in the kernel?
Not necessarily using self modifying code, I'll only use it if I must.

Please CC answers to my address, I'm not subscribed.

thanks very much,

Matthias


| Matthias Scheidegger   Institute of Computer Science and Applied Mathematics |
| University of Bern     Neubrueckstr. 10, CH-3012 Bern, Switzerland	       |
| http://www.iam.unibe.ch/~mscheid  Phone: +41 31-6318692  Fax: +41 31-6313261 |


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-03-20 21:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-19 10:23 extending callbacks? Matthias Scheidegger
2002-03-19 23:08 ` H. Peter Anvin
2002-03-19 19:32   ` Andreas Dilger
2002-03-20 15:55   ` Eric W. Biederman
2002-03-20 18:32     ` H. Peter Anvin
2002-03-20 15:59 ` Eric W. Biederman
2002-03-20 21:02   ` Matthias Scheidegger

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