ref: 3613f5061be5fa0459cd7282ad99ede9c3cc67ea
parent: 85d0f0e1a2c05afee5a101c1e51a3ddd2ff2a5f6
author: Jacob Moody <moody@posixcafe.org>
date: Mon Dec 11 13:42:31 EST 2023
libc: deduplicate fake cycles() imeplementation to port/ This also fixes the sparc and 68020 libc, since their mkfiles referenced a dummy cycles.c that was never in their subdir. Likewise while the 68000 libc would build, linking a program against it would fail due to missing a _tas implementation. This copies the 68020 implementation to alleviate this.
--- a/sys/src/libc/68000/cycles.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <u.h>
-#include <libc.h>
-
-void cycles(uvlong*u)
-{
- *u = 0LL;
-}
--- a/sys/src/libc/68000/mkfile
+++ b/sys/src/libc/68000/mkfile
@@ -22,9 +22,9 @@
strcmp.s\
strcpy.s\
strlen.s\
+ tas.s\
CFILES=\
- cycles.c\
notejmp.c\
vlrt.c\
--- /dev/null
+++ b/sys/src/libc/68000/tas.s
@@ -1,0 +1,9 @@
+TEXT _tas(SB), $0
+
+ MOVL $0, R0
+ MOVL a+0(FP), A0
+ TAS (A0)
+ BEQ tas_1
+ MOVL $1, R0
+tas_1:
+ RTS
--- a/sys/src/libc/68020/mkfile
+++ b/sys/src/libc/68020/mkfile
@@ -26,7 +26,6 @@
vlop.s\
CFILES=\
- cycles.c\
notejmp.c\
vlrt.c\
--- a/sys/src/libc/arm/cycles.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <u.h>
-#include <libc.h>
-
-#pragma profile off
-
-void
-cycles(uvlong*u)
-{
- *u = 0LL;
-}
--- a/sys/src/libc/arm/mkfile
+++ b/sys/src/libc/arm/mkfile
@@ -20,7 +20,6 @@
vlop.s\
CFILES=\
- cycles.c\
notejmp.c\
vlrt.c\
lock.c\
--- a/sys/src/libc/mips/cycles.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <u.h>
-#include <libc.h>
-
-void cycles(uvlong*u)
-{
- *u = 0LL;
-}
--- a/sys/src/libc/mips/mkfile
+++ b/sys/src/libc/mips/mkfile
@@ -22,7 +22,6 @@
vlop.s\
CFILES=\
- cycles.c\
lock.c\
notejmp.c\
sqrt.c\
--- /dev/null
+++ b/sys/src/libc/port/cycles.c
@@ -1,0 +1,10 @@
+#include <u.h>
+#include <libc.h>
+
+#pragma profile off
+
+void
+cycles(uvlong *u)
+{
+ *u = 0LL;
+}
--- a/sys/src/libc/port/mkfile
+++ b/sys/src/libc/port/mkfile
@@ -20,6 +20,7 @@
cleanname.c\
crypt.c\
ctype.c\
+ cycles.c\
date.c\
encodefmt.c\
execl.c\
--- a/sys/src/libc/sparc/mkfile
+++ b/sys/src/libc/sparc/mkfile
@@ -22,7 +22,6 @@
vlop.s
CFILES=\
- cycles.c\
notejmp.c\
sqrt.c\
vlrt.c\
--- a/sys/src/libc/spim/mkfile
+++ b/sys/src/libc/spim/mkfile
@@ -16,7 +16,6 @@
strcpy.s\
MIPSCFILES=\
- cycles.c\
notejmp.c\
SFILES=\