Port-m68k archive

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

Re: Intermediate step for new arch for lc040 compatibility



At Tue, 29 Apr 2025 07:55:10 +1000,
Nat Sloss wrote:
> As opposed to 14 failures with this change (same for mc68030 with
> fp emulation 
> and a full '040 in quemu).

Have you confirmed that the atf tests you used have passed on real,
known-good hardware?

You cannot use QEMU for such a purpose.
QEMU emulates 68040 as if it were 68040+6888x, which, of course,
does not exist.  (see also source code in qemu/target/m68k/)

# In addition, QEMU 6888x emulation is not good quality.  From
# this viewpoint as well, you cannot use it as a test reference,
# at least.


By the way, we can see the 68040+6888x botch easily as follows:
Build the kernel with this patch.

```
--- src/sys/arch/virt68k/conf/GENERIC.orig
+++ src/sys/arch/virt68k/conf/GENERIC
@@ -32,13 +32,11 @@
 makeoptions     COPY_SYMTAB=1

 # CPUs this kernel supports
-options                M68030
 options                M68040

 maxusers       16

 # Needed on m68040 boards to emulate some missing FP instructions
-options        FPSP

 options        DDB
 options        DIAGNOSTIC
```

Then, run virt68k on QEMU with this kernel.

 qv68k# dmesg -t | grep 680
 Qemu 9.2.2: MC68040+MMU+FPU, 4k+4k on-chip physical I/D caches
 qv68k# cat a.c
 #include <stdio.h>
 int main(int ac, char *av[])
 {
     float result;
     __asm__ volatile(
             "fmovecr #0,%%fp0;"   /* fp0 <- pi */
             "fcos.x %%fp0,%%fp0;"
             "fmove.s %%fp0,%0"
             : "=d" (result)
     );
     printf("cos(pi)=%f\n", result);
     return 0;
 }
 qv68k# cc a.c
 qv68k# ./a.out
 cos(pi)=-1.000000

QEMU/68040 ran unimplemented fcos (and fmovecr) instructions,
without any software support (FPSP)!
(In reality, if correctly emulated, you should probably see several
unimplemented FP signals before you reach the login prompt.)
---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index