This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: Adding user mode support to Arm HAL
- From: Mark Salter <msalter at redhat dot com>
- To: Pierre dot Habraken at imag dot fr
- Cc: ecos-patches at sources dot redhat dot com
- Date: Mon, 7 Apr 2003 09:22:19 -0400 (EDT)
- Subject: Re: Adding user mode support to Arm HAL
- References: <3E917138.A5918866@imag.fr> <3E9177E0.53F7D87A@imag.fr>
>>>>> 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