aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/desc.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/desc.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/desc.h')
-rw-r--r--include/asm-i386/desc.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index f19820f0834f..f398cc456448 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -81,31 +81,15 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
81#undef C 81#undef C
82} 82}
83 83
84static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b)
85{
86 __u32 *lp = (__u32 *)((char *)dt + entry*8);
87 *lp = entry_a;
88 *(lp+1) = entry_b;
89}
90
91#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 84#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
92#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 85#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
93#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 86#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
94 87
95static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) 88static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b)
96{
97 __u32 a, b;
98 pack_gate(&a, &b, (unsigned long)addr, seg, type, 0);
99 write_idt_entry(idt_table, gate, a, b);
100}
101
102static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
103{ 89{
104 __u32 a, b; 90 __u32 *lp = (__u32 *)((char *)dt + entry*8);
105 pack_descriptor(&a, &b, (unsigned long)addr, 91 *lp = entry_a;
106 offsetof(struct tss_struct, __cacheline_filler) - 1, 92 *(lp+1) = entry_b;
107 DESCTYPE_TSS, 0);
108 write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
109} 93}
110 94
111#define set_ldt native_set_ldt 95#define set_ldt native_set_ldt
@@ -128,6 +112,23 @@ static inline fastcall void native_set_ldt(const void *addr,
128 } 112 }
129} 113}
130 114
115static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
116{
117 __u32 a, b;
118 pack_gate(&a, &b, (unsigned long)addr, seg, type, 0);
119 write_idt_entry(idt_table, gate, a, b);
120}
121
122static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
123{
124 __u32 a, b;
125 pack_descriptor(&a, &b, (unsigned long)addr,
126 offsetof(struct tss_struct, __cacheline_filler) - 1,
127 DESCTYPE_TSS, 0);
128 write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
129}
130
131
131#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) 132#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
132 133
133#define LDT_entry_a(info) \ 134#define LDT_entry_a(info) \