linear address, not physical address Reference: /n/atom/patch/applied2013/monmwaitman Date: Wed Sep 18 18:45:34 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/man/9/monmwait Thu Jan 1 00:00:00 1970 +++ /sys/man/9/monmwait Wed Sep 18 18:45:34 2013 @@ -0,0 +1,50 @@ +.TH MONMWAIT 9 +.SH NAME +monmwait \- wait for memory write +.SH SYNOPSIS +.ta \w'\fLvoid 'u +.B +void monmwait(void *adr, uintptr oldval) +.SH DESCRIPTION +Wait for the value pointed to by +.B adr +to change from +.B oldval +in the most power- and bus-cycle efficient way afforded by +the architecture. +.PP +Since no lock is involved, +.I monmwait +may not be used where ABA might be a problem. This function will +never miss a (persistent) change, but may return before the value has +changed, for example if interrupted, or if a “nearby” memory location +has been written. +.I Nearby +is dependent on the architecture and +implementation. On current x86 platforms, +.I nearby +means in the +same cacheline. +.PP +The minimal correct implementation would be a no-op. +On x86 machines, the implementation uses +the +.SM MONITOR +and +.SM MWAIT +instructions. +.SH EXAMPLES +Application processors can use +.I monmwait +while waiting for release to keep the fans from spooling up: +.IP +.EX +while(!active.thunderbirdsarego) + monmwait(&active.thunderbirdsarego, 0); +.EE +.PP +.SH SOURCE +.B /sys/src/nix/k10/l64v.s +.SH SEE ALSO +.IR atom (2), +.IR lock (9)