9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Drawterm patch -- build on latest OpenBSD/PPC
@ 2024-08-09  3:50 Jon Sharp
  2024-08-22 18:39 ` Stanley Lieber
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Sharp @ 2024-08-09  3:50 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Hey all,

Thought I'd share this trivial patch to work around the deprecation of 
the 'regnames' option on OpenBSD 7.5 for 32-bit PPC, FWIW...

--
Jon

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=ppc-regnames.patch, Size: 1351 bytes --]

diff --git a/posix-power/Makefile b/posix-power/Makefile
index d106fa7..75c8ca8 100644
--- a/posix-power/Makefile
+++ b/posix-power/Makefile
@@ -2,7 +2,7 @@ ROOT=..
 include ../Make.config
 LIB=../libmachdep.a
 
-CFLAGS+= -Wa,-mregnames
+#CFLAGS+= -Wa,-mregnames
 
 OFILES=\
 	getcallerpc.$O\
diff --git a/posix-power/tas.c b/posix-power/tas.c
index 7f9e5c0..4e52aef 100644
--- a/posix-power/tas.c
+++ b/posix-power/tas.c
@@ -15,16 +15,16 @@ tas(int *x)
 	 * r4 (x) and r5 (temp).
 	 */
 	__asm__("\n	sync\n"
-	"	li	r0,0\n"
-	"	mr	r4,%1		/* &l->val */\n"
-	"	lis	r5,0xdead	/* assemble constant 0xdeaddead */\n"
-	"	ori	r5,r5,0xdead	/* \" */\n"
+	"	li	%%r0,0\n"
+	"	mr	%%r4,%1		/* &l->val */\n"
+	"	lis	%%r5,0xdead	/* assemble constant 0xdeaddead */\n"
+	"	ori	%%r5,%%r5,0xdead	/* \" */\n"
 	"tas1:\n"
-	"	dcbf	r4,r0	/* cache flush; \"fix for 603x bug\" */\n"
-	"	lwarx	%0,r4,r0	/* v = l->val with reservation */\n"
-	"	cmp	cr0,0,%0,r0	/* v == 0 */\n"
+	"	dcbf	%%r4,%%r0	/* cache flush; \"fix for 603x bug\" */\n"
+	"	lwarx	%0,%%r4,%%r0	/* v = l->val with reservation */\n"
+	"	cmp	cr0,0,%0,%%r0	/* v == 0 */\n"
 	"	bne	tas0\n"
-	"	stwcx.	r5,r4,r0   /* if (l->val same) l->val = 0xdeaddead */\n"
+	"	stwcx.	%%r5,%%r4,%%r0   /* if (l->val same) l->val = 0xdeaddead */\n"
 	"	bne	tas1\n"
 	"tas0:\n"
 	"	sync\n"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] Drawterm patch -- build on latest OpenBSD/PPC
  2024-08-09  3:50 [9front] Drawterm patch -- build on latest OpenBSD/PPC Jon Sharp
@ 2024-08-22 18:39 ` Stanley Lieber
  2024-08-22 20:51   ` Sigrid Solveig Haflínudóttir
  0 siblings, 1 reply; 4+ messages in thread
From: Stanley Lieber @ 2024-08-22 18:39 UTC (permalink / raw)
  To: 9front

On August 8, 2024 11:50:59 PM EDT, Jon Sharp <jrsharp@sdf.org> wrote:
>Hey all,
>
>Thought I'd share this trivial patch to work around the deprecation of the 'regnames' option on OpenBSD 7.5 for 32-bit PPC, FWIW...
>
>--
>Jon
i no longer have ppc to test this with, anyone else try this out?

sl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] Drawterm patch -- build on latest OpenBSD/PPC
  2024-08-22 18:39 ` Stanley Lieber
@ 2024-08-22 20:51   ` Sigrid Solveig Haflínudóttir
  2024-08-23 20:27     ` Jon Sharp
  0 siblings, 1 reply; 4+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2024-08-22 20:51 UTC (permalink / raw)
  To: 9front

I will say it again - tas.c per platform should not exist. What gcc/clang have as builtins should be enough to do a portable version that doesn't end up broken for whatever reason.
Jon, if you can test __atomic_test_and_set approach of arm64 on ppc and tell us if it works, that'd be great. We can remove the platform-specific implementations and keep just one C file instead.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] Drawterm patch -- build on latest OpenBSD/PPC
  2024-08-22 20:51   ` Sigrid Solveig Haflínudóttir
@ 2024-08-23 20:27     ` Jon Sharp
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Sharp @ 2024-08-23 20:27 UTC (permalink / raw)
  To: 9front

Confirmed. The builtins approach borrowed directly from arm64 seems to be 
working just fine!

Thanks,
Jon

On Thu, 22 Aug 2024, Sigrid Solveig Hafl?nud?ttir wrote:

> Date: Thu, 22 Aug 2024 22:51:51 +0200
> From: Sigrid Solveig Hafl?nud?ttir <sigrid@ftrv.se>
> Reply-To: 9front@9front.org
> To: 9front@9front.org
> Subject: Re: [9front] Drawterm patch -- build on latest OpenBSD/PPC
> 
> I will say it again - tas.c per platform should not exist. What gcc/clang have as builtins should be enough to do a portable version that doesn't end up broken for whatever reason.
> Jon, if you can test __atomic_test_and_set approach of arm64 on ppc and tell us if it works, that'd be great. We can remove the platform-specific implementations and keep just one C file instead.
>

jrsharp@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-23 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-09  3:50 [9front] Drawterm patch -- build on latest OpenBSD/PPC Jon Sharp
2024-08-22 18:39 ` Stanley Lieber
2024-08-22 20:51   ` Sigrid Solveig Haflínudóttir
2024-08-23 20:27     ` Jon Sharp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).