ia64/xen-unstable
changeset 2076:7b965136e215
bitkeeper revision 1.1145 (4110f479PxkIKUvFbncA2zFohr9-Gg)
Allow guests to register for synchronous callback (exception 15)
when a 4GB segment access is emulated by Xen. This will be used by
Linux to dynamically rewrite common instructions.
Allow guests to register for synchronous callback (exception 15)
when a 4GB segment access is emulated by Xen. This will be used by
Linux to dynamically rewrite common instructions.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Wed Aug 04 14:36:41 2004 +0000 (2004-08-04) |
parents | a3e585a0c6ca |
children | c8aef6c7b1a5 91b951040040 |
files | .rootkeys linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c xen/arch/x86/traps.c xen/arch/x86/x86_32/emulate.c xen/include/hypervisor-ifs/hypervisor-if.h |
line diff
1.1 --- a/.rootkeys Wed Aug 04 10:16:21 2004 +0000 1.2 +++ b/.rootkeys Wed Aug 04 14:36:41 2004 +0000 1.3 @@ -165,6 +165,7 @@ 40f56239zOksGg_H4XD4ye6iZNtoZA linux-2.6 1.4 40f56239bvOjuuuViZ0XMlNiREFC0A linux-2.6.7-xen-sparse/arch/xen/kernel/ctrl_if.c 1.5 40f56239pYRq5yshPTkv3ujXKc8K6g linux-2.6.7-xen-sparse/arch/xen/kernel/empty.c 1.6 40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.7-xen-sparse/arch/xen/kernel/evtchn.c 1.7 +4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c 1.8 40f56239sFcjHiIRmnObRIDF-zaeKQ linux-2.6.7-xen-sparse/arch/xen/kernel/process.c 1.9 40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.7-xen-sparse/arch/xen/kernel/reboot.c 1.10 3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.7-xen-sparse/arch/xen/kernel/xen_proc.c
2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S Wed Aug 04 10:16:21 2004 +0000 2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S Wed Aug 04 14:36:41 2004 +0000 2.3 @@ -735,9 +735,8 @@ ENTRY(machine_check) 2.4 jmp error_code 2.5 #endif 2.6 2.7 -ENTRY(spurious_interrupt_bug) 2.8 - pushl $0 2.9 - pushl $do_spurious_interrupt_bug 2.10 +ENTRY(fixup_4gb_segment) 2.11 + pushl $do_fixup_4gb_segment 2.12 jmp error_code 2.13 2.14 .data
3.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c Wed Aug 04 10:16:21 2004 +0000 3.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c Wed Aug 04 14:36:41 2004 +0000 3.3 @@ -1098,6 +1098,8 @@ void __init setup_arch(char **cmdline_p) 3.4 3.5 HYPERVISOR_vm_assist(VMASST_CMD_enable, 3.6 VMASST_TYPE_4gb_segments); 3.7 + HYPERVISOR_vm_assist(VMASST_CMD_enable, 3.8 + VMASST_TYPE_4gb_segments_notify); 3.9 #if 0 3.10 HYPERVISOR_vm_assist(VMASST_CMD_enable, 3.11 VMASST_TYPE_writeable_pagetables);
4.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c Wed Aug 04 10:16:21 2004 +0000 4.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c Wed Aug 04 14:36:41 2004 +0000 4.3 @@ -89,7 +89,7 @@ asmlinkage void page_fault(void); 4.4 asmlinkage void coprocessor_error(void); 4.5 asmlinkage void simd_coprocessor_error(void); 4.6 asmlinkage void alignment_check(void); 4.7 -asmlinkage void spurious_interrupt_bug(void); 4.8 +asmlinkage void fixup_4gb_segment(void); 4.9 asmlinkage void machine_check(void); 4.10 4.11 static int kstack_depth_to_print = 24; 4.12 @@ -822,15 +822,6 @@ asmlinkage void do_simd_coprocessor_erro 4.13 } 4.14 } 4.15 4.16 -asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs, 4.17 - long error_code) 4.18 -{ 4.19 -#if 0 4.20 - /* No need to warn about this any longer. */ 4.21 - printk("Ignoring P6 Local APIC Spurious Interrupt Bug...\n"); 4.22 -#endif 4.23 -} 4.24 - 4.25 /* 4.26 * 'math_state_restore()' saves the current math information in the 4.27 * old math state array, and gets the new ones from the current task 4.28 @@ -953,7 +944,7 @@ static trap_info_t trap_table[] = { 4.29 { 12, 0, __KERNEL_CS, (unsigned long)stack_segment }, 4.30 { 13, 0, __KERNEL_CS, (unsigned long)general_protection }, 4.31 { 14, 0, __KERNEL_CS, (unsigned long)page_fault }, 4.32 - { 15, 0, __KERNEL_CS, (unsigned long)spurious_interrupt_bug }, 4.33 + { 15, 0, __KERNEL_CS, (unsigned long)fixup_4gb_segment }, 4.34 { 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error }, 4.35 { 17, 0, __KERNEL_CS, (unsigned long)alignment_check }, 4.36 #ifdef CONFIG_X86_MCE
5.1 --- a/linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile Wed Aug 04 10:16:21 2004 +0000 5.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile Wed Aug 04 14:36:41 2004 +0000 5.3 @@ -9,4 +9,4 @@ XENARCH := $(subst ",,$(CONFIG_XENARCH)) 5.4 5.5 extra-y += vmlinux.lds.s 5.6 5.7 -obj-y := ctrl_if.o evtchn.o process.o reboot.o xen_proc.o empty.o 5.8 +obj-y := ctrl_if.o evtchn.o fixup.o process.o reboot.o xen_proc.o empty.o
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c Wed Aug 04 14:36:41 2004 +0000 6.3 @@ -0,0 +1,31 @@ 6.4 +/****************************************************************************** 6.5 + * fixup.c 6.6 + * 6.7 + * Binary-rewriting of certain IA32 instructions, on notification by Xen. 6.8 + * Used to avoid repeated slow emulation of common instructions used by the 6.9 + * user-space TLS (Thread-Local Storage) libraries. 6.10 + * 6.11 + * Copyright (c) 2004, K A Fraser 6.12 + * 6.13 + * This program is free software; you can redistribute it and/or modify 6.14 + * it under the terms of the GNU General Public License as published by 6.15 + * the Free Software Foundation; either version 2 of the License, or 6.16 + * (at your option) any later version. 6.17 + * 6.18 + * This program is distributed in the hope that it will be useful, 6.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 6.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 6.21 + * GNU General Public License for more details. 6.22 + * 6.23 + * You should have received a copy of the GNU General Public License 6.24 + * along with this program; if not, write to the Free Software 6.25 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6.26 + */ 6.27 + 6.28 +#include <linux/config.h> 6.29 +#include <linux/sched.h> 6.30 +#include <linux/kernel.h> 6.31 + 6.32 +asmlinkage void do_fixup_4gb_segment(struct pt_regs *regs, long error_code) 6.33 +{ 6.34 +}
7.1 --- a/xen/arch/x86/traps.c Wed Aug 04 10:16:21 2004 +0000 7.2 +++ b/xen/arch/x86/traps.c Wed Aug 04 14:36:41 2004 +0000 7.3 @@ -1,7 +1,7 @@ 7.4 /****************************************************************************** 7.5 * arch/i386/traps.c 7.6 * 7.7 - * Modifications to Linux original are copyright (c) 2002-2003, K A Fraser 7.8 + * Modifications to Linux original are copyright (c) 2002-2004, K A Fraser 7.9 * 7.10 * This program is free software; you can redistribute it and/or modify 7.11 * it under the terms of the GNU General Public License as published by 7.12 @@ -19,8 +19,6 @@ 7.13 */ 7.14 7.15 /* 7.16 - * xen/arch/i386/traps.c 7.17 - * 7.18 * Copyright (C) 1991, 1992 Linus Torvalds 7.19 * 7.20 * Pentium III FXSR, SSE support 7.21 @@ -220,30 +218,29 @@ static inline void do_trap(int trapnr, c 7.22 #define DO_ERROR_NOCODE(trapnr, str, name) \ 7.23 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 7.24 { \ 7.25 -do_trap(trapnr, str, regs, error_code, 0); \ 7.26 + do_trap(trapnr, str, regs, error_code, 0); \ 7.27 } 7.28 7.29 #define DO_ERROR(trapnr, str, name) \ 7.30 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 7.31 { \ 7.32 -do_trap(trapnr, str, regs, error_code, 1); \ 7.33 + do_trap(trapnr, str, regs, error_code, 1); \ 7.34 } 7.35 7.36 DO_ERROR_NOCODE( 0, "divide error", divide_error) 7.37 - DO_ERROR_NOCODE( 4, "overflow", overflow) 7.38 - DO_ERROR_NOCODE( 5, "bounds", bounds) 7.39 - DO_ERROR_NOCODE( 6, "invalid operand", invalid_op) 7.40 - DO_ERROR_NOCODE( 9, "coprocessor segment overrun", coprocessor_segment_overrun) 7.41 - DO_ERROR(10, "invalid TSS", invalid_TSS) 7.42 - DO_ERROR(11, "segment not present", segment_not_present) 7.43 - DO_ERROR(12, "stack segment", stack_segment) 7.44 -/* Vector 15 reserved by Intel */ 7.45 - DO_ERROR_NOCODE(16, "fpu error", coprocessor_error) 7.46 - DO_ERROR(17, "alignment check", alignment_check) 7.47 - DO_ERROR_NOCODE(18, "machine check", machine_check) 7.48 - DO_ERROR_NOCODE(19, "simd error", simd_coprocessor_error) 7.49 +DO_ERROR_NOCODE( 4, "overflow", overflow) 7.50 +DO_ERROR_NOCODE( 5, "bounds", bounds) 7.51 +DO_ERROR_NOCODE( 6, "invalid operand", invalid_op) 7.52 +DO_ERROR_NOCODE( 9, "coprocessor segment overrun", coprocessor_segment_overrun) 7.53 +DO_ERROR(10, "invalid TSS", invalid_TSS) 7.54 +DO_ERROR(11, "segment not present", segment_not_present) 7.55 +DO_ERROR(12, "stack segment", stack_segment) 7.56 +DO_ERROR_NOCODE(16, "fpu error", coprocessor_error) 7.57 +DO_ERROR(17, "alignment check", alignment_check) 7.58 +DO_ERROR_NOCODE(18, "machine check", machine_check) 7.59 +DO_ERROR_NOCODE(19, "simd error", simd_coprocessor_error) 7.60 7.61 - asmlinkage void do_int3(struct pt_regs *regs, long error_code) 7.62 +asmlinkage void do_int3(struct pt_regs *regs, long error_code) 7.63 { 7.64 struct domain *p = current; 7.65 struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
8.1 --- a/xen/arch/x86/x86_32/emulate.c Wed Aug 04 10:16:21 2004 +0000 8.2 +++ b/xen/arch/x86/x86_32/emulate.c Wed Aug 04 14:36:41 2004 +0000 8.3 @@ -502,6 +502,20 @@ int gpf_emulate_4gb(struct pt_regs *regs 8.4 /* Success! */ 8.5 perfc_incrc(emulations); 8.6 regs->eip += pb - eip; 8.7 + 8.8 + /* If requested, give a callback on otherwise unused vector 15. */ 8.9 + if ( VM_ASSIST(d, VMASST_TYPE_4gb_segments_notify) ) 8.10 + { 8.11 + ti = &d->thread.traps[15]; 8.12 + gtb = &guest_trap_bounce[d->processor]; 8.13 + gtb->flags = GTBF_TRAP; 8.14 + gtb->error_code = pb - eip; 8.15 + gtb->cs = ti->cs; 8.16 + gtb->eip = ti->address; 8.17 + if ( TI_GET_IF(ti) ) 8.18 + d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1; 8.19 + } 8.20 + 8.21 return 1; 8.22 8.23 undecodeable:
9.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h Wed Aug 04 10:16:21 2004 +0000 9.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h Wed Aug 04 14:36:41 2004 +0000 9.3 @@ -188,7 +188,8 @@ 9.4 #define VMASST_CMD_enable 0 9.5 #define VMASST_CMD_disable 1 9.6 #define VMASST_TYPE_4gb_segments 0 9.7 -#define VMASST_TYPE_writeable_pagetables 1 9.8 +#define VMASST_TYPE_4gb_segments_notify 1 9.9 +#define VMASST_TYPE_writeable_pagetables 2 9.10 9.11 #ifndef __ASSEMBLY__ 9.12