예제 #1
1
파일: xec.c 프로젝트: Requaos/harvey
static void
openter(Cpu *cpu, Inst *i)
{
	print_func_entry();
	Iarg *sp, *bp;
	unsigned long oframe, nframe;
	int j, n;

	sp = areg(cpu, cpu->slen, RSP);
	bp = areg(cpu, cpu->slen, RBP);
	push(sp, bp);
	oframe = ar(bp);
	nframe = ar(sp);
	n = ar(i->a2) % 32;
	if(n > 0){
		for(j=1; j<n; j++){
			aw(bp, oframe - i->olen*j);
			push(sp, bp);
		}
		push(sp, acon(cpu, i->olen, nframe));
	}
	aw(bp, nframe);
	aw(sp, nframe - ar(i->a1));
	print_func_exit();
}
예제 #2
0
파일: dev.c 프로젝트: Requaos/harvey
int32_t
devdirread(Chan *c, char *d, int32_t n, Dirtab *tab, int ntab,
	   Devgen *gen)
{
	if (0) print_func_entry();
	int32_t m, dsz;
	Dir dir;

	for(m=0; m<n; c->dri++) {
		switch((*gen)(c, nil, tab, ntab, c->dri, &dir)){
		case -1:
			if (0) print_func_exit();
			return m;

		case 0:
			break;

		case 1:
			dsz = convD2M(&dir, (uint8_t*)d, n-m);
			if(dsz <= BIT16SZ){	/* <= not < because this isn't stat; read is stuck */
				if(m == 0)
					error(Eshort);
				if (0) print_func_exit();
				return m;
			}
			m += dsz;
			d += dsz;
			break;
		}
	}

	if (0) print_func_exit();
	return m;
}
예제 #3
0
파일: wind.c 프로젝트: dancrossnyc/harvey
void
wclosewin(Window *w)
{
	print_func_entry();
	int i;

	w->deleted = TRUE;
	if(w == input){
		input = nil;
	}
	if(w == wkeyboard)
		wkeyboard = nil;
	for(i=0; i<nhidden; i++)
		if(hidden[i] == w){
			--nhidden;
			memmove(hidden+i, hidden+i+1, (nhidden-i)*sizeof(hidden[0]));
			hidden[nhidden] = nil;
			break;
		}
	for(i=0; i<nwindow; i++)
		if(window[i] == w){
			--nwindow;
			memmove(window+i, window+i+1, (nwindow-i)*sizeof(Window*));
			w->deleted = TRUE;
			print_func_exit();
			return;
		}
	error("unknown window in closewin");
	print_func_exit();
}
예제 #4
0
파일: wind.c 프로젝트: dancrossnyc/harvey
void
wcurrent(Window *w)
{
	print_func_entry();
	if (0) {
	Window *oi;

	if(wkeyboard!=nil && w==wkeyboard) {
		print_func_exit();
		return;
	}
	oi = input;
	input = w;
	if(w != oi){
		if(oi){
			oi->wctlready = 1;
			wsendctlmesg(oi, Wakeup, nil);
		}
		if(w){
			w->wctlready = 1;
			wsendctlmesg(w, Wakeup, nil);
		}
	}
	}
	input = w;
	print_func_exit();
}
예제 #5
0
파일: dev.c 프로젝트: Requaos/harvey
/*
 * the zeroth element of the table MUST be the directory itself for ..
*/
int
devgen(Chan *c, char *name, Dirtab *tab, int ntab, int i, Dir *dp)
{
	if (0) print_func_entry();
	if(tab == 0) {
	if (0) print_func_exit();
	return -1;
	}
	if(i == DEVDOTDOT){
		/* nothing */
	}else if(name){
		for(i=1; i<ntab; i++)
			if(strcmp(tab[i].name, name) == 0)
				break;
		if(i==ntab) {
			if (0) print_func_exit();
			return -1;
		}
		tab += i;
	}else{
		/* skip over the first element, that for . itself */
		i++;
		if(i >= ntab) {
		if (0) print_func_exit();
		return -1;
		}
		tab += i;
	}
	devdir(c, tab->qid, tab->name, tab->length, eve, tab->perm, dp);
	if (0) print_func_exit();
	return 1;
}
예제 #6
0
파일: dev.c 프로젝트: Requaos/harvey
void
devdir(Chan *c, Qid qid, char *n, int64_t length, char *user,
       int32_t perm,
       Dir *db)
{
	if (0) print_func_entry();
	db->name = n;
	if(c->flag&CMSG)
		qid.type |= QTMOUNT;
	db->qid = qid;
	/*
	 * When called via devwalk c->dev is nil
	 * until the walk succeeds.
	 */
	if(c->dev != nil)
		db->type = c->dev->dc;
	else
		db->type = -1;
	db->dev = c->devno;
	db->mode = perm;
	db->mode |= qid.type << 24;
	db->atime = seconds();
	db->mtime = kerndate;
	db->length = length;
	db->uid = user;
	db->gid = eve;
	db->muid = user;
	if (0) print_func_exit();
}
예제 #7
0
파일: dev.c 프로젝트: Requaos/harvey
Chan*
devclone(Chan *c)
{
	if (0) print_func_entry();
	Chan *nc;

	if(c->flag & COPEN){
		panic("devclone: file of type %C already open\n",
			c->dev != nil? c->dev->dc: -1);
	}

	nc = newchan();

	/*
	 * The caller fills dev in if and when necessary.
	nc->dev = nil;					//XDYNXX
	 */
	nc->devno = c->devno;
	nc->mode = c->mode;
	nc->qid = c->qid;
	nc->offset = c->offset;
	nc->umh = nil;
	nc->aux = c->aux;
	nc->mqid = c->mqid;
	nc->mc = c->mc;
	if (0) print_func_exit();
	return nc;
}
예제 #8
0
파일: dev.c 프로젝트: Requaos/harvey
Chan*
devattach(int dc, char *spec)
{
	if (0) print_func_entry();
	Chan *c;
	char *buf;

	/*
	 * There are no error checks here because
	 * this can only be called from the driver of dc
	 * which pretty much guarantees devtabget will
	 * succeed.
	 */
	c = newchan();
	mkqid(&c->qid, 0, 0, QTDIR);
	c->dev = devtabget(dc, 0);
	if(spec == nil)
		spec = "";
	buf = smalloc(1+UTFmax+strlen(spec)+1);
	sprint(buf, "#%C%s", dc, spec);
	c->path = newpath(buf);
	free(buf);
	if (0) print_func_exit();
	return c;
}
예제 #9
0
파일: xec.c 프로젝트: Requaos/harvey
static void
opcmc(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] ^= CF;
	print_func_exit();
}
예제 #10
0
파일: xec.c 프로젝트: Requaos/harvey
static void
opstd(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] |= DF;
	print_func_exit();
}
예제 #11
0
파일: xec.c 프로젝트: Requaos/harvey
static void
opcli(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] &= ~IF;
	print_func_exit();
}
예제 #12
0
파일: xec.c 프로젝트: Requaos/harvey
static void
oplahf(Cpu *cpu, Inst *i)
{
	print_func_entry();
	aw(i->a1, cpu->reg[RFL]);
	print_func_exit();
}
예제 #13
0
파일: xec.c 프로젝트: Requaos/harvey
static void
oppushf(Cpu *cpu, Inst *i)
{
	print_func_entry();
	push(areg(cpu, cpu->slen, RSP), areg(cpu, i->olen, RFL));
	print_func_exit();
}
예제 #14
0
파일: dev.c 프로젝트: Requaos/harvey
Chan*
devopen(Chan *c, int omode, Dirtab *tab, int ntab, Devgen *gen)
{
	if (0) print_func_entry();
	int i;
	Dir dir;

	for(i=0;; i++) {
		switch((*gen)(c, nil, tab, ntab, i, &dir)){
		case -1:
			goto Return;
		case 0:
			break;
		case 1:
			if(c->qid.path == dir.qid.path) {
				devpermcheck(dir.uid, dir.mode, omode);
				goto Return;
			}
			break;
		}
	}
Return:
	c->offset = 0;
	if((c->qid.type & QTDIR) && omode!=OREAD)
		error(Eperm);
	c->mode = openmode(omode);
	c->flag |= COPEN;
	if (0) print_func_exit();
	return c;
}
예제 #15
0
파일: xec.c 프로젝트: Requaos/harvey
static void
oppop(Cpu *cpu, Inst *i)
{
	print_func_entry();
	pop(areg(cpu, cpu->slen, RSP), i->a1);
	print_func_exit();
}
예제 #16
0
파일: dev.c 프로젝트: Requaos/harvey
void
devpower(int i)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
예제 #17
0
파일: dev.c 프로젝트: Requaos/harvey
void
devremove(Chan* c)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
예제 #18
0
파일: dev.c 프로젝트: Requaos/harvey
void
devcreate(Chan* c, char* d, int i, int n)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
예제 #19
0
파일: dev.c 프로젝트: Requaos/harvey
int32_t
devstat(Chan *c, uint8_t *db, int32_t n, Dirtab *tab, int ntab,
	Devgen *gen)
{
	if (0) print_func_entry();
	int i;
	Dir dir;
	char *p, *elem;

	for(i=0;; i++){
		switch((*gen)(c, nil, tab, ntab, i, &dir)){
		case -1:
			if(c->qid.type & QTDIR){
				if(c->path == nil)
					elem = "???";
				else if(strcmp(c->path->s, "/") == 0)
					elem = "/";
				else
					for(elem=p=c->path->s; *p; p++)
						if(*p == '/')
							elem = p+1;
				devdir(c, c->qid, elem, 0, eve, DMDIR|0555, &dir);
				n = convD2M(&dir, db, n);
				if(n == 0)
					error(Ebadarg);
				if (0) print_func_exit();
				return n;
			}

			error(Enonexist);
		case 0:
			break;
		case 1:
			if(c->qid.path == dir.qid.path) {
				if(c->flag&CMSG)
					dir.mode |= DMMOUNT;
				n = convD2M(&dir, db, n);
				if(n == 0)
					error(Ebadarg);
				if (0) print_func_exit();
				return n;
			}
			break;
		}
	}
	if (0) print_func_exit();
}
예제 #20
0
파일: xec.c 프로젝트: Requaos/harvey
static void
opint(Cpu *cpu, Inst *i)
{
	print_func_entry();
	cpu->trap = ar(i->a1);
	longjmp(cpu->jmp, 1);
	print_func_exit();
}
예제 #21
0
파일: wind.c 프로젝트: dancrossnyc/harvey
Window*
wlookid(int id)
{
	print_func_entry();
	int i;

	fprint(2, "%d:", id);
	for(i=0; i<nwindow; i++)
		if(window[i]->id == id) {
			fprint(2, "FOUND @%p", window[i]);
			print_func_exit();
			return window[i];
		}
	fprint(2, "NOT FOUND;");
	print_func_exit();
	return nil;
}
예제 #22
0
파일: dev.c 프로젝트: Requaos/harvey
int
devconfig(int i, char *c, DevConf *d)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
	return 0;
}
예제 #23
0
파일: dev.c 프로젝트: Requaos/harvey
int32_t
devwstat(Chan* c, uint8_t* i, int32_t n)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
	return 0;
}
예제 #24
0
파일: dev.c 프로젝트: Requaos/harvey
void
mkqid(Qid *q, int64_t path, uint32_t vers, int type)
{
	if (0) print_func_entry();
	q->type = type;
	q->vers = vers;
	q->path = path;
	if (0) print_func_exit();
}
예제 #25
0
파일: wind.c 프로젝트: dancrossnyc/harvey
void
waddraw(Window *w, Rune *r, int nr)
{
	print_func_entry();
	w->raw = runerealloc(w->raw, w->nraw+nr);
	runemove(w->raw+w->nraw, r, nr);
	w->nraw += nr;
	print_func_exit();
}
예제 #26
0
파일: wind.c 프로젝트: dancrossnyc/harvey
int
wclose(Window *w)
{
	print_func_entry();
	int i;

	i = decref(w);
	if(i > 0) {
		print_func_exit();
		return 0;
	}
	if(i < 0)
		error("negative ref count");
	if(!w->deleted)
		wclosewin(w);
	wsendctlmesg(w, Exited, nil);
	print_func_exit();
	return 1;
}
예제 #27
0
파일: wind.c 프로젝트: dancrossnyc/harvey
void
wsendctlmesg(Window *w, int type, Console *image)
{
	print_func_entry();
	Wctlmesg wcm;

	wcm.type = type;
	send(w->cctl, &wcm);
	print_func_exit();
}
예제 #28
0
파일: wind.c 프로젝트: dancrossnyc/harvey
/*
 * Need to do this in a separate proc because if process we're interrupting
 * is dying and trying to print tombstone, kernel is blocked holding p->debug lock.
 */
void
interruptproc(void *v)
{
	print_func_entry();
	int *notefd;

	notefd = v;
	write(*notefd, "interrupt", 9);
	free(notefd);
	print_func_exit();
}
예제 #29
0
파일: xec.c 프로젝트: Requaos/harvey
static void
pop(Iarg *sp, Iarg *a)
{
	print_func_entry();
	Iarg *p;

	p = amem(sp->cpu, a->len, RSS, ar(sp));
	aw(a, ar(p));
	aw(sp, p->off + a->len);
	print_func_exit();
}
예제 #30
0
파일: xec.c 프로젝트: Requaos/harvey
static void
opleave(Cpu *cpu, Inst *i)
{
	print_func_entry();
	Iarg *sp;

	sp = areg(cpu, cpu->slen, RSP);
	aw(sp, ar(areg(cpu, cpu->slen, RBP)));
	pop(sp, areg(cpu, i->olen, RBP));
	print_func_exit();
}