Macintosh.

This commit is contained in:
rsc 2003-10-03 15:33:45 +00:00
parent d4853cf44b
commit 98014aa543
7 changed files with 62 additions and 20 deletions

14
package
View file

@ -2,18 +2,8 @@
rm -rf ../9tmp
mkdir ../9tmp
mkdir ../9pkg
cp -R * ../9tmp
cd ../9tmp
rm -rf `find . -name CVS`
rm lib/*
rm */*.o
rm */*.a
rm mk/mk
rm sam/sam
rm man/*/*
for i in libfmt libbio lib9 libthread libutf libregexp sam mk
do
tar cf - $i |gzip >../9pkg/$i.tar.gz
done
tar cf - . | gzip > ../9pkg/all.tar.gz
make nuke
tar cf - . | gzip >~/public_html/9src.tar.gz

View file

@ -13,8 +13,8 @@ CMDS=\
sam\
samterm\
clean all install nuke:
for i in $(LIBS) $(DIRS); \
all clean install nuke:
for i in $(LIBS) $(CMDS); \
do \
(echo $$i; cd $$i; $(MAKE) $@); \
done

View file

@ -4,6 +4,7 @@ $(TARG): $(OFILES)
$(CC) -o $(TARG) $(OFILES) $(LDFLAGS)
CLEANFILES+=$(TARG)
NUKEFILES+=$(9SRC)/bin/$(TARG)
include $(9SRC)/Makecommon

View file

@ -0,0 +1,5 @@
.text
.globl _getcallerpc
_getcallerpc:
mflr r3
blr

View file

@ -0,0 +1,42 @@
#include "u.h"
#include "libc.h"
/*
* first argument (l) is in r3 at entry.
* r3 contains return value upon return.
*/
int
_tas(void *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 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"
" bne tas0\n"
" stwcx. r5,r4,r0 /* 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;
}

View file

@ -17,14 +17,12 @@ void
memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp,
Memimage *mask, Point mp, int op)
{
int drew;
Memdrawparam *par;
if((par = _memimagedrawsetup(dst, r, src, sp, mask, mp, op)) == nil)
return;
if(xdraw(par))
return;
/* only fetch dst data if we need it */
if((par->state&(Simplemask|Fullmask)) != (Simplemask|Fullmask))
xgetxdata(dst, par->r);
@ -36,6 +34,9 @@ memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp,
/* now can run memimagedraw on the in-memory bits */
_memimagedraw(par);
if(xdraw(par))
return;
/* put bits back on x server */
xputxdata(dst, par->r);
}
@ -67,7 +68,7 @@ xdraw(Memdrawparam *par)
m = Simplesrc|Simplemask|Fullmask;
if((state&m) == m){
xfillcolor(dst, r, par->sdval);
xdirtyxdata(dst, r);
// xdirtyxdata(dst, r);
return 1;
}
@ -86,7 +87,7 @@ xdraw(Memdrawparam *par)
XCopyArea(_x.display, xsrc->pixmap, xdst->pixmap, gc,
sp.x, sp.y, Dx(r), Dy(r), dp.x, dp.y);
xdirtyxdata(dst, r);
// xdirtyxdata(dst, r);
return 1;
}
@ -131,7 +132,7 @@ xdraw(Memdrawparam *par)
XSetTSOrigin(_x.display, gc, mp.x, mp.y);
XFillRectangle(_x.display, xdst->pixmap, gc, dp.x, dp.y,
Dx(r), Dy(r));
xdirtyxdata(dst, r);
// xdirtyxdata(dst, r);
return 1;
}

View file

@ -30,6 +30,8 @@ xgetxdata(Memimage *m, Rectangle r)
if(xm->dirty == 0)
return xm->xi;
abort(); /* should never call this now */
r = xm->dirtyr;
if(Dx(r)==0 || Dy(r)==0)
return xm->xi;
@ -102,6 +104,7 @@ xdirtyxdata(Memimage *m, Rectangle r)
xm = m->X;
if(xm == nil)
return;
xm->dirty = 1;
addrect(&xm->dirtyr, r);
}