introduce monitor and mwait to amd64 port. we still lack a type to mwait on. Reference: /n/atom/patch/applied2013/fsmonmwait Date: Tue Sep 17 21:22:41 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/fs/amd64/squid.c Tue Sep 17 21:22:13 2013 +++ /sys/src/fs/amd64/squid.c Tue Sep 17 21:22:13 2013 @@ -34,7 +34,7 @@ */ DBG("Wait for the thunderbirds!\n"); while(!active.thunderbirdsarego) - ; + monmwait(&active.thunderbirdsarego, 0); wrmsr(0x10, sys->epoch); m->rdtsc = rdtsc(); --- /sys/src/fs/amd64/fns.h Tue Sep 17 21:22:13 2013 +++ /sys/src/fs/amd64/fns.h Tue Sep 17 21:22:13 2013 @@ -28,7 +28,7 @@ void hardhalt(void); void i8042a20(void); void i8042reset(void); -void idle(void); +#define idlehands() monmwait(&runq.head, 0) /* can't be fn due to runq being proc.c private */ void idthandlers(void); void idtput(int, u64int); int inb(int); --- /sys/src/fs/port/proc.c Tue Sep 17 21:22:13 2013 +++ /sys/src/fs/port/proc.c Tue Sep 17 21:22:13 2013 @@ -158,8 +158,8 @@ User *p; for (;;) { - while(runq.head == nil) /* if nobody to run, */ - idle(); /* idle with intrs enabled */ + while(runq.head == nil) + idlehands(); splhi(); lock(&runq); p = runq.head; --- /sys/src/fs/pc/l.s Tue Sep 17 21:22:13 2013 +++ /sys/src/fs/pc/l.s Tue Sep 17 21:22:13 2013 @@ -649,7 +649,7 @@ /* * do nothing whatsoever till interrupt happens */ -TEXT idle(SB),$0 +TEXT idlehands(SB),$0 HLT RET --- /sys/src/fs/pc/fns.h Tue Sep 17 21:22:13 2013 +++ /sys/src/fs/pc/fns.h Tue Sep 17 21:22:13 2013 @@ -20,8 +20,8 @@ int getfields(char*, char**, int, int, char*); void i8042a20(void); void i8042reset(void); -#define halthi() idle() -void idle(void); +#define halthi() idlehands() +void idlehands(void); int inb(int); ulong inl(int); void insb(int, void*, int);