Re: [HELP] How to get address of module

From: Hiroki Kaminaga
Date: Mon Aug 08 2005 - 19:53:21 EST


From: "linux-os \(Dick Johnson\)" <linux-os@xxxxxxxxxxxx>
Subject: Re: [HELP] How to get address of module
Date: Mon, 8 Aug 2005 09:51:25 -0400

> What do you want the address of in your driver? Do you want the
> address of its various entry points (hint, the stuff you put
> into the "struct file_operations"), or its startup code, module_init(),
> exit code, module_exit(), etc.
>
> These are can all be obtained using conventional 'C' syntax. You
> don't need to search some list somehere. You driver isn't just
> put somewhere en-masse. The code is in the .text segment, relocated
> to exist in allocated memory. The data sections are also relocated
> to different sections of allocated memory.
>
> You get the address of a function by referencing its name:
>
> static int ioctl(struct inode *inp, struct file *fp, size_t cmd, unsigned long
> arg)
> {
> unsigned long val;
> switch(cmd)
> {
> case GET_ADDRESS_OF_IOCTL:
> val = (unsigned long) ioctl;
> if(put_user(val, (unsigned long *)arg))
> return -EFAULT
> break;
> case ETC:
> }
>
> Your driver probably has many functions, therefore it has many
> addresses. It's not just a single "module" somewhere.

Thank you.

What I wanted is: given the segfault address, I would like to

1) get which module it is in
2) in that module, within which function it segfaulted

module_address_lookup() would do!

HK.
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/