9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] APE, noted(), NSAVE/NRSTR
@ 2008-10-05  1:56 cinap_lenrek
  0 siblings, 0 replies; only message in thread
From: cinap_lenrek @ 2008-10-05  1:56 UTC (permalink / raw)
  To: 9fans

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-05  1:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-05  1:56 [9fans] APE, noted(), NSAVE/NRSTR cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).