On Sun, 15 Jul 2001 22:37:03 -0400 (EDT),
Ben LaHaise <bcrl@xxxxxxxxxx> wrote:
>Below is a patch that moves the skb_{over,under}_panic function calls in
>skb_put and skb_push out of line on i386 and hopefully improves register
>allocation.
>+#define __arch_skb_check(insn, left, right, skb, why, len) \
>+ __asm__ __volatile__( \
>+ " cmpl %1,%0\n" \
>+ "1: " insn " 2f\n" \
>+ ".section .text.lock,\"ax\"\n" \
>+ "2: pushl 1b\n" \
>+ " pushl %3\n" \
>+ " pushl %2\n" \
>+ " call skb_" why "_panic\n" \
>+ " ud2a\n" \
>+ ".previous\n" \
>+ : : "r" (left), "rm" (right), "rmi" (skb), "rmi" (len) \
>+ : "cc" )
Oops, pressed send too soon. Because you are putting the code in
.text.lock which is an unusual section, it will make debugging easier
if you make the skb code look like the existing lock code, where
possible. In particular include a branch back to the mainline code,
existing debuggers look for the return branch to determine where the
"lock" code was entered from. So the whole asm code is
#define __arch_skb_check(insn, left, right, skb, why, len) \
__asm__ __volatile__( \
" cmpl %1,%0\n" \
"1: " insn " 2f\n" \
".section .text.lock,\"ax\"\n" \
"2: pushl 1b\n" \
" pushl %3\n" \
" pushl %2\n" \
" call %c4\n" \
" ud2a\n" \
" jmp 1b\n" \
".previous\n" \
: : "r" (left), "rm" (right), "rmi" (skb), "rmi" (len) \
"i" (skb_ ## why ## _panic) \
: "cc" )
The jmp 1b should never be executed so is a small waste of space but
the debugging improvements are worth it.
|