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