This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding user mode support to Arm HAL


>>>>> Pierre Habraken writes:

>> I submit to you the patch attached below.
>> This patch aims to provide Redboot (actually HAL) for Arm with the
>> capability to debug Arm programs running in USER mode.

>          .code   32
>  undefined_instruction:
>          ldr     sp,.__undef_exception_stack     // get good stack
> @@ -579,18 +580,30 @@
>          // r4 holds original svc lr, which must also be preserved
>          //
 
> +
>          stmfd   sp!,{r0-r2,r4,r5}       // push svc_sp, svc_lr, vector, psr, pc
         
> +#ifdef CYGOPT_HAL_ARM_WITH_USER_MODE
> +        // did exception occur in user mode ?
> +        and     r2, r1, #CPSR_MODE_BITS
> +        cmp     r2, #CPSR_USER_MODE
> +        bne     1f
> +        stmfd   sp, {r8-r12, sp, lr}^   // get user mode regs
> +        sub     sp, sp, #4*7
> +        bal     2f
> +1:
> +#endif
>          // switch to pre-exception mode to get banked regs
>          mov     r0,sp                   // r0 survives mode switch
>          mrs     r2,cpsr                 // Save current psr for return
> +
>          orr     r1,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
>          bic     r1,r1,#CPSR_THUMB_ENABLE
>          msr     cpsr,r1
>          stmfd   r0!,{r8-r12,sp,lr}
>          msr     cpsr,r2                 // back to svc mode
>          mov     sp,r0                   // update stack pointer
> -
> +2:
>          // now save pre-exception r0-r7 on current stack
>          ldmfd   r3,{r0-r5}
>          stmfd   sp!,{r0-r7}
           ^^^^^^^^^^^^^^^^^^^

Is this really saving user mode r0-r7? Looks like its saving svc mode
regs.

--Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]