From bfc9171855e467da6fe543004e09020831661967 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 25 Mar 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-03-25 --- bitsy/power.c | 13 ++++++++++++- bitsy/trap.c | 17 +++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bitsy/power.c b/bitsy/power.c index 06040876c8a9ae208c8c698db74c69c42b499f97..67e4b015bfaa397f70d64bc049ef74b4b5d1da83 100644 --- a/bitsy/power.c +++ b/bitsy/power.c @@ -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(); + } } diff --git a/bitsy/trap.c b/bitsy/trap.c index b5a2cf691a313cf1b24a5d831bb7c6a169e20389..1f22cebc159f5617f353abc344e3537c7c2c6e26 100644 --- a/bitsy/trap.c +++ b/bitsy/trap.c @@ -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