Re: [PATCH] Fix prefetch patching in 2.5-bk

Linus Torvalds (torvalds@transmeta.com)
Wed, 30 Apr 2003 18:21:52 -0700 (PDT)


On Thu, 1 May 2003, Andi Kleen wrote:
>
> If your machine BUG()s in apply_alternatives at booting
> or module loading you need this patch.

I applied it, but I don't have to like it..

How about doing this differently, and having something like this:

#define nop_alternative(newinstr, feature) \
".section .altinstructions,\"a\"\n" \
" .align 4\n"
" .long 660f\n"
" .long 663f\n"
" .byte %c0\n"
" .byte 0\n"
" .byte 664f-663f\n"
".previous\n"
".section .altinstr_replacement",\"ax\"\n"
"663:\n\t" newinstr "\n664:\n"
".previous"
"660:\n\t"
".rept 664b-663b, 0x90\n\t"

and making "sourcelen==0" a special case for replacement (replace with the
proper destination length nop, instead of having that "0x90 0x90 0x90"
sequence).

This allows you to use arbitrary-sized things without having to worry
about having to have the size right, or without having to use
unnecessarily long nop-sequences. You'll always get the right-size nop.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/