Esempio n. 1
1
File: xec.c Progetto: 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();
}
Esempio n. 2
0
File: xec.c Progetto: Requaos/harvey
static void
oppop(Cpu *cpu, Inst *i)
{
	print_func_entry();
	pop(areg(cpu, cpu->slen, RSP), i->a1);
	print_func_exit();
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
File: xec.c Progetto: Requaos/harvey
static void
oplahf(Cpu *cpu, Inst *i)
{
	print_func_entry();
	aw(i->a1, cpu->reg[RFL]);
	print_func_exit();
}
Esempio n. 5
0
File: dev.c Progetto: 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;
}
Esempio n. 6
0
File: dev.c Progetto: 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();
}
Esempio n. 7
0
File: xec.c Progetto: Requaos/harvey
static void
opcmc(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] ^= CF;
	print_func_exit();
}
Esempio n. 8
0
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();
}
Esempio n. 9
0
File: xec.c Progetto: Requaos/harvey
static void
opstd(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] |= DF;
	print_func_exit();
}
Esempio n. 10
0
File: xec.c Progetto: 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();
}
Esempio n. 11
0
File: dev.c Progetto: Requaos/harvey
void
devcreate(Chan* c, char* d, int i, int n)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
Esempio n. 12
0
File: xec.c Progetto: Requaos/harvey
static void
opcli(Cpu *cpu, Inst *inst)
{
	print_func_entry();
	cpu->reg[RFL] &= ~IF;
	print_func_exit();
}
Esempio n. 13
0
File: dev.c Progetto: 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;
}
Esempio n. 14
0
File: dev.c Progetto: Requaos/harvey
void
devpower(int i)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
Esempio n. 15
0
File: dev.c Progetto: Requaos/harvey
void
devremove(Chan* c)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
}
Esempio n. 16
0
File: dev.c Progetto: 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;
}
Esempio n. 17
0
File: dev.c Progetto: 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;
}
Esempio n. 18
0
File: dev.c Progetto: 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;
}
Esempio n. 19
0
File: dev.c Progetto: Requaos/harvey
int
devconfig(int i, char *c, DevConf *d)
{
	if (0) print_func_entry();
	error(Eperm);
	if (0) print_func_exit();
	return 0;
}
Esempio n. 20
0
File: dev.c Progetto: 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;
}
Esempio n. 21
0
File: xec.c Progetto: Requaos/harvey
static void
opint(Cpu *cpu, Inst *i)
{
	print_func_entry();
	cpu->trap = ar(i->a1);
	longjmp(cpu->jmp, 1);
	print_func_exit();
}
Esempio n. 22
0
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();
}
Esempio n. 23
0
File: dev.c Progetto: 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();
}
Esempio n. 24
0
void
wsendctlmesg(Window *w, int type, Console *image)
{
	print_func_entry();
	Wctlmesg wcm;

	wcm.type = type;
	send(w->cctl, &wcm);
	print_func_exit();
}
Esempio n. 25
0
/*
 * 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();
}
Esempio n. 26
0
File: xec.c Progetto: 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();
}
Esempio n. 27
0
File: xec.c Progetto: 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();
}
Esempio n. 28
0
File: xec.c Progetto: Requaos/harvey
static void
opsahf(Cpu *cpu, Inst *i)
{
	print_func_entry();
	enum { MASK = SF|ZF|AF|PF|CF };
	unsigned long *f;

	f = cpu->reg + RFL;
	*f &= ~MASK;
	*f |= (ar(i->a1) & MASK);
	print_func_exit();
}
Esempio n. 29
0
int
wctlmesg(Window *w, int m, Console *i)
{
	print_func_entry();
	switch(m){
	default:
		error("unknown control message");
		break;
	case Wakeup:
		break;
	case Rawon:
		break;
	case Rawoff:
		if(w->deleted)
			break;
		while(w->nraw > 0){
			//wkeyctl(w, w->raw[0]);
			--w->nraw;
			runemove(w->raw, w->raw+1, w->nraw);
		}
		break;
	case Holdon:
	case Holdoff:
		if(w->deleted)
			break;
		break;
	case Deleted:
		if(w->deleted)
			break;
		write(w->notefd, "hangup", 6);
		proccreate(deletetimeoutproc, estrdup(w->name), 4096);
		wclosewin(w);
		break;
	case Exited:
		close(w->notefd);
		chanfree(w->mc.c);
		chanfree(w->ck);
		chanfree(w->cctl);
		chanfree(w->conswrite);
		chanfree(w->consread);
		chanfree(w->mouseread);
		chanfree(w->wctlread);
		free(w->raw);
		free(w->run);
		free(w->dir);
		free(w->label);
		free(w);
		break;
	}
	print_func_exit();
	return m;
}
Esempio n. 30
0
File: xec.c Progetto: Requaos/harvey
static void
push(Iarg *sp, Iarg *a)
{
	print_func_entry();
	Iarg *p;

	p = amem(sp->cpu, a->len, RSS, ar(sp));
	p->off -= a->len;
	p->off &= mask(sp->len*8);
	aw(p, ar(a));
	aw(sp, p->off);
	print_func_exit();
}