9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sysrfork fp bug?
@ 2011-11-21 15:08 erik quanstrom
  2011-11-21 15:33 ` Charles Forsyth
       [not found] ` <CAOw7k5hcpmt26NppfrFENPWS9_g6jD=XMhQzVMeS1usGQrwL0w@mail.gmail.c>
  0 siblings, 2 replies; 9+ messages in thread
From: erik quanstrom @ 2011-11-21 15:08 UTC (permalink / raw)
  To: 9fans

sysrfork() does *not* do a procsave before forking.  thus the
floating point registers in the new process are just going to
be a copy of whatever was last saved, and perhaps nothing.

on my atom system (but not some others), this attached
program does fault.  i wrote a bit of it in assembler to control
what was in F0.  the c compiler wasn't keeping things in a
register.

have i missed something or do we need a procsave() in fork?

- erik

---
sed 's/.//' >fp.c <<'//GO.SYSIN DD fp.c'
-#include <u.h>
-#include <libc.h>
-
-char *theformat = "%g\n";
-
-void
-main(void)
-{
-	extern void dofp(void);
-
-	dofp();
-}
//GO.SYSIN DD fp.c
echo myfp.s
sed 's/.//' >myfp.s <<'//GO.SYSIN DD myfp.s'
-TEXT	dofp(SB), $0
-	SUBL		$12, SP
-	FLD1
-	CALL		fork(SB)
-
-	MOVL		$2000, AX
-	MOVL		AX, 0x0(SP)
-	CALL		sleep(SB)
-
-	MOVL		theformat(SB), AX
-	MOVL		AX, 0x0(SP)
-	FMOVDP	F0,0x4(SP)
-	CALL		print(SB)
-	ADDL		$12, SP
-	RET
//GO.SYSIN DD myfp.s



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-11-22  1:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21 15:08 [9fans] sysrfork fp bug? erik quanstrom
2011-11-21 15:33 ` Charles Forsyth
     [not found] ` <CAOw7k5hcpmt26NppfrFENPWS9_g6jD=XMhQzVMeS1usGQrwL0w@mail.gmail.c>
2011-11-21 15:43   ` erik quanstrom
2011-11-21 23:01     ` erik quanstrom
2011-11-21 15:48   ` erik quanstrom
2011-11-21 22:08   ` erik quanstrom
2011-11-21 23:14     ` Charles Forsyth
2011-11-21 23:18       ` Charles Forsyth
     [not found]     ` <CAOw7k5it_OV56ZNnPygDjh+rA=xC-+-x+DJuSWBCBRC-XhXECw@mail.gmail.c>
2011-11-22  1:52       ` erik quanstrom

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).