From: Sven Moritz Hallberg <sm@khjk.org>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] Drawterm on Mac Mini w/Ubuntu Linux
Date: Wed, 18 Jan 2006 01:37:19 +0100 [thread overview]
Message-ID: <43CD8DBF.7020604@khjk.org> (raw)
In-Reply-To: <5ce274511bc366386f805a19f1f90dc9@9netics.com>
[-- Attachment #1.1: Type: text/plain, Size: 888 bytes --]
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!
[-- Attachment #1.2: tas.c --]
[-- Type: text/x-csrc, Size: 972 bytes --]
#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;
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 264 bytes --]
next prev parent reply other threads:[~2006-01-18 0:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-17 1:14 Gregory Pavelcak
2006-01-17 1:19 ` Russ Cox
2006-01-17 11:17 ` Gregory Pavelcak
2006-01-17 12:00 ` erik quanstrom
2006-01-17 21:11 ` Gregory Pavelcak
2006-01-17 21:40 ` Russ Cox
2006-01-17 22:08 ` Gregory Pavelcak
2006-01-17 22:13 ` Russ Cox
2006-01-17 22:28 ` Gregory Pavelcak
2006-01-17 22:55 ` Charles Forsyth
2006-01-17 22:33 ` Skip Tavakkolian
2006-01-17 21:41 ` Gregory Pavelcak
2006-01-17 22:40 ` Skip Tavakkolian
2006-01-18 0:37 ` Sven Moritz Hallberg [this message]
2006-01-17 1:20 ` Federico G. Benavento
2006-01-17 1:22 ` andrey mirtchovski
2006-01-17 1:25 ` [9fans] " Uriel
2006-01-17 1:34 ` andrey mirtchovski
2006-01-17 1:40 ` Russ Cox
2006-01-17 7:32 ` lucio
2006-01-17 7:29 ` lucio
2006-01-17 20:40 ` Micah Stetson
2006-01-17 10:06 ` Charles Forsyth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43CD8DBF.7020604@khjk.org \
--to=sm@khjk.org \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).