From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <43CD8DBF.7020604@khjk.org> Date: Wed, 18 Jan 2006 01:37:19 +0100 From: Sven Moritz Hallberg User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Drawterm on Mac Mini w/Ubuntu Linux References: <5ce274511bc366386f805a19f1f90dc9@9netics.com> In-Reply-To: <5ce274511bc366386f805a19f1f90dc9@9netics.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEFCD3B875B1D542B8C7A46C4" Topicbox-Message-UUID: ddbf9792-ead0-11e9-9d60-3106f5b1d025 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEFCD3B875B1D542B8C7A46C4 Content-Type: multipart/mixed; boundary="------------090607090804070108010601" This is a multi-part message in MIME format. --------------090607090804070108010601 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Skip Tavakkolian schrieb: >>gcc -Wall -Wno-missing-braces -ggdb -I.. -I../include -I../kern -c >>-I/usr/X11R6/include -D_THREAD_SAFE -pthread -O2 tas.c >>/tmp/cc4SeP4G.s: Assembler messages: > > > what's $arch set to? was G4 support added recently? My PowerBook (also with Ubuntu Linux) sets it to "ppc", via uname -m, as per Make.unix. For MacOS X, $arch is appearently set to "power", so as a quick work-around to the assembly problems, I copied posix-power to posix-ppc and changed tas.c as attached. The only problem seems to be a slight disagreement in assembly syntax between MacOS and Linux. *shrug* Regards, Sven Moritz PS. In fact, the only thing different on Linux is that register names are not profixed with 'r', so, for example, instead of "li r0,0" on MacOS, it's just "li 0,0" on Linux... PPS. Do I hear the #ifdef's calling? *duck* No! No! No! --------------090607090804070108010601 Content-Type: text/x-csrc; name="tas.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tas.c" #include "u.h" #include "libc.h" /* * first argument (l) is in r3 at entry. * r3 contains return value upon return. */ int tas(long *x) { int v; /* * this __asm__ works with gcc 2.95.2 (mac os x 10.1). * this assembly language destroys r0 (0), some other register (v), * r4 (x) and r5 (temp). */ __asm__("\n sync\n" " li 0,0\n" " mr 4,%1 /* &l->val */\n" " lis 5,0xdead /* assemble constant 0xdeaddead */\n" " ori 5,5,0xdead /* \" */\n" "tas1:\n" " dcbf 4,0 /* cache flush; \"fix for 603x bug\" */\n" " lwarx %0,4,0 /* v = l->val with reservation */\n" " cmp cr0,0,%0,0 /* v == 0 */\n" " bne tas0\n" " stwcx. 5,4,0 /* if (l->val same) l->val = 0xdeaddead */\n" " bne tas1\n" "tas0:\n" " sync\n" " isync\n" : "=r" (v) : "r" (x) : "cc", "memory", "r0", "r4", "r5" ); switch(v) { case 0: return 0; case 0xdeaddead: return 1; default: print("tas: corrupted 0x%lux\n", v); } return 0; } --------------090607090804070108010601-- --------------enigEFCD3B875B1D542B8C7A46C4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDzY3F69/aETCOz78RAtzCAJ9tG5H0zpfQT1eBqoU6qt9uaLjhOwCffVQm lLSnNsieFr/9O3Brq4S+Oak= =N2g4 -----END PGP SIGNATURE----- --------------enigEFCD3B875B1D542B8C7A46C4--