From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net Date: Sun, 5 Oct 2008 03:56:07 +0200 From: cinap_lenrek@gmx.de MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] APE, noted(), NSAVE/NRSTR Topicbox-Message-UUID: 1718ea0e-ead4-11e9-9d60-3106f5b1d025 To emulate unix signals (that can nest) with notes (that cant nest), ape uses the special noted() parameters NSAVE and NRSTR. NCONT/NRSTR set up->ureg to the "old ureg": /sys/src/9/pc/trap:^noted up->ureg = (Ureg*)(*(ulong*)(oureg-BY2WD)); NSAVE accepts the note as handled, but unlike NCONT/NRSTR keeps the up->ureg in place (to be later restored by NRSTR). but... /sys/src/9/pc/trap.c:^notify [1] up->ureg = (void*)sp; memmove((Ureg*)sp, ureg, sizeof(Ureg)); [2] *(Ureg**)(sp-BY2WD) = up->ureg; /* word under Ureg is old up->ureg */ [3] up->ureg = (void*)sp; sp -= BY2WD+ERRMAX; memmove((char*)sp, up->note[0].msg, ERRMAX); Notify always overrides up->ureg in [1]. So what effect should (not) restoring of up->ureg in noted() have? Why is up->ureg set again in [3]? What happens when a note is posted between a noted(NSAVE) / noted(NRSTR)? -- cinap