Subject: Faulty STM paging
To: None <port-arm32@NetBSD.ORG>
From: Kim G. S. OEyhus <kim@iq.pvv.ntnu.no>
List: port-arm32
Date: 04/29/1998 09:19:44
> 	One option might be to hack the linker to adjust the code
> 	for any LDM that might be on a page boundary. False positives
> 	are not so much a problem, as long as it does get them all.
> 	Ugly, but possibly effective.

The same could be done with the program loader. Say, if it finds a
possibly bad LDM, replace it with a short call to a routine that
does the LDM, and returns. Or a goto, or an interrupt, whatever.
An interrupt, exception, is best in my opinion.

> 	How much of a performance hit would avoiding all LDMs be?

I think it will be noticeable, sine it is done quite often,
and will significantly increase code size, and therefore time to
load and execute code.

> 	Unless it is significant it would seem sensible to provide an
> 	easy compile time switch to enable/disable the use of 'LDM'.
> 	I believe gcc has similar workarounds for other chips.

Really? Thats interesting.

> 	Personally I would default this to on - I consider it more
> 	important that the default work everywhere, than be faster on
> 	some machines and broken on others, but I am certainly not in
> 	any position to make any decisions here :)

I agree about the switch.

> 	Hmm, another thought - write all LDMs as LDM followed by NOP, then
> 	post process the output to swap any LDM/NOP pairs where the LDM
> 	is at the end of a page? (or on an address that could be at the
> 	end of a page). Not incredibly attractive, but less ugly than
> 	the first idea, and it should still be a compile option which
> 	can be disabled by people who will never have to use the problem
> 	chips....

Yes. Or simply putting a nop extra only when LDM are dumped on a page
boundary. I checked that gcc does indeed support 
variable length instructions.

A big problem here, is that those affected, can't fix the problem,
since they cant compile the system.

Kim0