Emulation of a math function fails for m68k Linux user mode

Bug #1881450 reported by Ahmed Karaman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Laurent Vivier

Bug Description

Please check the attached math-example.c file.
When running the m68k executable under QEMU, it results in an
"Illegal instruction" error.
Other targets don't produce this error.

Steps to reproduce the bug:

1. Download the math-example.c attached file.
2. Compile it by running:
   m68k-linux-gnu-gcc -O2 -static math-example.c -o math-example-m68k -lm
3. Run the executable with QEMU:
   /build/qemu-5.0.0/build-gcc/m68k-linux-user/qemu-m68k math-example-m68k

The output of execution is:
   Profiling function expm1f():
   qemu: uncaught target signal 4 (Illegal instruction) - core dumped
   Illegal instruction (core dumped)

Output when running on other targets:
   Profiling function expm1f():
     Elapsed time: 47 ms
     Control result: 71804.953125

Tags: m68k
Revision history for this message
Ahmed Karaman (ahmedkrmn) wrote :
description: updated
Changed in qemu:
assignee: nobody → Laurent Vivier (laurent-vivier)
Revision history for this message
Laurent Vivier (laurent-vivier) wrote :

Tracing gives me:

IN: expm1f
0x800005cc: fetoxm1x %fp2,%fp0
Disassembler disagrees with translator over instruction decoding
Please report this to <email address hidden>

(gdb) x/2hx 0x800005cc
0x800005cc: 0xf200 0x0808

The instruction is not implemented in qemu. I fix that.

Revision history for this message
Laurent Vivier (laurent-vivier) wrote :
Revision history for this message
Laurent Vivier (laurent-vivier) wrote :

Fix available.

Execution doesn't fail anymore:

  Profiling function expm1f():
    Elapsed time: 41 ms
    Control result: 71805.108342

Control result matches real hardware one:

  Profiling function expm1f():
    Elapsed time: 2152 ms
    Control result: 71805.108342

Changed in qemu:
status: New → In Progress
Changed in qemu:
status: In Progress → Confirmed
status: Confirmed → In Progress
Changed in qemu:
status: In Progress → Fix Committed
Revision history for this message
Thomas Huth (th-huth) wrote :
Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.