Subject: CVS commit: src/sys/arch
To: None <source-changes@NetBSD.org>
From: Michael L. Hitch <mhitch@netbsd.org>
List: source-changes
Date: 09/01/2007 21:31:57
Module Name:	src
Committed By:	mhitch
Date:		Sat Sep  1 21:31:57 UTC 2007

Modified Files:
	src/sys/arch/amiga/amiga: trap.c
	src/sys/arch/atari/atari: trap.c
	src/sys/arch/cesfic/cesfic: trap.c
	src/sys/arch/hp300/hp300: trap.c
	src/sys/arch/luna68k/luna68k: trap.c
	src/sys/arch/mac68k/mac68k: trap.c
	src/sys/arch/mvme68k/mvme68k: trap.c
	src/sys/arch/news68k/news68k: trap.c
	src/sys/arch/next68k/next68k: trap.c
	src/sys/arch/sun3/sun3: trap.c
	src/sys/arch/x68k/x68k: trap.c

Log Message:
68030 and 68040 processors consider the read portion of a read-modify-write
transfer as a write to ensure the memory is writable before starting any
transfer.  The fault status information does not reflect this in the 'read'
status bit (i.e. it shows up as a read access), so faults with a RMW access
to non-writable memory was not getting the correct protection.  The page would
be read-only and the instruction would fault over and over.

A specific example is when a process forks, and the child process attempts
to execute a RMW access to a data page, which is read-only because it's CoP
Copy-On-Write.

When checking if the page needs to be writablek, also check the locked transfer
and treat any locked transfer as a write.

68060 already handled this correctly, since it has separate read and write
fault bits, and both are set on a RMW access and the trap code was checking
the write status bit.

Fixes PR#36848.


To generate a diff of this commit:
cvs rdiff -r1.115 -r1.116 src/sys/arch/amiga/amiga/trap.c
cvs rdiff -r1.91 -r1.92 src/sys/arch/atari/atari/trap.c
cvs rdiff -r1.35 -r1.36 src/sys/arch/cesfic/cesfic/trap.c
cvs rdiff -r1.131 -r1.132 src/sys/arch/hp300/hp300/trap.c
cvs rdiff -r1.46 -r1.47 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -r1.128 -r1.129 src/sys/arch/mac68k/mac68k/trap.c
cvs rdiff -r1.90 -r1.91 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -r1.53 -r1.54 src/sys/arch/news68k/news68k/trap.c
cvs rdiff -r1.67 -r1.68 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -r1.130 -r1.131 src/sys/arch/sun3/sun3/trap.c
cvs rdiff -r1.89 -r1.90 src/sys/arch/x68k/x68k/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.