diff options
| author | Bernard Xiong <[email protected]> | 2019-12-11 11:01:40 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2019-12-11 11:01:40 +0800 |
| commit | a972fcc0b54ebf274cc2d16d0866385ae5e6c7cf (patch) | |
| tree | 332bd06b9f14127f0bd077b9469e7f3a14207865 /libcpu/mips/x1000/stack.c | |
| parent | ea507e2e81bc0bf4ddfa17124dd1a9e585d7c281 (diff) | |
[BSP] move libcpu/mips/x1000 to bsp/x1000/cpu
Diffstat (limited to 'libcpu/mips/x1000/stack.c')
| -rw-r--r-- | libcpu/mips/x1000/stack.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/libcpu/mips/x1000/stack.c b/libcpu/mips/x1000/stack.c deleted file mode 100644 index 0043ea2a21..0000000000 --- a/libcpu/mips/x1000/stack.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * File : stack.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016��9��8�� Urey the first version - */ - -#include <rtthread.h> - -#include "../common/mips.h" - -register U32 $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; - - mips_reg_ctx *regCtx; - mips_arg_ctx *argCtx; - rt_uint32_t i; - - if (wSR == 0) - { - wSR = read_c0_status(); - wSR &= 0xfffffffe; - wSR |= 0x0403; - - wGP = $GP; - } - - if ((rt_uint32_t) stack_addr & 0x7) - { - stack_addr = (rt_uint8_t *)((rt_uint32_t)stack_addr - 4); - } - - argCtx = (mips_arg_ctx *)((rt_uint32_t)stack_addr - sizeof(mips_arg_ctx)); - regCtx = (mips_reg_ctx *)((rt_uint32_t)stack_addr - sizeof(mips_arg_ctx) - sizeof(mips_reg_ctx)); - - for (i = 0; i < 4; ++i) - { - argCtx->args[i] = i; - } - - //����ͨ�üĴ��� - for (i = 0; i < 32; ++i) - { - regCtx->regs[i] = i; - } - - regCtx->regs[REG_SP] = (rt_uint32_t)stack_addr; - regCtx->regs[REG_A0] = (rt_uint32_t)parameter; - regCtx->regs[REG_GP] = (rt_uint32_t)wGP; - regCtx->regs[REG_FP] = (rt_uint32_t)0x0; - regCtx->regs[REG_RA] = (rt_uint32_t)texit; - - regCtx->CP0DataLO = 0x00; - regCtx->CP0DataHI = 0x00; - regCtx->CP0Cause = read_c0_cause(); - regCtx->CP0Status = wSR; - regCtx->CP0EPC = (rt_uint32_t)tentry; - regCtx->CP0BadVAddr= 0x00; - - return (rt_uint8_t *)(regCtx); -} |
