[lkml]   [2002]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectextending callbacks?

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 Scheidegger Institute of Computer Science and Applied Mathematics |
| University of Bern Neubrueckstr. 10, CH-3012 Bern, Switzerland |
| Phone: +41 31-6318692 Fax: +41 31-6313261 |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:21    [W:0.081 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site