initialize register r31(LP) with texit in V850/cpuport.c

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2305 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
dzzxzz@gmail.com 2012-09-25 03:19:43 +00:00
parent 76ba5137dd
commit 6dcb1207b1
1 changed files with 44 additions and 38 deletions

View File

@ -1,7 +1,7 @@
/*
* File : cpuport.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2011, RT-Thread Development Team
* COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@ -10,6 +10,7 @@
* Change Logs:
* Date Author Notes
* 2011-02-23 Bernard the first version
* 2012-09-23 lgnq initialize register r31(LP) with texit
*/
#include <rtthread.h>
@ -43,11 +44,15 @@ void rt_hw_interrupt_init(void)
*
* @return stack address
*/
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit)
rt_uint8_t *rt_hw_stack_init(void *tentry,
void *parameter,
rt_uint8_t *stack_addr,
void *texit)
{
rt_uint32_t *stk;
stk = (rt_uint32_t *)stack_addr; /* Load stack pointer */
*(--stk) = (rt_uint32_t)0x23232323; /* r23 */
*(--stk) = (rt_uint32_t)0x24242424; /* r24 */
*(--stk) = (rt_uint32_t)0x25252525; /* r25 */
@ -56,7 +61,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
*(--stk) = (rt_uint32_t)0x28282828; /* r28 */
*(--stk) = (rt_uint32_t)0x29292929; /* r29 */
*(--stk) = (rt_uint32_t)0x30303030; /* r30 */
*(--stk) = (rt_uint32_t) 0x31313131; /* r31 */
*(--stk) = (rt_uint32_t)texit; /* r31 */
*(--stk) = (rt_uint32_t)0x00000000; /* Task PSW = Interrupts enabled */
*(--stk) = (rt_uint32_t)tentry; /* Task's PC */
*(--stk) = (rt_uint32_t)0x16161616; /* r16 */
@ -73,6 +78,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
*(--stk) = (rt_uint32_t)0x05050505; /* r5 */
*(--stk) = (rt_uint32_t)0x02020202; /* r2 */
*(--stk) = (rt_uint32_t)parameter; /* r1 */
return ((rt_uint8_t *)stk);
}