Casting Pointers -- fast *portab - (nf)

Mike Wescott wescott at ncrcae.UUCP
Tue Feb 21 13:43:10 AEST 1984


[]
> And of course (?) everyone knows by now (?) that you can get even better
> with a 68000 by using the move-multiple-long (register load/store)
> instructions to eat and spew big gulps.
>        .
>        .
>        .
> (See the code for "blt" that comes with the the MIT "C" compiler.)

You can also get into trouble if you're not careful. The version
of "blt" we used here worked just fine, until it pointed out a
microcode bug in the MC68000 for us. The movem instruction, when
fetching from memory into registers does an extra word read. The
extra word is thrown away and causes no problems, except when the
extra read crosses into an unreadable segment, in which case you
get an unwanted "segmentation violation" or "panic: kernel memory
management error."

The situation shows up (if my memory is correct), when the length
of the move is a multiple of 48 bytes and abuts an unreadable
segment ("blt" uses a 12 register movem).

I recoded it and still managed to pick up a little performance.

-Mike Wescott
 NCR Corporation, W. Columbia SC
 mcnc!ncsu!ncrcae!wescott



More information about the Comp.lang.c mailing list