~kris/9p

9hist

bfc9171855e467da6fe543004e09020831661967 — David du Colombier 25 years ago e4dd5fe
Plan 9 from Bell Labs 2001-03-25
2 files changed, 21 insertions(+), 9 deletions(-)

M bitsy/power.c
M bitsy/trap.c
M bitsy/power.c => bitsy/power.c +12 -1
@@ 76,5 76,16 @@ idlehands(void)
void
idlehands(void)
{
//	doze();
	char *msgb = "idlehands called with splhi\n";
	char *msga = "doze returns with splhi\n";

	if(!islo()){
		serialputs(msga, strlen(msga));
		spllo();
	}
	doze();
	if(!islo()){
		serialputs(msgb, strlen(msgb));
		spllo();
	}
}

M bitsy/trap.c => bitsy/trap.c +9 -8
@@ 38,12 38,12 @@ static int	gpioirqref[12];
typedef struct Vpage0 {
	void	(*vectors[8])(void);
	ulong	vtable[8];

	/* Doze goes here because it needs to be on a cache-line boundary */
	ulong	doze[16];
} Vpage0;
Vpage0 *vpage0;

/*
 *  An cached line for the doze code
 */
void (*doze)(void);

static void	irq(Ureg*);


@@ 60,12 60,10 @@ trapinit(void)
	memmove(vpage0->vectors, vectors, sizeof(vpage0->vectors));
	memmove(vpage0->vtable, vtable, sizeof(vpage0->vtable));

	/* Move the twelve instructions of doze() to a cache-line boundary: */
	memmove(vpage0->doze, _doze, 12*sizeof(long));
	/* relocate the doze routine to a cache line boundary in cached mem */
	doze = xspanalloc(12*sizeof(long), 16, 0);
	memmove(doze, _doze, 12*sizeof(long));
	wbflush();
		
	/* Set the doze function pointer to the moved _doze() routine */
	doze = (void(*)(void))vpage0->doze;

	/* use exception vectors at 0xFFFF0000 */
	mappedIvecEnable();


@@ 87,6 85,9 @@ trapinit(void)
	gpioregs->rising = 0;
	gpioregs->falling = 0;
	gpioregs->edgestatus = gpioregs->edgestatus;

	/* allow all enabled interrupts to take processor out of sleep mode */
	intrregs->iccr = 0;
}

void