[okl4-developer] arm1136js instructions

Ashish Bijlani ashish.bijlani at gmail.com
Thu Jul 24 11:15:10 EST 2008


Hi,

Somehow the arm instruction "rfeia" (in function "initial_to_user")
and instruction "srsdb" (in function "arm_swi_syscall") in okl4 are
not working on arm1136jfs.

The control doesn't go to "_start" of rootserver. The system faults as
soon as last instruction in "initial_to_user" is executed. I checked
"cpsr" and "pc" values in the exception frame generated just before
the instruction "rfeia" in "initial_to_user" and found the stack frame
correct.

However, as soon as "rfeia" instruction is executed, the hardware
generates a fault - bad mode. The return from exception instruction
causes a fault. It sends mode=0x00 instead of mode=0x10. I verified
the root task exception frame, everything seems to be fine.

Below if the root task exception frame

r0             0x0      0
r1             0x0      0
r2             0x0      0
r3             0x0      0
r4             0x0      0
r5             0x0      0
r6             0x0      0
r7             0x0      0
r8             0x0      0
r9             0x0      0
r10            0x0      0
r11            0x0      0
r12            0x0      0
sp             0xf0030094

mem(0xf0030094) = pc = 0x100000
mem(0xf0030098) = cpsr = 0x10

Did I miss anything??

However, when I tried loading "cpsr" and "pc" registers from the stack
frame, it worked fine. Below is the code used -

        BEGIN_PROC(initial_to_user)
        LOAD_CONTEXT_INTO_SP

        ldr r1, [sp, #68]   // get calling cpsr
        ldr lr, [sp, #64]!  // get pc
        msr spsr_cxsf, r1   // save in spsr_svc

        ldmib   sp,     {r0-r14}^   // loading user frame
        nop
        add     sp,     sp,     #PT_SIZE-8

        movs    pc, lr      // return & move spsr_svc into cpsr

   //     rfeia   r13!              // update stack pointer -- DOESN'T WORK !!
        END_PROC(initial_to_user)




More information about the Developer mailing list