aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/spinlock.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2006-12-06 20:14:08 -0500
committerAndi Kleen <andi@basil.nowhere.org>2006-12-06 20:14:08 -0500
commit139ec7c416248b9ea227d21839235344edfee1e0 (patch)
tree54c396848b08367c0352c77f4633be6380a8eb16 /include/asm-i386/spinlock.h
parentd3561b7fa0fb0fc583bab0eeda32bec9e4c4056d (diff)
[PATCH] paravirt: Patch inline replacements for paravirt intercepts
It turns out that the most called ops, by several orders of magnitude, are the interrupt manipulation ops. These are obvious candidates for patching, so mark them up and create infrastructure for it. The method used is that the ops structure has a patch function, which is called for each place which needs to be patched: this returns a number of instructions (the rest are NOP-padded). Usually we can spare a register (%eax) for the binary patched code to use, but in a couple of critical places in entry.S we can't: we make the clobbers explicit at the call site, and manually clobber the allowed registers in debug mode as an extra check. And: Don't abuse CONFIG_DEBUG_KERNEL, add CONFIG_DEBUG_PARAVIRT. And: AK: Fix warnings in x86-64 alternative.c build And: AK: Fix compilation with defconfig And: ^From: Andrew Morton <akpm@osdl.org> Some binutlises still like to emit references to __stop_parainstructions and __start_parainstructions. And: AK: Fix warnings about unused variables when PARAVIRT is disabled. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Zachary Amsden <zach@vmware.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'include/asm-i386/spinlock.h')
-rw-r--r--include/asm-i386/spinlock.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index dea60709db29..d3bcebed60ca 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -12,6 +12,8 @@
12#else 12#else
13#define CLI_STRING "cli" 13#define CLI_STRING "cli"
14#define STI_STRING "sti" 14#define STI_STRING "sti"
15#define CLI_STI_CLOBBERS
16#define CLI_STI_INPUT_ARGS
15#endif /* CONFIG_PARAVIRT */ 17#endif /* CONFIG_PARAVIRT */
16 18
17/* 19/*
@@ -57,25 +59,28 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
57{ 59{
58 asm volatile( 60 asm volatile(
59 "\n1:\t" 61 "\n1:\t"
60 LOCK_PREFIX " ; decb %0\n\t" 62 LOCK_PREFIX " ; decb %[slock]\n\t"
61 "jns 5f\n" 63 "jns 5f\n"
62 "2:\t" 64 "2:\t"
63 "testl $0x200, %1\n\t" 65 "testl $0x200, %[flags]\n\t"
64 "jz 4f\n\t" 66 "jz 4f\n\t"
65 STI_STRING "\n" 67 STI_STRING "\n"
66 "3:\t" 68 "3:\t"
67 "rep;nop\n\t" 69 "rep;nop\n\t"
68 "cmpb $0, %0\n\t" 70 "cmpb $0, %[slock]\n\t"
69 "jle 3b\n\t" 71 "jle 3b\n\t"
70 CLI_STRING "\n\t" 72 CLI_STRING "\n\t"
71 "jmp 1b\n" 73 "jmp 1b\n"
72 "4:\t" 74 "4:\t"
73 "rep;nop\n\t" 75 "rep;nop\n\t"
74 "cmpb $0, %0\n\t" 76 "cmpb $0, %[slock]\n\t"
75 "jg 1b\n\t" 77 "jg 1b\n\t"
76 "jmp 4b\n" 78 "jmp 4b\n"
77 "5:\n\t" 79 "5:\n\t"
78 : "+m" (lock->slock) : "r" (flags) : "memory"); 80 : [slock] "+m" (lock->slock)
81 : [flags] "r" (flags)
82 CLI_STI_INPUT_ARGS
83 : "memory" CLI_STI_CLOBBERS);
79} 84}
80#endif 85#endif
81 86