qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Fix ARM v7m gen_intermediate_code()


From: Christopher Friedt
Subject: [Qemu-devel] [PATCH] Fix ARM v7m gen_intermediate_code()
Date: Thu, 23 Aug 2018 12:36:58 -0400

Hi list,

I hope this message finds you well, as I'm currently on a lake in the
middle of nowhere relying on my flaky cellular connection. Roaming
sucks. In any case, I found a bug while trying to execute the "svc 0"
instruction for cortex-m3.

A UsageFault (EXCP_INVSTATE) is injected at
target/arm/translate.c:disas_arm_insn() without the patch. I noticed
because I added a log statement to the effect, so my pre-patch output
was:

$ qemu-system-arm -d int  -M netduino2 -cpu cortex-m3  -S -s
-semihosting -nographic -kernel hello.bin
Taking exception 2 [SVC]
... as 11
M variants do not implement ARM mode.
Taking exception 18 [v7M INVSTATE UsageFault]
... as 3
M variants do not implement ARM mode.
Taking exception 18 [v7M INVSTATE UsageFault]
qemu: fatal: Lockup: can't escalate 3 to HardFault (current priority -1)

R00=2000079c R01=0000008c R02=00000000 R03=000f0005
R04=2000071c R05=20000808 R06=00000000 R07=000f0005
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=200018e0 R14=fffffff1 R15=00000000
XPSR=00000003 ---- A handler
FPSCR: 00000000
Abort trap: 6

My post-patch output is:

$ qemu-system-arm -d int  -M netduino2 -cpu cortex-m3  -S -s
-semihosting -nographic -kernel hello.bin
Taking exception 2 [SVC]
... as 11
Taking exception 8 [QEMU v7M exception exit]
Exception return: magic PC fffffffd previous exception 11
...successful exception return
Taking exception 2 [SVC]
... as 11
Taking exception 8 [QEMU v7M exception exit]
Exception return: magic PC fffffffd previous exception 11
...successful exception return
qemu-system-arm: QEMU: Terminated via GDBstub

The patch is attached. Should be ok to go against master - i synced
before I went on vacation. Otherwise, I'd be happy to make any fixups
when I get back ;-)

Cheers,

C

Attachment: qemu-system-arm-do-not-die-on-v7m-exception.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]