From 98014aa54361143450d0d9869369b6e3cb715f28 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 3 Oct 2003 15:33:45 +0000 Subject: Macintosh. --- package | 14 ++---------- src/Makefile | 4 ++-- src/Makeone | 1 + src/lib9/getcallerpc-PowerMacintosh.s | 5 +++++ src/lib9/tas-PowerMacintosh.c | 42 +++++++++++++++++++++++++++++++++++ src/libdraw/x11-draw.c | 13 ++++++----- src/libdraw/x11-get.c | 3 +++ 7 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 src/lib9/getcallerpc-PowerMacintosh.s create mode 100644 src/lib9/tas-PowerMacintosh.c diff --git a/package b/package index 5b1a8a4e..ba135073 100755 --- a/package +++ b/package @@ -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 diff --git a/src/Makefile b/src/Makefile index 30ff19e1..19326a0d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/Makeone b/src/Makeone index 62292855..4f8e9488 100644 --- a/src/Makeone +++ b/src/Makeone @@ -4,6 +4,7 @@ $(TARG): $(OFILES) $(CC) -o $(TARG) $(OFILES) $(LDFLAGS) CLEANFILES+=$(TARG) +NUKEFILES+=$(9SRC)/bin/$(TARG) include $(9SRC)/Makecommon diff --git a/src/lib9/getcallerpc-PowerMacintosh.s b/src/lib9/getcallerpc-PowerMacintosh.s new file mode 100644 index 00000000..3571b744 --- /dev/null +++ b/src/lib9/getcallerpc-PowerMacintosh.s @@ -0,0 +1,5 @@ +.text +.globl _getcallerpc +_getcallerpc: + mflr r3 + blr diff --git a/src/lib9/tas-PowerMacintosh.c b/src/lib9/tas-PowerMacintosh.c new file mode 100644 index 00000000..29928ce0 --- /dev/null +++ b/src/lib9/tas-PowerMacintosh.c @@ -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; +} diff --git a/src/libdraw/x11-draw.c b/src/libdraw/x11-draw.c index 33b92c87..ee91791d 100644 --- a/src/libdraw/x11-draw.c +++ b/src/libdraw/x11-draw.c @@ -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; } diff --git a/src/libdraw/x11-get.c b/src/libdraw/x11-get.c index feed46c6..a6d4b12e 100644 --- a/src/libdraw/x11-get.c +++ b/src/libdraw/x11-get.c @@ -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); } -- cgit v1.2.3