Port-arm archive

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

Re: earm(v5) not working on RPi



I wrote:
>It looks like the illegal instruction traps are being triggered by some
>SWP instructions in libc.
>
>These instructions are deprecated in ARMv6 and above.
>
>It seems that there is a mode that ARMv7 processors can run in where
>they disable these instructions and generate an exception if one is
>executed.
>
>The idea is that the kernel trap handler maps them onto LDREX and STREX
>instructions. Linux does seem to have code to do this.
>
>The SWP instructions are not in ARMv8 at all so if we want to be able to
>run older arm binaries then we probably want to emulate them there.

Alternatively we could try the following patch. It seems to work so
far.

I haven't found out whether SWP is supposed to work correctly on a
multiprocessor system but I'm guessing that the toolchain is single
threaded.

Index: cpufunc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm/cpufunc.c,v
retrieving revision 1.175
diff -u -r1.175 cpufunc.c
--- cpufunc.c   20 Oct 2018 06:35:34 -0000      1.175
+++ cpufunc.c   17 Jul 2019 18:58:40 -0000
@@ -2941,6 +2941,7 @@
            CPU_CONTROL_MMU_ENABLE |
            CPU_CONTROL_IC_ENABLE |
            CPU_CONTROL_DC_ENABLE |
+           CPU_CONTROL_SWP_ENABLE |
            CPU_CONTROL_BPRD_ENABLE |
            CPU_CONTROL_UNAL_ENABLE |
            0;


Home | Main Index | Thread Index | Old Index