|
|
1.1 ! root 1: #include <u.h> ! 2: #include <libc.h> ! 3: ! 4: /* Routines for letting gbitblt run at user level */ ! 5: ! 6: enum { ! 7: nbbarena = 20000, ! 8: linewords = (64/sizeof(ulong)), ! 9: }; ! 10: ! 11: static ulong bbarena[nbbarena]; ! 12: static ulong *bbcur = bbarena; ! 13: static ulong *bblast = bbarena; ! 14: ! 15: void * ! 16: bbmalloc(int nbytes) ! 17: { ! 18: int nw; ! 19: ulong *ans; ! 20: ! 21: nw = nbytes/sizeof(long); ! 22: if(bbcur + nw > &bbarena[nbbarena]) ! 23: ans = bblast = bbarena; ! 24: else ! 25: ans = bbcur; ! 26: bbcur = ans + nw; ! 27: if(ans == bbarena) ! 28: segflush(ans, nbbarena*sizeof(ulong)); ! 29: bblast = ans; ! 30: return ans; ! 31: } ! 32: ! 33: void ! 34: bbfree(void *a, int n) ! 35: { ! 36: USED(a); ! 37: bbcur = (ulong *)(((char *)bblast) + n + linewords*sizeof(long)); ! 38: } ! 39: ! 40: int ! 41: bbonstack(void) ! 42: { ! 43: #ifdef Tmips ! 44: return 0; ! 45: #else ! 46: return 1; ! 47: #endif ! 48: } ! 49: ! 50: #ifdef T68020 ! 51: void ! 52: flushvirtpage(void *p) ! 53: { ! 54: segflush(p, 200); /* 200 > bytes in biggest non-converting bitblt */ ! 55: } ! 56: ! 57: void ! 58: bbdflush(void *p, int n) ! 59: { ! 60: segflush(p, n); ! 61: } ! 62: #endif ! 63: ! 64: #ifdef Tmips ! 65: void ! 66: wbflush(void) ! 67: { ! 68: /* mips has write-through data cache */ ! 69: /* assume this call is enough to trickle data cache out */ ! 70: } ! 71: ! 72: void ! 73: icflush(void *p, int n) ! 74: { ! 75: segflush(p, n); ! 76: } ! 77: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.