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