From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Mon, 21 Nov 2011 10:08:18 -0500 To: 9fans@9fans.net Message-ID: <93653898c4ceb27355b5fa1e548176aa@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] sysrfork fp bug? Topicbox-Message-UUID: 421cb034-ead7-11e9-9d60-3106f5b1d025 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 -#include - -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