summaryrefslogtreecommitdiff
path: root/libcpu/mips/common/stack.c
diff options
context:
space:
mode:
authorbigmagic <[email protected]>2020-04-06 15:46:28 +0800
committerbigmagic <[email protected]>2020-04-07 14:39:12 +0800
commit990f731b776055390db854f9cc980799e39247e8 (patch)
treec07fb69875a233a156e8dca034bd7d6714fb4a2a /libcpu/mips/common/stack.c
parent0f26ffa7a26117396e2763fa74bf397cf907efe3 (diff)
fix mips64 some bug
Diffstat (limited to 'libcpu/mips/common/stack.c')
-rw-r--r--libcpu/mips/common/stack.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libcpu/mips/common/stack.c b/libcpu/mips/common/stack.c
index b0e613c7a7..b933b184e7 100644
--- a/libcpu/mips/common/stack.c
+++ b/libcpu/mips/common/stack.c
@@ -16,8 +16,8 @@ register rt_uint32_t $GP __asm__ ("$28");
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit)
{
- static rt_uint32_t wSR=0;
- static rt_uint32_t wGP;
+ static rt_ubase_t wSR=0;
+ static rt_ubase_t wGP;
rt_uint8_t *stk;
struct pt_regs *pt;
@@ -25,26 +25,27 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
rt_uint32_t i;
/* Get stack aligned */
- stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
+ stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_ubase_t)stack_addr, 8);
stk -= sizeof(struct pt_regs);
pt = (struct pt_regs*)stk;
+#ifndef ARCH_MIPS64
for (i = 0; i < 8; ++i)
{
pt->pad0[i] = 0xdeadbeef;
}
-
+#endif
/* Fill Stack register numbers */
for (i = 0; i < 32; ++i)
{
pt->regs[i] = 0xdeadbeef;
}
- pt->regs[REG_SP] = (rt_uint32_t)stk;
- pt->regs[REG_A0] = (rt_uint32_t)parameter;
- pt->regs[REG_GP] = (rt_uint32_t)$GP;
- pt->regs[REG_FP] = (rt_uint32_t)0x0;
- pt->regs[REG_RA] = (rt_uint32_t)texit;
+ pt->regs[REG_SP] = (rt_ubase_t)stk;
+ pt->regs[REG_A0] = (rt_ubase_t)parameter;
+ pt->regs[REG_GP] = (rt_ubase_t)$GP;
+ pt->regs[REG_FP] = (rt_ubase_t)0x0;
+ pt->regs[REG_RA] = (rt_ubase_t)texit;
pt->hi = 0x0;
pt->lo = 0x0;
@@ -53,7 +54,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad
pt->cp0_status |= (ST0_CU1 | ST0_FR);
#endif
pt->cp0_cause = read_c0_cause();
- pt->cp0_epc = (rt_uint32_t)tentry;
+ pt->cp0_epc = (rt_ubase_t)tentry;
pt->cp0_badvaddr = 0x0;
return stk;