Subject: Re: port-mac68k/36848: c++ programs get stalled after a fork
To: None <,,>
From: Michael L. Hitch <>
List: netbsd-bugs
Date: 08/30/2007 20:25:02
The following reply was made to PR port-mac68k/36848; it has been noted by GNATS.

From: "Michael L. Hitch" <>
Subject: Re: port-mac68k/36848: c++ programs get stalled after a fork
Date: Thu, 30 Aug 2007 13:16:12 -0600 (MDT)

 On Wed, 29 Aug 2007, Michael L. Hitch wrote:
 >    It does happen on my amiga, so it would appear to be m68k-specific.
 It would also appear to be m68040 specific as well.
 With the help of some trap debug code I'm still running with on my amiga, 
 it appears that a write fault during a casl instruction has the read bit 
 set in the fault status work, so the m68k trap routines were treating the 
 fault access as a read.
 This is what appears to be happening:
 The program forks a child process.  The child's process has read-only data 
 pages until a write access does a COW.  The c++ library is now doing a 
 casl operation somewhere in an ios routine on exit(), and it's trying to 
 update the value.  The trap routine sees it as a read access and leaves 
 the access to that page as read-only and retries the operation - which 
 just traps the same way again.
 I changed the amiga trap routine to treat the fault on a locked memory 
 cycle (used by the cas instruction) as a write access, and now the test 
 program runs on my amiga.
 As soon as I can verify my changes to the other m68k trap routines 
 compiles, and get verification that the change works on another machine, 
 I'll commit the fixes and request a pullup to 4.0.
 Michael L. Hitch
 Computer Consultant
 Information Technology Center
 Montana State University	Bozeman, MT	USA