ARM (Thumb Mode) _CPU_Context_switch_arm
joel.sherrill at OARcorp.com
Tue Feb 26 20:39:11 UTC 2013
On 2/26/2013 2:42 AM, Sebastian Huber wrote:
> On 02/25/2013 09:45 PM, Joel Sherrill wrote:
>> On 2/25/2013 2:14 PM, Matthew J Fletcher wrote:
>>> _CPU_Context_Initialize in cpu.c uses a hardcoded (to 0x13, not even
>>> using a #define) arm_cpu_mode variable to define the cpsr.
>>> #define ARM_PSR_M_SVC 0x13
>>> from cpu.h might be a good start.
>>> Although i just noticed the changelog,... oops.
>>> 2008-04-17 Joel Sherrill <joel.sherrill at oarcorp.com>
>>> * cpu.c: Add arm_cpu_mode so ARM BSP can overrid default value for cpsr.
>>> Maybe if this was an extern and the BSP defined the variable and
>>> initialised it it would be easier to notice. I never thought of looking
>>> in cpu.c for places to modify.
>> Wow! I don't remember that change at all. It doesn't even sound like the
>> way I would normally solve this problem. :(
>> Sebastian.. do you remember this?
> I always wondered why we have this arm_cpu_mode variable.
>> is there a better way to accomplish this?
> I would simply remove this and use:
The only BSP changing that variable is the nds
/* set the cpu mode to system user */
arm_cpu_mode = 0x1f;
What's the impact of 0x13 (default) versus 0x1f?
> void _CPU_Context_Initialize(
> Context_Control *the_context,
> uint32_t *stack_base,
> uint32_t size,
> uint32_t new_level,
> void *entry_point,
> bool is_fp
> the_context->register_sp = (uint32_t) stack_base + size ;
> the_context->register_lr = (uint32_t) entry_point;
> the_context->register_cpsr = new_level | ARM_PSR_M_SVC;
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users