umesh writes:
> 1) Why is it showing Mode USER_26 instead of SVC_32 or USER_32? Who does set
> it to USER_26?

You are displaying the value of your struct pt_regs, not a version saved
by the processor.  My guess is that they are uninitialised, and therefore
contain garbage.

> 2) I would expect the mode to be SVC_32 since ARM boots up in that mode, and
> I could not find a place
>     where the kernel switches to USER mode from the SVC mode.

There isn't a specific switch; the CPSR is restored from the SVC stack
when returning from a system call.  The sys_execve call creates a new
register set for the task, which has the saved CPSR set to either
USER_32 or USER_26.

> 3) Why does it generate a data abort when I try to change the mode to
>    FIQ_32?

because it faults in FIQ mode.

> Is it because ARM does not allow to change to a priviledged mode from
> a USER mode?

No.  The ARM never faults on an attempt to switch to a priviledged mode
from user mode; it ignores the instruction.

You're looking at the wrong place totally.  The problem is not the switch
to FIQ mode, it is what happens *while* we are in FIQ mode.

> pc : [<c00f204c>]    lr : [<c0048634>]
> sp : c0cf5e2c  ip : c0cf5e30  fp : c0cf5ee0
> r10: 02000194  r9 : ffffffff  r8 : c0da20e0
> r7 : c010fb68  r6 : 600000d1  r5 : c0cf5e74  r4 : c010fb67
> r3 : 0e0e0e00  r2 : 0e0e0e01  r1 : 0000000e  r0 : c010fb67
> Flags: Nzcv  IRQs off  FIQs off  Mode FIQ_32  Segment user
> Control: 017D  Table: C153C015  DAC: 00000015
> Process test (pid: 6, stackpage=c0cf5000)

The code you've reported is:

   0:   e2832001        add     r2, r3, #1      ; 0x1
   4:   e50b2028        str     r2, [fp, -#40]
   8:   e5d31001        ldrb    r1, [r3, #1]    <<<< faulting instruction
   c:   e3510000        cmp     r1, #0  ; 0x0
  10:   1affff04        bne     0xfffffc28

Above, r3 contains '0x0e0e0e00', which is in user space, and is probably
pointing at an unmapped page.  Now, this code doesn't exist in get_fiq_regs,
so my guess is that this is as a result of you calling kernel functions
after the 'msr cpsr, %1' instruction which is a big huge no no.

So, restore get_fiq_regs to its original version, cause the problem, and
send the oops, register dump, stack trace and code dump.
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [EMAIL PROTECTED]      --- ---
  | | | |            http://www.arm.linux.org.uk/            /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm

Reply via email to