l4-hackers Digest, Vol 112, Issue 3

Adam Lackorzynski adam at os.inf.tu-dresden.de
Fri Aug 3 16:04:51 CEST 2012

On Fri Aug 03, 2012 at 19:37:21 +0800, raylei0825ssdut wrote:
> I just remove the statement "msr cpsr_c,r7". But It just doesn't Work. And If I change the code to the following:
> I set the vcpu_state_t registers  as following :
>   vcpu->r()->r[6]=(l4_umword_t)exit_map_addr;
>   vcpu->r()->r[4]=(l4_umword_t)(idle_stack+sizeof(idle_stack)-1);  vcpu->r()->ip =(l4_umword_t)super_code_map_addr;  vcpu->r()->r[5] = (l4_umword_t)idle_code_map_addr;  vcpu->r()->sp = (l4_umword_t)0x30000;
> and I change the my_super_code :
> asm (    ".pushsection .text\n"  ".p2align 12         \t\n"  ".global my_super_code  \t\n"  "my_super_code:   \t\n"
> " swi 0       \t\n"
> " mov sp, r4   \t\n"" mov lr, r6   \t\n"" mov pc, r5   \t\n"".popsection");
> and still, it doesn't work.And The vcpu upcall function 
> will be called again and again.

The first instruction to be executed is the 'swi' which will cause a
call of the entry. There it needs to be handled, check for example the
pc value you're getting, it should point to the location. After handling
the swi, the pc needs to be adapted to point behind the instruction (or
whereever you like the code to go on). If the pc is not adapted, a
resume will continue on the swi and everything will start again.
r4 is also unaligned. There's no need to substract 1 but if you want to
you should substract multiple of 4.

Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

More information about the l4-hackers mailing list