This is my function : static spinlock_t xgr_learn_lock = SPIN_LOCK_UNLOCKED; static int piga_seq_cpt = 1; /* * Function called for each systemcall (Hook SELinux avc function) */ int piga_control(u32 ssid, ...., struct av_decision * avd) { /* * Here my hypercall work but block my vm with this error : * " BUG: scheduling while atomic ... " */ spin_lock_bh(&xgr_learn_lock); if ( in_atomic()) kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned long)piga_seq_cpt); spin_unlock_bh(&xgr_learn_lock); if (piga_on == 1) { /* * Here my hypercall make a kernel panic with this error: * " divide error: 0000 [#1] SMP" */ spin_lock_bh(&xgr_learn_lock); set_current_state(TASK_UNINTERRUPTIBLE); kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned long)piga_seq_cpt); set_current_state(TASK_RUNNING); spin_lock_bh(&xgr_learn_lock); } }
Date: Wed, 8 Jun 2011 12:50:57 +0200 From: kernelnewbies@mail.i88.de To: kernelnewbies@kernelnewbies.org Subject: Re: Calling function from address CC: mulyadi.santosa@gmail.com
On Wed, Jun 08, 2011 at 04:52:14PM +0700, Mulyadi Santosa wrote:
On Wed, Jun 8, 2011 at 03:47, Micha M. <kernelnewbies@mail.i88.de> wrote:
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.
Interesting, and after page fault....the code is still not executed?
what code(s) do you call? user mode? kernel mode?
I don't think that the code was executed. There was a kernel Ooops direct after the page fault and a register dump was printed. The code I what to call is located in ROM and is mapped to the physical address space. Is it possible to configure the kernel to ignore certain address areas and allow calls to that space?
And that code needs to be executed from that place, since it contains pointer in the physical address space. (s oremapping won't work because there are absolute jumps in that function I'd like to call)
The only solution I kan think of at the moment is to solve it somehow in assembly. But I don't know how...
regards,
#micha
-- /* To err is human; to really fuck things up requires the root password */
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies