Skip to content

Commit c6540b8

Browse files
authored
Merge pull request #4584 from rtthread-bot/rtt_bot
[update] RT-Thread Robot automatic submission
2 parents 9bc3896 + 4286718 commit c6540b8

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

libcpu/arm/cortex-a/trap.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,24 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
4747
{
4848
#ifdef RT_USING_FPU
4949
{
50-
uint32_t ins;
50+
uint32_t val;
5151
uint32_t addr;
5252

5353
if (regs->cpsr & (1 << 5))
5454
{
5555
/* thumb mode */
5656
addr = regs->pc - 2;
57-
ins = (uint32_t)*(uint16_t*)addr;
58-
if ((ins & (3 << 11)) != 0)
59-
{
60-
/* 32 bit ins */
61-
ins <<= 16;
62-
ins += *(uint16_t*)(addr + 2);
63-
}
6457
}
6558
else
6659
{
6760
addr = regs->pc - 4;
68-
ins = *(uint32_t*)addr;
6961
}
70-
if ((ins & 0xe00) == 0xa00)
62+
asm volatile ("vmrs %0, fpexc" : "=r"(val)::"memory");
63+
64+
if (!(val & 0x40000000))
7165
{
7266
/* float ins */
73-
uint32_t val = (1U << 30);
67+
val = (1U << 30);
7468

7569
asm volatile ("vmsr fpexc, %0"::"r"(val):"memory");
7670
regs->pc = addr;

0 commit comments

Comments
 (0)