On Sat, 12 Jun 2021 17:27:30 +0200
Matthieu Herrb <matth...@herrb.eu> wrote:

> Normally from my build logs on macppc configure is probing for
> VMX/Altivec:
> 
> checking whether to use VMX/Altivec intrinsics... yes
> 
> and then sets
> 
> VMX_CFLAGS='-maltivec -mabi=altivec'
> 
> for the build.
> 
> If it's not the case it probably means that removing 'option ALTIVEC'
> from the kernel is not equivalent to running on a G3 machine.

Kernel without 'option ALTIVEC' makes this mistake:

$ sysctl machdep.altivec                                               
machdep.altivec=1

This is wrong, because kernel without ALTIVEC can't enable the
altivec instructions, but machdep.altivec=1 tells pixman to use
altivec.  G3 would have machdep.altivec=0.

I would keep 'option ALTIVEC', but edit the kernel's source to set
machdep.altivec=0 and to trap EXC_VEC with SIGILL.  I lost my last
diff, so here is one that I minimally tested:

Index: arch/macppc/macppc/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/macppc/macppc/machdep.c,v
retrieving revision 1.193
diff -u -p -r1.193 machdep.c
--- arch/macppc/macppc/machdep.c        8 Nov 2020 20:37:23 -0000       1.193
+++ arch/macppc/macppc/machdep.c        13 Jun 2021 03:58:22 -0000
@@ -563,7 +563,7 @@ cpu_sysctl(int *name, u_int namelen, voi
                return (sysctl_rdint(oldp, oldlenp, newp, 0));
 #endif
        case CPU_ALTIVEC:
-               return (sysctl_rdint(oldp, oldlenp, newp, ppc_altivec));
+               return (sysctl_rdint(oldp, oldlenp, newp, 0/*ppc_altivec*/));
        default:
                return EOPNOTSUPP;
        }
Index: arch/powerpc/powerpc/trap.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/powerpc/trap.c,v
retrieving revision 1.121
diff -u -p -r1.121 trap.c
--- arch/powerpc/powerpc/trap.c 20 May 2021 12:34:35 -0000      1.121
+++ arch/powerpc/powerpc/trap.c 13 Jun 2021 03:58:23 -0000
@@ -499,7 +499,7 @@ brain_damage:
         * if we do not handle it, kill the process with illegal instruction.
         */
        case EXC_PERF|EXC_USER:
-#ifdef ALTIVEC 
+#if 0/*def ALTIVEC*/ 
        case EXC_VEC|EXC_USER:
                if (ci->ci_vecproc)
                        save_vec(ci->ci_vecproc);

Reply via email to