diff options
| author | zhouji <[email protected]> | 2021-04-06 19:15:02 +0800 |
|---|---|---|
| committer | zhouji <[email protected]> | 2021-04-08 10:01:26 +0800 |
| commit | e939ffe35502b2c0ccfa709673b21a42d2253109 (patch) | |
| tree | 3ea4fae5ecfb819d750856ab3c44be031b0a3259 /libcpu/arm | |
| parent | c5a0df2254bd6fadc941a33d9066ce6b972c4274 (diff) | |
优化未定义异常时自动开启FPU的判断条件,当FPU末开启时将自动开启。
Diffstat (limited to 'libcpu/arm')
| -rw-r--r-- | libcpu/arm/cortex-a/trap.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libcpu/arm/cortex-a/trap.c b/libcpu/arm/cortex-a/trap.c index a213e776c7..3faa136677 100644 --- a/libcpu/arm/cortex-a/trap.c +++ b/libcpu/arm/cortex-a/trap.c @@ -47,30 +47,24 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs) { #ifdef RT_USING_FPU { - uint32_t ins; + uint32_t val; uint32_t addr; if (regs->cpsr & (1 << 5)) { /* thumb mode */ addr = regs->pc - 2; - ins = (uint32_t)*(uint16_t*)addr; - if ((ins & (3 << 11)) != 0) - { - /* 32 bit ins */ - ins <<= 16; - ins += *(uint16_t*)(addr + 2); - } } else { addr = regs->pc - 4; - ins = *(uint32_t*)addr; } - if ((ins & 0xe00) == 0xa00) + asm volatile ("vmrs %0, fpexc" : "=r"(val)::"memory"); + + if (!(val & 0x40000000)) { /* float ins */ - uint32_t val = (1U << 30); + val = (1U << 30); asm volatile ("vmsr fpexc, %0"::"r"(val):"memory"); regs->pc = addr; |
