Calling function from address

Jeff Haran jharan at bytemobile.com
Tue Jun 7 17:10:08 EDT 2011


> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
> bounces at kernelnewbies.org] On Behalf Of Micha M.
> Sent: Tuesday, June 07, 2011 1:47 PM
> To: kernelnewbies at kernelnewbies.org
> Subject: Calling function from address
> 
> Hi!
> 
> 
> Is it possible to call a function that is somewere in the
physical-address
> space? So I'd like to jump to a certain physical address, execute the
code
> there and then return to my kernel module.
> I already tried to ioremap that address and cast the new address to a
> funtion pointer and then call the function, but there where some page
> faults.

Just guessing, but I suspect that ioremap() does not enable execute
permission in the virtual memory pages it allocates to the physical
address and that's why you are getting the page fault.

You might have to muck with the PTEs directly to enable execution.
 
> 
> Regards
> 
> #micha
> 
> --
> /* To err is human; to really fuck things up requires the root
password */
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies





More information about the Kernelnewbies mailing list