Esempio n. 1
0
int ChannelQueue::Push(Channel* c) {
	if (NULL != c->pre || NULL != c->next) {
		mtsr(-1, "channel is already in a queue");
	}

	if (NULL == head) {
		head = c;
		tail = c;
		c->pre = c->next = NULL;
	} else {
		tail->next = c;
		c->pre = tail;
		c->next = NULL;
		tail = c;
	}

	return 0;
}
Esempio n. 2
0
int ChannelQueue::Remove(Channel* c) {
	if (NULL == c) {
		mtsr(-1, "can remove a NULL channel");
	}

	Channel *pre = c->pre;
	Channel *next = c->next;

	if (head != c && NULL == pre) {
		return 0;//not in the queue
	}

	if (tail != c && NULL == next) {
		return 0;//not in the queue
	}

	if (head == c) {
		head = next;
	}

	if (tail == c) {
		tail = pre;
	}

	if (NULL != pre) {
		pre->next = next;
	}

	if (NULL != next) {
		next->pre = pre;
	}

	c->pre = c->next = NULL;

	return 0;
}
Esempio n. 3
0
void pmap_switch(pmap_t map)
{
	unsigned int i;

#if DEBUG
	if (watchacts & WA_PCB) {
		printf("Switching to map at 0x%08x, space=%d\n",
		       map,map->space);
	}
#endif /* DEBUG */

#if !DEBUG
	/* when changing to kernel space (collocated servers), don't bother
	 * doing anything, the kernel is mapped from here already. Do change
	 * in the debug case, to ease debugging.
	 */
	if (map->space == PPC_SID_KERNEL)
		return;
#endif /* 0 */

	/* sr value has Ks=1, Ku=1, and vsid composed of space+seg num */
	i = SEG_REG_PROT | (map->space << 4);

	assert(SR_KERNEL == 0);
/*	mtsr(0x0, i + 0x0); SR0 is the kernel segment! */
/*	mtsr(0x1, i + 0x1); SR1 is kernel collocation space */
/*	mtsr(0x2, i + 0x2); SR2 is more   collocation space */
	mtsr(0x3, i + 0x3);
	mtsr(0x4, i + 0x4);
	mtsr(0x5, i + 0x5);
	mtsr(0x6, i + 0x6);
	mtsr(0x7, i + 0x7);
	mtsr(0x8, i + 0x8);
	mtsr(0x9, i + 0x9);
	mtsr(0xa, i + 0xa);
	mtsr(0xb, i + 0xb);
/*	mtsr(0xc, i + 0xc);	Can overwrite copyin SR with no problem */
	mtsr(0xd, i + 0xd);
	mtsr(0xe, i + 0xe);
	mtsr(0xf, i + 0xf);

	/* After any segment register changes, we have to resync if
	 * we want to use the new translations. We don't use any
	 * of the above user space until after an rfi, so no need
	 * for us to sync now
	 */
}