diff options
| author | Bernard Xiong <[email protected]> | 2021-04-09 08:47:27 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-09 08:47:27 +0800 |
| commit | c6540b8cbf7d2bb452625b9f244c0e6cfdbdaba5 (patch) | |
| tree | 53f4f48c14b1fc73416415bcb0b110ed3ad85693 /libcpu | |
| parent | 9bc3896e41716f6415e948ffea153a5453fe4b34 (diff) | |
| parent | 42867186b278d17a67383bdccdf51f9f36b6ba60 (diff) | |
Merge pull request #4584 from rtthread-bot/rtt_bot
[update] RT-Thread Robot automatic submission
Diffstat (limited to 'libcpu')
| -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; |
