[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unidentified subject!



Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de> writes:

|> On Wed, Jan 09, 2002 at 11:20:52PM +0100, Christian Groessler wrote:
|> 
|> > 
|> > .L1239:
|> > #APP
|> > 	.chip 68040
|> > 	pflush (%a0)
|> > 	.chip 68k
|> > #NO_APP
|> > 	clr.l %d1
|> > 	jbra .L1196
|> > 	.align	2
|> > .L1193:
|> > #APP
|> > 	ptestr (%a0)
|> > #NO_APP
|> > 	jbra .L1194
|> > 	.align	2
|> > 
|> > There is the .chip 68k currently in effect.
|> 
|> I see, the compiler reordered the statements somewhat so the '.chip' 
|> got lexicaly separated from the statements where it belongs to
|> logically.
|> 
|> Try this replacement-probe040, I can't even testcompile it now.
|> 
|> static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
|> {
|> 	unsigned long mmusr;
|> 	mm_segment_t old_fs = get_fs();
|> 
|> 	set_fs(MAKE_MM_SEG(wbs));
|> 
|> 	asm volatile ( ".chip 68040\n"
|> 		       "tst.l %2\n"
|> 		       "jbne 1f\n"
|>                        "ptestr (%1)\n" 
|>                        "jbra 2f\n"
|>                        "1: ptestw (%1)\n"
|>                        "2: movec %%mmusr,%0\n"
|>                        ".chip 68k\n"
|> 			: "=r" (mmusr) : "a" (addr), "r" (iswrite));
|> 
|> 	set_fs(old_fs); 
|> 
|> 	return mmusr;
|> }

I'd prefer this, to allow more freedom to the compiler:

static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
{
	unsigned long mmusr;
	mm_segment_t old_fs = get_fs();

	set_fs(MAKE_MM_SEG(wbs));

	if (iswrite)
		asm volatile (".chip 68040; ptestw (%0); chip 68k" : : "a" (addr));
	else
		asm volatile (".chip 68040; ptestr (%0); chip 68k" : : "a" (addr));

	asm volatile (".chip 68040; movec %%mmusr,%0; chip 68k" : "=r" (mmusr));

	set_fs(old_fs); 

	return mmusr;
}

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-904229 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply to: