henesyinit from p9f47575dc5 years agoHistory
54 lines · 755 B · C
RawDownload
#include	"u.h"#include	"../port/lib.h"#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;} voidbbfree(void *p, int n){	if(p == bblast)		bbcur = (ulong *)(((char *)bblast) + n);} intbbonstack(void){	if(u)		return 1;	return 0;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t