[M3commit] CVS Update: cm3

Jay Krell jkrell at elego.de
Thu Feb 11 15:59:52 CET 2010


CVSROOT:	/usr/cvs
Changes by:	jkrell at birch.	10/02/11 15:59:52

Modified files:
	cm3/m3-sys/m3back/src/: Codex86.i3 M3x86.m3 

Log message:
	make fence work
	it is a little sleazy
	any xchg that references memory is serializing
	the simplest would be
	push eax
	xchg [esp+4], eax
	pop eax
	
	however the push/pop are usually a waste
	
	The approach here is to have a fence local variable,
	allocate a register, and
	xchg fence, reg
	
	(a global would also do, but that'd cause artifical contention)
	
	however the tricky/sleazy part is that our code generator
	is so good that it'll want to enregister fence, and
	xchg reg1, reg2
	
	is not serializing. Many of my attempts did that.
	
	The pattern here seems to do the trick reliably.
	I think in particular because of the "overwritesdest" boolean.
	Test case has multiple fences in a row, and they still all
	go to memory.
	
	The other sleazy part is how I've filled in the table
	for shld, shrd, xchg. I need to understand this better,
	and need to be certain the bogus entries won't be used.




More information about the M3commit mailing list