Commit ff4dc30b authored by Kevin Vigor's avatar Kevin Vigor
Browse files

Fix semihosting::debug::exit() on riscv64 QEMU targets.

QEMU's handler for REPORT_EXCEPTION (a.k.a. TARGET_SYS_EXIT in QEMU sources)
expects two arguments for 64-bit systems, including riscv64. In the event
that a second argument is not provided, QEMU takes an error path which does
*not* exit the simulation.

The net result is that semihosting::debug::exit() hangs on riscv64 qemu
simulation.

Provide the necessry extra paramater to the syscall so that exit now
works properly.

Note that the second parameter only affects the simulator exit code if
the first parameter is ApplicationExit, and we use ApplicationExit only
for successful exit, so we can simply hardcode 0 as second parameter. On
the error path we set first parameter to RunTimeErrorUnknown and QEMU
properly returns exit code 1 regardless of second parameter.
parent 2fc23fe4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment