|
|
|
1991/0723/sys/src/9/ss/bbmalloc.c:7,27 –
1992/0116/sys/src/9/ss/bbmalloc.c:7,12
(short | long)
|
|
1991/0723
| |
/*
* Allocate memory for use in kernel bitblts.
* The allocated memory must have a flushed instruction
* cache, and the data cache must be flushed by bbdflush().
* To avoid the need for frequent cache flushes, the memory
* is allocated out of an arena, and the i-cache is only
* flushed when it has to be reused. By returning an
* address in non-cached space, the need for flushing the
* d-cache is avoided.
*
* Currently, the only kernel users of bitblt are devbit,
* print, and the cursor stuff in devbit. The cursor
* can get drawn at clock interrupt time, so it might need
* to bbmalloc while another bitblt is going on.
*
* This code will have to be interlocked if we ever get
* a multiprocessor with a bitmapped display.
*/
/* a 0->3 bitblt can take 900 words */
|
|
1991/0723/sys/src/9/ss/bbmalloc.c:48,57 –
1992/0116/sys/src/9/ss/bbmalloc.c:33,38
|
|
1991/0723
| |
ans = bbcur;
bbcur = ans + nw;
splx(s);
/*
if(ans == bbarena)
icflush(ans, sizeof(bbarena));
*/
bblast = ans;
ans = (void *)ans;
return ans;
|
|
1991/0723/sys/src/9/ss/bbmalloc.c:66,73 –
1992/0116/sys/src/9/ss/bbmalloc.c:47,56
|
|
1991/0723
| |
bbcur = (ulong *)(((char *)bblast) + n);
}
void *
bbdflush(void *p, int n)
|
|
1992/0116
| |
int
bbonstack(void)
|
|
1991/0723
| |
{
return p;
|
|
1992/0116
| |
if(u)
return 1;
return 0;
|
|
1991/0723
| |
}
|
|
|
|
1992/0116/sys/src/9/ss/bbmalloc.c:1,5 –
1992/0321/sys/src/9/ss/bbmalloc.c:1,5
(short | long)
|
|
1991/0723
| |
#include "u.h"
#include "lib.h"
|
|
1992/0321
| |
#include "../port/lib.h"
|
|
1991/0723
| |
#include "mem.h"
#include "dat.h"
#include "fns.h"
|
|
|
|
1992/0321/sys/src/9/ss/bbmalloc.c:41,48 –
1992/0711/sys/src/9/ss/bbmalloc.c:41,46
(short | long)
|
|
1991/0723
| |
void
bbfree(void *p, int n)
{
ulong *up;
if(p == bblast)
bbcur = (ulong *)(((char *)bblast) + n);
}
|
|
|
|
1992/0711/sys/src/9/ss/bbmalloc.c:1,54 –
1993/0501/sys/src/9/ss/bbmalloc.c:0
(short | long)
|
Deleted.
rsc Mon Mar 7 10:33:04 2005
|
|
1991/0723
| |
#include "u.h"
|
|
1992/0321
| |
#include "../port/lib.h"
|
|
1991/0723
| |
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
/*
* Allocate memory for use in kernel bitblts.
*/
/* a 0->3 bitblt can take 900 words */
enum {
nbbarena=8192 /* number of words in an arena */
};
static ulong bbarena[nbbarena];
static ulong *bbcur = bbarena;
static ulong *bblast = 0;
void *
bbmalloc(int nbytes)
{
int nw;
int s;
ulong *ans;
nw = nbytes/sizeof(long);
s = splhi();
if(bbcur + nw > &bbarena[nbbarena])
ans = bbarena;
else
ans = bbcur;
bbcur = ans + nw;
splx(s);
bblast = ans;
ans = (void *)ans;
return ans;
}
void
bbfree(void *p, int n)
{
if(p == bblast)
bbcur = (ulong *)(((char *)bblast) + n);
}
|
|
1992/0116
| |
int
bbonstack(void)
|
|
1991/0723
| |
{
|
|
1992/0116
| |
if(u)
return 1;
return 0;
|
|
1991/0723
| |
}
|