ref: 88e8cb58529889ac04caff7c3e3c8393b58dc874
parent: 462c67a09fefcb408a8bcfc43a847745b28bba3d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 13 07:27:42 EDT 2023
imx8: move fpon()/fpoff() into l.s avoid the dynamic code generating syswr() in the hot path...
--- a/sys/src/9/imx8/fns.h
+++ b/sys/src/9/imx8/fns.h
@@ -14,6 +14,8 @@
extern void forkret(void);
extern void noteret(void);
extern void returnto(void*);
+extern void fpon(void);
+extern void fpoff(void);
extern void fpsaveregs(void*);
extern void fploadregs(void*);
extern void smccall(Ureg*);
--- a/sys/src/9/imx8/fpu.c
+++ b/sys/src/9/imx8/fpu.c
@@ -20,18 +20,6 @@
}
void
-fpon(void)
-{
- syswr(CPACR_EL1, 3<<20);
-}
-
-void
-fpoff(void)
-{
- syswr(CPACR_EL1, 0<<20);
-}
-
-void
fpinit(void)
{
fpon();
--- a/sys/src/9/imx8/l.s
+++ b/sys/src/9/imx8/l.s
@@ -394,6 +394,19 @@
ISB $SY
RETURN
+/*
+ * floating-point support.
+ */
+TEXT fpon(SB), 1, $-4
+ MOVW $(3<<20), R0
+ MSR R0, CPACR_EL1
+ RETURN
+
+TEXT fpoff(SB), 1, $-4
+ MOVW $(0<<20), R0
+ MSR R0, CPACR_EL1
+ RETURN
+
TEXT fpsaveregs(SB), 1, $-4
WORD $(1<<30 | 3 << 26 | 2<<22 | 0x1F<<16 | 3<<10 | 0<<5 | 0) /* MOV { V0, V1, V2, V3 }, (R0)64! */
WORD $(1<<30 | 3 << 26 | 2<<22 | 0x1F<<16 | 3<<10 | 0<<5 | 4) /* MOV { V4, V5, V6, V7 }, (R0)64! */