[net.micro.68k] 68k instruction prefetch

ganesh (12/17/82)

I would like to know whether the instruction prefetch, as available in 68000
and 68010, will lead to privilege violation during memory access. In particular
if we have defined certain access rights in a segment of memory containing code,consider what would happen when the last instruction in this segment is fetched.The prefetch circuitry would issue signals to fetch the next instruction,
while the present one is being decoded. This next address will not fall into
the present segment. What if the next address generated falls into a segment
where read is inhibited? Does the 68000/68010 have the capability to ignore
or make more sense out of the bus-error exception that may be caused by
prefetch? 

tdl (12/17/82)

In response to the question about the 68K prefetching past the end
of a segment:

The 68K will not prefetch the instruction following a branch instruction.
(the prefetch does not take place until the instruction is decoded)
AT least I think this is correct. If there is enough interest
I can look through the microcode to find out for sure. Anyway, back
to the main subject. If the last instruction in a segment is a discontinuity
(what else could it be?) the word past that instruction will not be fetched.

			Tom Lovett	(houxh!tdl)
			BTL Holmdel (finally!)

tdl (12/17/82)

Sorry, I lied a little bit in my response to the 68k prefetch
question. Before the branch instruction executes there will be
two words in the prefetch buffer; the branch instruction and the 
word following it. If the branch instruction is a 16-bit form and is indeed
the last word in a segment you can get a memory fault while trying to
fetch the following word. The 68k does not recognize that this is
a useless fetch and will enter its fault sequence. The simple solution to
this problem is to pad all segments with at least one word of garbage.
(I think one word overrun is the worst case.)
			Tom Lovett (houxh!tdl)
			BTL Holmdel

mathon (12/21/82)

	You may find problems with certain other instructions.  For instance,
I believe a moveml instruction will pre-fetch data beyond what it needs
when restoring registers.  There may be other cases like this.

				John Mathon
				Fortune Systems Co
				1501 Industrial rd
				San Carlos, Ca  94070
				ph:  415-595-8444