ia64/xen-unstable

changeset 3934:a5931595eca4

bitkeeper revision 1.1239 (421f601b3l9t6npsJbZzplqj6RuWIQ)

Merge wyvis.research.intel-research.net:/home/irchomes/rneugeba/src/xeno/xeno.bk
into wyvis.research.intel-research.net:/home/irchomes/rneugeba/src/xeno/xen.bench

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author rneugeba@wyvis.research.intel-research.net
date Fri Feb 25 17:27:55 2005 +0000 (2005-02-25)
parents b95a79b0f21a e93d8f53eabb
children 3a2834dc4f1b
files .rootkeys BitKeeper/etc/logging_ok extras/mini-os/h/hypervisor.h linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c linux-2.4.29-xen-sparse/arch/xen/kernel/process.c linux-2.4.29-xen-sparse/include/asm-xen/system.h linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6.10-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6.10-xen-sparse/drivers/char/tty_io.c linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/system.h linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/xor.h linux-2.6.10-xen-sparse/include/asm-xen/hypervisor.h netbsd-2.0-xen-sparse/sys/arch/xen/i386/machdep.c netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h tools/Makefile tools/Rules.mk tools/examples/xmexample.vmx tools/ioemu/gui/Makefile tools/ioemu/include/config.h tools/ioemu/iodev/Makefile tools/ioemu/iodev/main.cc tools/libxc/Makefile tools/libxc/xc_vmx_build.c tools/libxutil/Makefile tools/misc/miniterm/Makefile tools/xcs/Makefile tools/xfrd/xfrd.c xen/Makefile xen/arch/ia64/dom_fw.c xen/arch/ia64/regionreg.c xen/arch/ia64/vcpu.c xen/arch/x86/boot/mkelf32.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/i387.c xen/arch/x86/idle0_task.c xen/arch/x86/mm.c xen/arch/x86/pci-pc.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/smpboot.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_platform.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/domain_build.c xen/arch/x86/x86_32/domain_page.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/seg_fixup.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/domain_build.c xen/arch/x86/x86_64/mm.c xen/common/ac_timer.c xen/common/dom0_ops.c xen/common/dom_mem_ops.c xen/common/domain.c xen/common/elf.c xen/common/event_channel.c xen/common/grant_table.c xen/common/kernel.c xen/common/keyhandler.c xen/common/lib.c xen/common/multicall.c xen/common/page_alloc.c xen/common/perfc.c xen/common/physdev.c xen/common/resource.c xen/common/sched_atropos.c xen/common/sched_bvt.c xen/common/sched_rrobin.c xen/common/schedule.c xen/common/softirq.c xen/common/string.c xen/common/trace.c xen/common/vsprintf.c xen/common/xmalloc.c xen/drivers/char/console.c xen/drivers/char/serial.c xen/include/asm-ia64/domain.h xen/include/asm-x86/domain.h xen/include/asm-x86/i387.h xen/include/asm-x86/ldt.h xen/include/asm-x86/page.h xen/include/asm-x86/processor.h xen/include/asm-x86/serial.h xen/include/asm-x86/shadow.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_platform.h xen/include/asm-x86/vmx_virpit.h xen/include/asm-x86/vmx_vmcs.h xen/include/asm-x86/x86_32/current.h xen/include/asm-x86/x86_32/page.h xen/include/asm-x86/x86_64/current.h xen/include/asm-x86/x86_64/page.h xen/include/public/physdev.h xen/include/xen/ac_timer.h xen/include/xen/domain.h xen/include/xen/lib.h xen/include/xen/perfc.h xen/include/xen/perfc_defn.h xen/include/xen/sched.h xen/include/xen/serial.h xen/include/xen/time.h
line diff
     1.1 --- a/.rootkeys	Fri Feb 25 17:27:21 2005 +0000
     1.2 +++ b/.rootkeys	Fri Feb 25 17:27:55 2005 +0000
     1.3 @@ -258,7 +258,6 @@ 40f5623bgzm_9vwxpzJswlAxg298Gg linux-2.6
     1.4  40f5623bVdKP7Dt7qm8twu3NcnGNbA linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/system.h
     1.5  40f5623bc8LKPRO09wY5dGDnY_YCpw linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/tlbflush.h
     1.6  41062ab7uFxnCq-KtPeAm-aV8CicgA linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/vga.h
     1.7 -40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/xor.h
     1.8  41af4017PDMuSmMWtSRU5UC9Vylw5g linux-2.6.10-xen-sparse/include/asm-xen/balloon.h
     1.9  40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.10-xen-sparse/include/asm-xen/ctrl_if.h
    1.10  40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.10-xen-sparse/include/asm-xen/evtchn.h
     2.1 --- a/BitKeeper/etc/logging_ok	Fri Feb 25 17:27:21 2005 +0000
     2.2 +++ b/BitKeeper/etc/logging_ok	Fri Feb 25 17:27:55 2005 +0000
     2.3 @@ -6,6 +6,7 @@ akw27@arcadians.cl.cam.ac.uk
     2.4  akw27@boulderdash.cl.cam.ac.uk
     2.5  akw27@labyrinth.cl.cam.ac.uk
     2.6  akw27@plucky.localdomain
     2.7 +arun.sharma@intel.com
     2.8  bd240@boulderdash.cl.cam.ac.uk
     2.9  bd240@labyrinth.cl.cam.ac.uk
    2.10  br260@br260.wolfson.cam.ac.uk
     3.1 --- a/extras/mini-os/h/hypervisor.h	Fri Feb 25 17:27:21 2005 +0000
     3.2 +++ b/extras/mini-os/h/hypervisor.h	Fri Feb 25 17:27:55 2005 +0000
     3.3 @@ -126,12 +126,18 @@ static __inline__ int HYPERVISOR_set_cal
     3.4  }
     3.5  #endif
     3.6  
     3.7 -static __inline__ int HYPERVISOR_fpu_taskswitch(void)
     3.8 +static __inline__ int
     3.9 +HYPERVISOR_fpu_taskswitch(
    3.10 +    int set)
    3.11  {
    3.12      int ret;
    3.13 +    unsigned long ign;
    3.14 +
    3.15      __asm__ __volatile__ (
    3.16          TRAP_INSTR
    3.17 -        : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
    3.18 +        : "=a" (ret), "=b" (ign)
    3.19 +        : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
    3.20 +        : "memory" );
    3.21  
    3.22      return ret;
    3.23  }
     4.1 --- a/linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c	Fri Feb 25 17:27:21 2005 +0000
     4.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c	Fri Feb 25 17:27:55 2005 +0000
     4.3 @@ -288,7 +288,7 @@ static int xlvbd_init_device(vdisk_t *xd
     4.4          /* Need to skankily setup 'partition' information */
     4.5          gd->part[minor].start_sect = 0; 
     4.6          gd->part[minor].nr_sects   = capacity; 
     4.7 -        gd->sizes[minor]           = capacity; 
     4.8 +        gd->sizes[minor]           = capacity >>(BLOCK_SIZE_BITS-9); 
     4.9  
    4.10          gd->flags[minor >> gd->minor_shift] |= GENHD_FL_VIRT_PARTNS;
    4.11      }
     5.1 --- a/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c	Fri Feb 25 17:27:21 2005 +0000
     5.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/process.c	Fri Feb 25 17:27:55 2005 +0000
     5.3 @@ -334,7 +334,7 @@ void fastcall __switch_to(struct task_st
     5.4              asm volatile( "fnsave %0 ; fwait"
     5.5                            : "=m" (prev_p->thread.i387.fsave) );
     5.6  	prev_p->flags &= ~PF_USEDFPU;
     5.7 -        queue_multicall0(__HYPERVISOR_fpu_taskswitch);
     5.8 +        queue_multicall1(__HYPERVISOR_fpu_taskswitch, 1);
     5.9      }
    5.10  
    5.11      queue_multicall2(__HYPERVISOR_stack_switch, __KERNEL_DS, next->esp0);
     6.1 --- a/linux-2.4.29-xen-sparse/include/asm-xen/system.h	Fri Feb 25 17:27:21 2005 +0000
     6.2 +++ b/linux-2.4.29-xen-sparse/include/asm-xen/system.h	Fri Feb 25 17:27:55 2005 +0000
     6.3 @@ -109,7 +109,7 @@ static inline unsigned long _get_base(ch
     6.4  
     6.5  /* NB. 'clts' is done for us by Xen during virtual trap. */
     6.6  #define clts() ((void)0)
     6.7 -#define stts() (HYPERVISOR_fpu_taskswitch())
     6.8 +#define stts() (HYPERVISOR_fpu_taskswitch(1))
     6.9  
    6.10  #endif	/* __KERNEL__ */
    6.11  
     7.1 --- a/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig	Fri Feb 25 17:27:21 2005 +0000
     7.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig	Fri Feb 25 17:27:55 2005 +0000
     7.3 @@ -1,7 +1,7 @@
     7.4  #
     7.5  # Automatically generated make config: don't edit
     7.6  # Linux kernel version: 2.6.10-xen0
     7.7 -# Mon Dec 27 10:14:40 2004
     7.8 +# Mon Feb 21 13:46:38 2005
     7.9  #
    7.10  CONFIG_XEN=y
    7.11  CONFIG_ARCH_XEN=y
     8.1 --- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c	Fri Feb 25 17:27:21 2005 +0000
     8.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c	Fri Feb 25 17:27:55 2005 +0000
     8.3 @@ -482,11 +482,8 @@ struct task_struct fastcall * __switch_t
     8.4  	asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
     8.5  
     8.6  	/*
     8.7 -	 * We clobber FS and GS here so that we avoid a GPF when
     8.8 -	 * restoring previous task's FS/GS values in Xen when the LDT
     8.9 -	 * is switched. If we don't do this then we can end up
    8.10 -	 * erroneously re-flushing the page-update queue when we
    8.11 -	 * 'execute_multicall_list'.
    8.12 +	 * We clobber FS and GS here so that we avoid a GPF when restoring
    8.13 +	 * previous task's FS/GS values in Xen when the LDT is switched.
    8.14  	 */
    8.15  	__asm__ __volatile__ ( 
    8.16  		"xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs" : : :
    8.17 @@ -502,8 +499,8 @@ struct task_struct fastcall * __switch_t
    8.18  	 * synchronously trapping to Xen.
    8.19  	 */
    8.20  	if (prev_p->thread_info->status & TS_USEDFPU) {
    8.21 -		save_init_fpu(prev_p);
    8.22 -		queue_multicall0(__HYPERVISOR_fpu_taskswitch);
    8.23 +		__save_init_fpu(prev_p); /* _not_ save_init_fpu() */
    8.24 +		queue_multicall1(__HYPERVISOR_fpu_taskswitch, 1);
    8.25  	}
    8.26  
    8.27  	/*
    8.28 @@ -511,12 +508,6 @@ struct task_struct fastcall * __switch_t
    8.29  	 * This is load_esp0(tss, next) with a multicall.
    8.30  	 */
    8.31  	tss->esp0 = next->esp0;
    8.32 -	/* This can only happen when SEP is enabled, no need to test
    8.33 -	 * "SEP"arately */
    8.34 -	if (unlikely(tss->ss1 != next->sysenter_cs)) {
    8.35 -		tss->ss1 = next->sysenter_cs;
    8.36 -		wrmsr(MSR_IA32_SYSENTER_CS, next->sysenter_cs, 0);
    8.37 -	}
    8.38  	queue_multicall2(__HYPERVISOR_stack_switch, tss->ss0, tss->esp0);
    8.39  
    8.40  	/*
    8.41 @@ -550,7 +541,7 @@ struct task_struct fastcall * __switch_t
    8.42  	/*
    8.43  	 * Restore %fs and %gs if needed.
    8.44  	 */
    8.45 -	if (unlikely(prev->fs | prev->gs | next->fs | next->gs)) {
    8.46 +	if (unlikely(next->fs | next->gs)) {
    8.47  		loadsegment(fs, next->fs);
    8.48  		loadsegment(gs, next->gs);
    8.49  	}
     9.1 --- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/traps.c	Fri Feb 25 17:27:21 2005 +0000
     9.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/traps.c	Fri Feb 25 17:27:55 2005 +0000
     9.3 @@ -902,15 +902,7 @@ asmlinkage void math_state_restore(struc
     9.4  	struct thread_info *thread = current_thread_info();
     9.5  	struct task_struct *tsk = thread->task;
     9.6  
     9.7 -	/*
     9.8 -	 * A trap in kernel mode can be ignored. It'll be the fast XOR or
     9.9 -	 * copying libraries, which will correctly save/restore state and
    9.10 -	 * reset the TS bit in CR0.
    9.11 -	 */
    9.12 -	if ((regs.xcs & 2) == 0)
    9.13 -		return;
    9.14 -
    9.15 -	clts();		/* Allow maths ops (or we recurse) */
    9.16 +	/* NB. 'clts' is done for us by Xen during virtual trap. */
    9.17  	if (!tsk->used_math)
    9.18  		init_fpu(tsk);
    9.19  	restore_fpu(tsk);
    10.1 --- a/linux-2.6.10-xen-sparse/drivers/char/tty_io.c	Fri Feb 25 17:27:21 2005 +0000
    10.2 +++ b/linux-2.6.10-xen-sparse/drivers/char/tty_io.c	Fri Feb 25 17:27:55 2005 +0000
    10.3 @@ -1772,7 +1772,7 @@ retry_open:
    10.4  		goto got_driver;
    10.5  	}
    10.6  #ifdef CONFIG_VT
    10.7 -	if (device == MKDEV(TTY_MAJOR,0)) {
    10.8 +	if (console_use_vt && (device == MKDEV(TTY_MAJOR,0))) {
    10.9  		extern int fg_console;
   10.10  		extern struct tty_driver *console_driver;
   10.11  		driver = console_driver;
    11.1 --- a/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/system.h	Fri Feb 25 17:27:21 2005 +0000
    11.2 +++ b/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/system.h	Fri Feb 25 17:27:55 2005 +0000
    11.3 @@ -106,18 +106,16 @@ static inline unsigned long _get_base(ch
    11.4  /*
    11.5   * Clear and set 'TS' bit respectively
    11.6   */
    11.7 -/* NB. 'clts' is done for us by Xen during virtual trap. */
    11.8 -#define clts() ((void)0)
    11.9 +#define clts() (HYPERVISOR_fpu_taskswitch(0))
   11.10  #define read_cr0() \
   11.11  	BUG();
   11.12  #define write_cr0(x) \
   11.13  	BUG();
   11.14 -
   11.15  #define read_cr4() \
   11.16  	BUG();
   11.17  #define write_cr4(x) \
   11.18  	BUG();
   11.19 -#define stts() (HYPERVISOR_fpu_taskswitch())
   11.20 +#define stts() (HYPERVISOR_fpu_taskswitch(1))
   11.21  
   11.22  #endif	/* __KERNEL__ */
   11.23  
    12.1 --- a/linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/xor.h	Fri Feb 25 17:27:21 2005 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,884 +0,0 @@
    12.4 -/*
    12.5 - * include/asm-i386/xor.h
    12.6 - *
    12.7 - * Optimized RAID-5 checksumming functions for MMX and SSE.
    12.8 - *
    12.9 - * This program is free software; you can redistribute it and/or modify
   12.10 - * it under the terms of the GNU General Public License as published by
   12.11 - * the Free Software Foundation; either version 2, or (at your option)
   12.12 - * any later version.
   12.13 - *
   12.14 - * You should have received a copy of the GNU General Public License
   12.15 - * (for example /usr/src/linux/COPYING); if not, write to the Free
   12.16 - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   12.17 - */
   12.18 -
   12.19 -/*
   12.20 - * High-speed RAID5 checksumming functions utilizing MMX instructions.
   12.21 - * Copyright (C) 1998 Ingo Molnar.
   12.22 - */
   12.23 -
   12.24 -#define LD(x,y)		"       movq   8*("#x")(%1), %%mm"#y"   ;\n"
   12.25 -#define ST(x,y)		"       movq %%mm"#y",   8*("#x")(%1)   ;\n"
   12.26 -#define XO1(x,y)	"       pxor   8*("#x")(%2), %%mm"#y"   ;\n"
   12.27 -#define XO2(x,y)	"       pxor   8*("#x")(%3), %%mm"#y"   ;\n"
   12.28 -#define XO3(x,y)	"       pxor   8*("#x")(%4), %%mm"#y"   ;\n"
   12.29 -#define XO4(x,y)	"       pxor   8*("#x")(%5), %%mm"#y"   ;\n"
   12.30 -
   12.31 -#include <asm/i387.h>
   12.32 -
   12.33 -static void
   12.34 -xor_pII_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
   12.35 -{
   12.36 -	unsigned long lines = bytes >> 7;
   12.37 -
   12.38 -	kernel_fpu_begin();
   12.39 -
   12.40 -	__asm__ __volatile__ (
   12.41 -#undef BLOCK
   12.42 -#define BLOCK(i) \
   12.43 -	LD(i,0)					\
   12.44 -		LD(i+1,1)			\
   12.45 -			LD(i+2,2)		\
   12.46 -				LD(i+3,3)	\
   12.47 -	XO1(i,0)				\
   12.48 -	ST(i,0)					\
   12.49 -		XO1(i+1,1)			\
   12.50 -		ST(i+1,1)			\
   12.51 -			XO1(i+2,2)		\
   12.52 -			ST(i+2,2)		\
   12.53 -				XO1(i+3,3)	\
   12.54 -				ST(i+3,3)
   12.55 -
   12.56 -	" .align 32			;\n"
   12.57 -  	" 1:                            ;\n"
   12.58 -
   12.59 -	BLOCK(0)
   12.60 -	BLOCK(4)
   12.61 -	BLOCK(8)
   12.62 -	BLOCK(12)
   12.63 -
   12.64 -	"       addl $128, %1         ;\n"
   12.65 -	"       addl $128, %2         ;\n"
   12.66 -	"       decl %0               ;\n"
   12.67 -	"       jnz 1b                ;\n"
   12.68 -	: "+r" (lines),
   12.69 -	  "+r" (p1), "+r" (p2)
   12.70 -	:
   12.71 -	: "memory");
   12.72 -
   12.73 -	kernel_fpu_end();
   12.74 -}
   12.75 -
   12.76 -static void
   12.77 -xor_pII_mmx_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
   12.78 -	      unsigned long *p3)
   12.79 -{
   12.80 -	unsigned long lines = bytes >> 7;
   12.81 -
   12.82 -	kernel_fpu_begin();
   12.83 -
   12.84 -	__asm__ __volatile__ (
   12.85 -#undef BLOCK
   12.86 -#define BLOCK(i) \
   12.87 -	LD(i,0)					\
   12.88 -		LD(i+1,1)			\
   12.89 -			LD(i+2,2)		\
   12.90 -				LD(i+3,3)	\
   12.91 -	XO1(i,0)				\
   12.92 -		XO1(i+1,1)			\
   12.93 -			XO1(i+2,2)		\
   12.94 -				XO1(i+3,3)	\
   12.95 -	XO2(i,0)				\
   12.96 -	ST(i,0)					\
   12.97 -		XO2(i+1,1)			\
   12.98 -		ST(i+1,1)			\
   12.99 -			XO2(i+2,2)		\
  12.100 -			ST(i+2,2)		\
  12.101 -				XO2(i+3,3)	\
  12.102 -				ST(i+3,3)
  12.103 -
  12.104 -	" .align 32			;\n"
  12.105 -	" 1:                            ;\n"
  12.106 -
  12.107 -	BLOCK(0)
  12.108 -	BLOCK(4)
  12.109 -	BLOCK(8)
  12.110 -	BLOCK(12)
  12.111 -
  12.112 -	"       addl $128, %1         ;\n"
  12.113 -	"       addl $128, %2         ;\n"
  12.114 -	"       addl $128, %3         ;\n"
  12.115 -	"       decl %0               ;\n"
  12.116 -	"       jnz 1b                ;\n"
  12.117 -	: "+r" (lines),
  12.118 -	  "+r" (p1), "+r" (p2), "+r" (p3)
  12.119 -	:
  12.120 -	: "memory");
  12.121 -
  12.122 -	kernel_fpu_end();
  12.123 -}
  12.124 -
  12.125 -static void
  12.126 -xor_pII_mmx_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.127 -	      unsigned long *p3, unsigned long *p4)
  12.128 -{
  12.129 -	unsigned long lines = bytes >> 7;
  12.130 -
  12.131 -	kernel_fpu_begin();
  12.132 -
  12.133 -	__asm__ __volatile__ (
  12.134 -#undef BLOCK
  12.135 -#define BLOCK(i) \
  12.136 -	LD(i,0)					\
  12.137 -		LD(i+1,1)			\
  12.138 -			LD(i+2,2)		\
  12.139 -				LD(i+3,3)	\
  12.140 -	XO1(i,0)				\
  12.141 -		XO1(i+1,1)			\
  12.142 -			XO1(i+2,2)		\
  12.143 -				XO1(i+3,3)	\
  12.144 -	XO2(i,0)				\
  12.145 -		XO2(i+1,1)			\
  12.146 -			XO2(i+2,2)		\
  12.147 -				XO2(i+3,3)	\
  12.148 -	XO3(i,0)				\
  12.149 -	ST(i,0)					\
  12.150 -		XO3(i+1,1)			\
  12.151 -		ST(i+1,1)			\
  12.152 -			XO3(i+2,2)		\
  12.153 -			ST(i+2,2)		\
  12.154 -				XO3(i+3,3)	\
  12.155 -				ST(i+3,3)
  12.156 -
  12.157 -	" .align 32			;\n"
  12.158 -	" 1:                            ;\n"
  12.159 -
  12.160 -	BLOCK(0)
  12.161 -	BLOCK(4)
  12.162 -	BLOCK(8)
  12.163 -	BLOCK(12)
  12.164 -
  12.165 -	"       addl $128, %1         ;\n"
  12.166 -	"       addl $128, %2         ;\n"
  12.167 -	"       addl $128, %3         ;\n"
  12.168 -	"       addl $128, %4         ;\n"
  12.169 -	"       decl %0               ;\n"
  12.170 -	"       jnz 1b                ;\n"
  12.171 -	: "+r" (lines),
  12.172 -	  "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
  12.173 -	:
  12.174 -	: "memory");
  12.175 -
  12.176 -	kernel_fpu_end();
  12.177 -}
  12.178 -
  12.179 -
  12.180 -static void
  12.181 -xor_pII_mmx_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.182 -	      unsigned long *p3, unsigned long *p4, unsigned long *p5)
  12.183 -{
  12.184 -	unsigned long lines = bytes >> 7;
  12.185 -
  12.186 -	kernel_fpu_begin();
  12.187 -
  12.188 -	/* Make sure GCC forgets anything it knows about p4 or p5,
  12.189 -	   such that it won't pass to the asm volatile below a
  12.190 -	   register that is shared with any other variable.  That's
  12.191 -	   because we modify p4 and p5 there, but we can't mark them
  12.192 -	   as read/write, otherwise we'd overflow the 10-asm-operands
  12.193 -	   limit of GCC < 3.1.  */
  12.194 -	__asm__ ("" : "+r" (p4), "+r" (p5));
  12.195 -
  12.196 -	__asm__ __volatile__ (
  12.197 -#undef BLOCK
  12.198 -#define BLOCK(i) \
  12.199 -	LD(i,0)					\
  12.200 -		LD(i+1,1)			\
  12.201 -			LD(i+2,2)		\
  12.202 -				LD(i+3,3)	\
  12.203 -	XO1(i,0)				\
  12.204 -		XO1(i+1,1)			\
  12.205 -			XO1(i+2,2)		\
  12.206 -				XO1(i+3,3)	\
  12.207 -	XO2(i,0)				\
  12.208 -		XO2(i+1,1)			\
  12.209 -			XO2(i+2,2)		\
  12.210 -				XO2(i+3,3)	\
  12.211 -	XO3(i,0)				\
  12.212 -		XO3(i+1,1)			\
  12.213 -			XO3(i+2,2)		\
  12.214 -				XO3(i+3,3)	\
  12.215 -	XO4(i,0)				\
  12.216 -	ST(i,0)					\
  12.217 -		XO4(i+1,1)			\
  12.218 -		ST(i+1,1)			\
  12.219 -			XO4(i+2,2)		\
  12.220 -			ST(i+2,2)		\
  12.221 -				XO4(i+3,3)	\
  12.222 -				ST(i+3,3)
  12.223 -
  12.224 -	" .align 32			;\n"
  12.225 -	" 1:                            ;\n"
  12.226 -
  12.227 -	BLOCK(0)
  12.228 -	BLOCK(4)
  12.229 -	BLOCK(8)
  12.230 -	BLOCK(12)
  12.231 -
  12.232 -	"       addl $128, %1         ;\n"
  12.233 -	"       addl $128, %2         ;\n"
  12.234 -	"       addl $128, %3         ;\n"
  12.235 -	"       addl $128, %4         ;\n"
  12.236 -	"       addl $128, %5         ;\n"
  12.237 -	"       decl %0               ;\n"
  12.238 -	"       jnz 1b                ;\n"
  12.239 -	: "+r" (lines),
  12.240 -	  "+r" (p1), "+r" (p2), "+r" (p3)
  12.241 -	: "r" (p4), "r" (p5) 
  12.242 -	: "memory");
  12.243 -
  12.244 -	/* p4 and p5 were modified, and now the variables are dead.
  12.245 -	   Clobber them just to be sure nobody does something stupid
  12.246 -	   like assuming they have some legal value.  */
  12.247 -	__asm__ ("" : "=r" (p4), "=r" (p5));
  12.248 -
  12.249 -	kernel_fpu_end();
  12.250 -}
  12.251 -
  12.252 -#undef LD
  12.253 -#undef XO1
  12.254 -#undef XO2
  12.255 -#undef XO3
  12.256 -#undef XO4
  12.257 -#undef ST
  12.258 -#undef BLOCK
  12.259 -
  12.260 -static void
  12.261 -xor_p5_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  12.262 -{
  12.263 -	unsigned long lines = bytes >> 6;
  12.264 -
  12.265 -	kernel_fpu_begin();
  12.266 -
  12.267 -	__asm__ __volatile__ (
  12.268 -	" .align 32	             ;\n"
  12.269 -	" 1:                         ;\n"
  12.270 -	"       movq   (%1), %%mm0   ;\n"
  12.271 -	"       movq  8(%1), %%mm1   ;\n"
  12.272 -	"       pxor   (%2), %%mm0   ;\n"
  12.273 -	"       movq 16(%1), %%mm2   ;\n"
  12.274 -	"       movq %%mm0,   (%1)   ;\n"
  12.275 -	"       pxor  8(%2), %%mm1   ;\n"
  12.276 -	"       movq 24(%1), %%mm3   ;\n"
  12.277 -	"       movq %%mm1,  8(%1)   ;\n"
  12.278 -	"       pxor 16(%2), %%mm2   ;\n"
  12.279 -	"       movq 32(%1), %%mm4   ;\n"
  12.280 -	"       movq %%mm2, 16(%1)   ;\n"
  12.281 -	"       pxor 24(%2), %%mm3   ;\n"
  12.282 -	"       movq 40(%1), %%mm5   ;\n"
  12.283 -	"       movq %%mm3, 24(%1)   ;\n"
  12.284 -	"       pxor 32(%2), %%mm4   ;\n"
  12.285 -	"       movq 48(%1), %%mm6   ;\n"
  12.286 -	"       movq %%mm4, 32(%1)   ;\n"
  12.287 -	"       pxor 40(%2), %%mm5   ;\n"
  12.288 -	"       movq 56(%1), %%mm7   ;\n"
  12.289 -	"       movq %%mm5, 40(%1)   ;\n"
  12.290 -	"       pxor 48(%2), %%mm6   ;\n"
  12.291 -	"       pxor 56(%2), %%mm7   ;\n"
  12.292 -	"       movq %%mm6, 48(%1)   ;\n"
  12.293 -	"       movq %%mm7, 56(%1)   ;\n"
  12.294 -	
  12.295 -	"       addl $64, %1         ;\n"
  12.296 -	"       addl $64, %2         ;\n"
  12.297 -	"       decl %0              ;\n"
  12.298 -	"       jnz 1b               ;\n"
  12.299 -	: "+r" (lines),
  12.300 -	  "+r" (p1), "+r" (p2)
  12.301 -	:
  12.302 -	: "memory");
  12.303 -
  12.304 -	kernel_fpu_end();
  12.305 -}
  12.306 -
  12.307 -static void
  12.308 -xor_p5_mmx_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.309 -	     unsigned long *p3)
  12.310 -{
  12.311 -	unsigned long lines = bytes >> 6;
  12.312 -
  12.313 -	kernel_fpu_begin();
  12.314 -
  12.315 -	__asm__ __volatile__ (
  12.316 -	" .align 32,0x90             ;\n"
  12.317 -	" 1:                         ;\n"
  12.318 -	"       movq   (%1), %%mm0   ;\n"
  12.319 -	"       movq  8(%1), %%mm1   ;\n"
  12.320 -	"       pxor   (%2), %%mm0   ;\n"
  12.321 -	"       movq 16(%1), %%mm2   ;\n"
  12.322 -	"       pxor  8(%2), %%mm1   ;\n"
  12.323 -	"       pxor   (%3), %%mm0   ;\n"
  12.324 -	"       pxor 16(%2), %%mm2   ;\n"
  12.325 -	"       movq %%mm0,   (%1)   ;\n"
  12.326 -	"       pxor  8(%3), %%mm1   ;\n"
  12.327 -	"       pxor 16(%3), %%mm2   ;\n"
  12.328 -	"       movq 24(%1), %%mm3   ;\n"
  12.329 -	"       movq %%mm1,  8(%1)   ;\n"
  12.330 -	"       movq 32(%1), %%mm4   ;\n"
  12.331 -	"       movq 40(%1), %%mm5   ;\n"
  12.332 -	"       pxor 24(%2), %%mm3   ;\n"
  12.333 -	"       movq %%mm2, 16(%1)   ;\n"
  12.334 -	"       pxor 32(%2), %%mm4   ;\n"
  12.335 -	"       pxor 24(%3), %%mm3   ;\n"
  12.336 -	"       pxor 40(%2), %%mm5   ;\n"
  12.337 -	"       movq %%mm3, 24(%1)   ;\n"
  12.338 -	"       pxor 32(%3), %%mm4   ;\n"
  12.339 -	"       pxor 40(%3), %%mm5   ;\n"
  12.340 -	"       movq 48(%1), %%mm6   ;\n"
  12.341 -	"       movq %%mm4, 32(%1)   ;\n"
  12.342 -	"       movq 56(%1), %%mm7   ;\n"
  12.343 -	"       pxor 48(%2), %%mm6   ;\n"
  12.344 -	"       movq %%mm5, 40(%1)   ;\n"
  12.345 -	"       pxor 56(%2), %%mm7   ;\n"
  12.346 -	"       pxor 48(%3), %%mm6   ;\n"
  12.347 -	"       pxor 56(%3), %%mm7   ;\n"
  12.348 -	"       movq %%mm6, 48(%1)   ;\n"
  12.349 -	"       movq %%mm7, 56(%1)   ;\n"
  12.350 -      
  12.351 -	"       addl $64, %1         ;\n"
  12.352 -	"       addl $64, %2         ;\n"
  12.353 -	"       addl $64, %3         ;\n"
  12.354 -	"       decl %0              ;\n"
  12.355 -	"       jnz 1b               ;\n"
  12.356 -	: "+r" (lines),
  12.357 -	  "+r" (p1), "+r" (p2), "+r" (p3)
  12.358 -	:
  12.359 -	: "memory" );
  12.360 -
  12.361 -	kernel_fpu_end();
  12.362 -}
  12.363 -
  12.364 -static void
  12.365 -xor_p5_mmx_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.366 -	     unsigned long *p3, unsigned long *p4)
  12.367 -{
  12.368 -	unsigned long lines = bytes >> 6;
  12.369 -
  12.370 -	kernel_fpu_begin();
  12.371 -
  12.372 -	__asm__ __volatile__ (
  12.373 -	" .align 32,0x90             ;\n"
  12.374 -	" 1:                         ;\n"
  12.375 -	"       movq   (%1), %%mm0   ;\n"
  12.376 -	"       movq  8(%1), %%mm1   ;\n"
  12.377 -	"       pxor   (%2), %%mm0   ;\n"
  12.378 -	"       movq 16(%1), %%mm2   ;\n"
  12.379 -	"       pxor  8(%2), %%mm1   ;\n"
  12.380 -	"       pxor   (%3), %%mm0   ;\n"
  12.381 -	"       pxor 16(%2), %%mm2   ;\n"
  12.382 -	"       pxor  8(%3), %%mm1   ;\n"
  12.383 -	"       pxor   (%4), %%mm0   ;\n"
  12.384 -	"       movq 24(%1), %%mm3   ;\n"
  12.385 -	"       pxor 16(%3), %%mm2   ;\n"
  12.386 -	"       pxor  8(%4), %%mm1   ;\n"
  12.387 -	"       movq %%mm0,   (%1)   ;\n"
  12.388 -	"       movq 32(%1), %%mm4   ;\n"
  12.389 -	"       pxor 24(%2), %%mm3   ;\n"
  12.390 -	"       pxor 16(%4), %%mm2   ;\n"
  12.391 -	"       movq %%mm1,  8(%1)   ;\n"
  12.392 -	"       movq 40(%1), %%mm5   ;\n"
  12.393 -	"       pxor 32(%2), %%mm4   ;\n"
  12.394 -	"       pxor 24(%3), %%mm3   ;\n"
  12.395 -	"       movq %%mm2, 16(%1)   ;\n"
  12.396 -	"       pxor 40(%2), %%mm5   ;\n"
  12.397 -	"       pxor 32(%3), %%mm4   ;\n"
  12.398 -	"       pxor 24(%4), %%mm3   ;\n"
  12.399 -	"       movq %%mm3, 24(%1)   ;\n"
  12.400 -	"       movq 56(%1), %%mm7   ;\n"
  12.401 -	"       movq 48(%1), %%mm6   ;\n"
  12.402 -	"       pxor 40(%3), %%mm5   ;\n"
  12.403 -	"       pxor 32(%4), %%mm4   ;\n"
  12.404 -	"       pxor 48(%2), %%mm6   ;\n"
  12.405 -	"       movq %%mm4, 32(%1)   ;\n"
  12.406 -	"       pxor 56(%2), %%mm7   ;\n"
  12.407 -	"       pxor 40(%4), %%mm5   ;\n"
  12.408 -	"       pxor 48(%3), %%mm6   ;\n"
  12.409 -	"       pxor 56(%3), %%mm7   ;\n"
  12.410 -	"       movq %%mm5, 40(%1)   ;\n"
  12.411 -	"       pxor 48(%4), %%mm6   ;\n"
  12.412 -	"       pxor 56(%4), %%mm7   ;\n"
  12.413 -	"       movq %%mm6, 48(%1)   ;\n"
  12.414 -	"       movq %%mm7, 56(%1)   ;\n"
  12.415 -      
  12.416 -	"       addl $64, %1         ;\n"
  12.417 -	"       addl $64, %2         ;\n"
  12.418 -	"       addl $64, %3         ;\n"
  12.419 -	"       addl $64, %4         ;\n"
  12.420 -	"       decl %0              ;\n"
  12.421 -	"       jnz 1b               ;\n"
  12.422 -	: "+r" (lines),
  12.423 -	  "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
  12.424 -	:
  12.425 -	: "memory");
  12.426 -
  12.427 -	kernel_fpu_end();
  12.428 -}
  12.429 -
  12.430 -static void
  12.431 -xor_p5_mmx_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.432 -	     unsigned long *p3, unsigned long *p4, unsigned long *p5)
  12.433 -{
  12.434 -	unsigned long lines = bytes >> 6;
  12.435 -
  12.436 -	kernel_fpu_begin();
  12.437 -
  12.438 -	/* Make sure GCC forgets anything it knows about p4 or p5,
  12.439 -	   such that it won't pass to the asm volatile below a
  12.440 -	   register that is shared with any other variable.  That's
  12.441 -	   because we modify p4 and p5 there, but we can't mark them
  12.442 -	   as read/write, otherwise we'd overflow the 10-asm-operands
  12.443 -	   limit of GCC < 3.1.  */
  12.444 -	__asm__ ("" : "+r" (p4), "+r" (p5));
  12.445 -
  12.446 -	__asm__ __volatile__ (
  12.447 -	" .align 32,0x90             ;\n"
  12.448 -	" 1:                         ;\n"
  12.449 -	"       movq   (%1), %%mm0   ;\n"
  12.450 -	"       movq  8(%1), %%mm1   ;\n"
  12.451 -	"       pxor   (%2), %%mm0   ;\n"
  12.452 -	"       pxor  8(%2), %%mm1   ;\n"
  12.453 -	"       movq 16(%1), %%mm2   ;\n"
  12.454 -	"       pxor   (%3), %%mm0   ;\n"
  12.455 -	"       pxor  8(%3), %%mm1   ;\n"
  12.456 -	"       pxor 16(%2), %%mm2   ;\n"
  12.457 -	"       pxor   (%4), %%mm0   ;\n"
  12.458 -	"       pxor  8(%4), %%mm1   ;\n"
  12.459 -	"       pxor 16(%3), %%mm2   ;\n"
  12.460 -	"       movq 24(%1), %%mm3   ;\n"
  12.461 -	"       pxor   (%5), %%mm0   ;\n"
  12.462 -	"       pxor  8(%5), %%mm1   ;\n"
  12.463 -	"       movq %%mm0,   (%1)   ;\n"
  12.464 -	"       pxor 16(%4), %%mm2   ;\n"
  12.465 -	"       pxor 24(%2), %%mm3   ;\n"
  12.466 -	"       movq %%mm1,  8(%1)   ;\n"
  12.467 -	"       pxor 16(%5), %%mm2   ;\n"
  12.468 -	"       pxor 24(%3), %%mm3   ;\n"
  12.469 -	"       movq 32(%1), %%mm4   ;\n"
  12.470 -	"       movq %%mm2, 16(%1)   ;\n"
  12.471 -	"       pxor 24(%4), %%mm3   ;\n"
  12.472 -	"       pxor 32(%2), %%mm4   ;\n"
  12.473 -	"       movq 40(%1), %%mm5   ;\n"
  12.474 -	"       pxor 24(%5), %%mm3   ;\n"
  12.475 -	"       pxor 32(%3), %%mm4   ;\n"
  12.476 -	"       pxor 40(%2), %%mm5   ;\n"
  12.477 -	"       movq %%mm3, 24(%1)   ;\n"
  12.478 -	"       pxor 32(%4), %%mm4   ;\n"
  12.479 -	"       pxor 40(%3), %%mm5   ;\n"
  12.480 -	"       movq 48(%1), %%mm6   ;\n"
  12.481 -	"       movq 56(%1), %%mm7   ;\n"
  12.482 -	"       pxor 32(%5), %%mm4   ;\n"
  12.483 -	"       pxor 40(%4), %%mm5   ;\n"
  12.484 -	"       pxor 48(%2), %%mm6   ;\n"
  12.485 -	"       pxor 56(%2), %%mm7   ;\n"
  12.486 -	"       movq %%mm4, 32(%1)   ;\n"
  12.487 -	"       pxor 48(%3), %%mm6   ;\n"
  12.488 -	"       pxor 56(%3), %%mm7   ;\n"
  12.489 -	"       pxor 40(%5), %%mm5   ;\n"
  12.490 -	"       pxor 48(%4), %%mm6   ;\n"
  12.491 -	"       pxor 56(%4), %%mm7   ;\n"
  12.492 -	"       movq %%mm5, 40(%1)   ;\n"
  12.493 -	"       pxor 48(%5), %%mm6   ;\n"
  12.494 -	"       pxor 56(%5), %%mm7   ;\n"
  12.495 -	"       movq %%mm6, 48(%1)   ;\n"
  12.496 -	"       movq %%mm7, 56(%1)   ;\n"
  12.497 -      
  12.498 -	"       addl $64, %1         ;\n"
  12.499 -	"       addl $64, %2         ;\n"
  12.500 -	"       addl $64, %3         ;\n"
  12.501 -	"       addl $64, %4         ;\n"
  12.502 -	"       addl $64, %5         ;\n"
  12.503 -	"       decl %0              ;\n"
  12.504 -	"       jnz 1b               ;\n"
  12.505 -	: "+r" (lines),
  12.506 -	  "+r" (p1), "+r" (p2), "+r" (p3)
  12.507 -	: "r" (p4), "r" (p5)
  12.508 -	: "memory");
  12.509 -
  12.510 -	/* p4 and p5 were modified, and now the variables are dead.
  12.511 -	   Clobber them just to be sure nobody does something stupid
  12.512 -	   like assuming they have some legal value.  */
  12.513 -	__asm__ ("" : "=r" (p4), "=r" (p5));
  12.514 -
  12.515 -	kernel_fpu_end();
  12.516 -}
  12.517 -
  12.518 -static struct xor_block_template xor_block_pII_mmx = {
  12.519 -	.name = "pII_mmx",
  12.520 -	.do_2 = xor_pII_mmx_2,
  12.521 -	.do_3 = xor_pII_mmx_3,
  12.522 -	.do_4 = xor_pII_mmx_4,
  12.523 -	.do_5 = xor_pII_mmx_5,
  12.524 -};
  12.525 -
  12.526 -static struct xor_block_template xor_block_p5_mmx = {
  12.527 -	.name = "p5_mmx",
  12.528 -	.do_2 = xor_p5_mmx_2,
  12.529 -	.do_3 = xor_p5_mmx_3,
  12.530 -	.do_4 = xor_p5_mmx_4,
  12.531 -	.do_5 = xor_p5_mmx_5,
  12.532 -};
  12.533 -
  12.534 -/*
  12.535 - * Cache avoiding checksumming functions utilizing KNI instructions
  12.536 - * Copyright (C) 1999 Zach Brown (with obvious credit due Ingo)
  12.537 - */
  12.538 -
  12.539 -#define XMMS_SAVE do {				\
  12.540 -	preempt_disable();			\
  12.541 -	if (!(current_thread_info()->status & TS_USEDFPU))	\
  12.542 -		clts();				\
  12.543 -	__asm__ __volatile__ ( 			\
  12.544 -		"movups %%xmm0,(%1)	;\n\t"	\
  12.545 -		"movups %%xmm1,0x10(%1)	;\n\t"	\
  12.546 -		"movups %%xmm2,0x20(%1)	;\n\t"	\
  12.547 -		"movups %%xmm3,0x30(%1)	;\n\t"	\
  12.548 -		: "=&r" (cr0)			\
  12.549 -		: "r" (xmm_save) 		\
  12.550 -		: "memory");			\
  12.551 -} while(0)
  12.552 -
  12.553 -#define XMMS_RESTORE do {			\
  12.554 -	__asm__ __volatile__ ( 			\
  12.555 -		"sfence			;\n\t"	\
  12.556 -		"movups (%1),%%xmm0	;\n\t"	\
  12.557 -		"movups 0x10(%1),%%xmm1	;\n\t"	\
  12.558 -		"movups 0x20(%1),%%xmm2	;\n\t"	\
  12.559 -		"movups 0x30(%1),%%xmm3	;\n\t"	\
  12.560 -		:				\
  12.561 -		: "r" (cr0), "r" (xmm_save)	\
  12.562 -		: "memory");			\
  12.563 -	if (!(current_thread_info()->status & TS_USEDFPU))	\
  12.564 -		stts();				\
  12.565 -	preempt_enable();			\
  12.566 -} while(0)
  12.567 -
  12.568 -#define ALIGN16 __attribute__((aligned(16)))
  12.569 -
  12.570 -#define OFFS(x)		"16*("#x")"
  12.571 -#define PF_OFFS(x)	"256+16*("#x")"
  12.572 -#define	PF0(x)		"	prefetchnta "PF_OFFS(x)"(%1)		;\n"
  12.573 -#define LD(x,y)		"       movaps   "OFFS(x)"(%1), %%xmm"#y"	;\n"
  12.574 -#define ST(x,y)		"       movaps %%xmm"#y",   "OFFS(x)"(%1)	;\n"
  12.575 -#define PF1(x)		"	prefetchnta "PF_OFFS(x)"(%2)		;\n"
  12.576 -#define PF2(x)		"	prefetchnta "PF_OFFS(x)"(%3)		;\n"
  12.577 -#define PF3(x)		"	prefetchnta "PF_OFFS(x)"(%4)		;\n"
  12.578 -#define PF4(x)		"	prefetchnta "PF_OFFS(x)"(%5)		;\n"
  12.579 -#define PF5(x)		"	prefetchnta "PF_OFFS(x)"(%6)		;\n"
  12.580 -#define XO1(x,y)	"       xorps   "OFFS(x)"(%2), %%xmm"#y"	;\n"
  12.581 -#define XO2(x,y)	"       xorps   "OFFS(x)"(%3), %%xmm"#y"	;\n"
  12.582 -#define XO3(x,y)	"       xorps   "OFFS(x)"(%4), %%xmm"#y"	;\n"
  12.583 -#define XO4(x,y)	"       xorps   "OFFS(x)"(%5), %%xmm"#y"	;\n"
  12.584 -#define XO5(x,y)	"       xorps   "OFFS(x)"(%6), %%xmm"#y"	;\n"
  12.585 -
  12.586 -
  12.587 -static void
  12.588 -xor_sse_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  12.589 -{
  12.590 -        unsigned long lines = bytes >> 8;
  12.591 -	char xmm_save[16*4] ALIGN16;
  12.592 -	int cr0;
  12.593 -
  12.594 -	XMMS_SAVE;
  12.595 -
  12.596 -        __asm__ __volatile__ (
  12.597 -#undef BLOCK
  12.598 -#define BLOCK(i) \
  12.599 -		LD(i,0)					\
  12.600 -			LD(i+1,1)			\
  12.601 -		PF1(i)					\
  12.602 -				PF1(i+2)		\
  12.603 -				LD(i+2,2)		\
  12.604 -					LD(i+3,3)	\
  12.605 -		PF0(i+4)				\
  12.606 -				PF0(i+6)		\
  12.607 -		XO1(i,0)				\
  12.608 -			XO1(i+1,1)			\
  12.609 -				XO1(i+2,2)		\
  12.610 -					XO1(i+3,3)	\
  12.611 -		ST(i,0)					\
  12.612 -			ST(i+1,1)			\
  12.613 -				ST(i+2,2)		\
  12.614 -					ST(i+3,3)	\
  12.615 -
  12.616 -
  12.617 -		PF0(0)
  12.618 -				PF0(2)
  12.619 -
  12.620 -	" .align 32			;\n"
  12.621 -        " 1:                            ;\n"
  12.622 -
  12.623 -		BLOCK(0)
  12.624 -		BLOCK(4)
  12.625 -		BLOCK(8)
  12.626 -		BLOCK(12)
  12.627 -
  12.628 -        "       addl $256, %1           ;\n"
  12.629 -        "       addl $256, %2           ;\n"
  12.630 -        "       decl %0                 ;\n"
  12.631 -        "       jnz 1b                  ;\n"
  12.632 -	: "+r" (lines),
  12.633 -	  "+r" (p1), "+r" (p2)
  12.634 -	:
  12.635 -        : "memory");
  12.636 -
  12.637 -	XMMS_RESTORE;
  12.638 -}
  12.639 -
  12.640 -static void
  12.641 -xor_sse_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.642 -	  unsigned long *p3)
  12.643 -{
  12.644 -        unsigned long lines = bytes >> 8;
  12.645 -	char xmm_save[16*4] ALIGN16;
  12.646 -	int cr0;
  12.647 -
  12.648 -	XMMS_SAVE;
  12.649 -
  12.650 -        __asm__ __volatile__ (
  12.651 -#undef BLOCK
  12.652 -#define BLOCK(i) \
  12.653 -		PF1(i)					\
  12.654 -				PF1(i+2)		\
  12.655 -		LD(i,0)					\
  12.656 -			LD(i+1,1)			\
  12.657 -				LD(i+2,2)		\
  12.658 -					LD(i+3,3)	\
  12.659 -		PF2(i)					\
  12.660 -				PF2(i+2)		\
  12.661 -		PF0(i+4)				\
  12.662 -				PF0(i+6)		\
  12.663 -		XO1(i,0)				\
  12.664 -			XO1(i+1,1)			\
  12.665 -				XO1(i+2,2)		\
  12.666 -					XO1(i+3,3)	\
  12.667 -		XO2(i,0)				\
  12.668 -			XO2(i+1,1)			\
  12.669 -				XO2(i+2,2)		\
  12.670 -					XO2(i+3,3)	\
  12.671 -		ST(i,0)					\
  12.672 -			ST(i+1,1)			\
  12.673 -				ST(i+2,2)		\
  12.674 -					ST(i+3,3)	\
  12.675 -
  12.676 -
  12.677 -		PF0(0)
  12.678 -				PF0(2)
  12.679 -
  12.680 -	" .align 32			;\n"
  12.681 -        " 1:                            ;\n"
  12.682 -
  12.683 -		BLOCK(0)
  12.684 -		BLOCK(4)
  12.685 -		BLOCK(8)
  12.686 -		BLOCK(12)
  12.687 -
  12.688 -        "       addl $256, %1           ;\n"
  12.689 -        "       addl $256, %2           ;\n"
  12.690 -        "       addl $256, %3           ;\n"
  12.691 -        "       decl %0                 ;\n"
  12.692 -        "       jnz 1b                  ;\n"
  12.693 -	: "+r" (lines),
  12.694 -	  "+r" (p1), "+r"(p2), "+r"(p3)
  12.695 -	:
  12.696 -        : "memory" );
  12.697 -
  12.698 -	XMMS_RESTORE;
  12.699 -}
  12.700 -
  12.701 -static void
  12.702 -xor_sse_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.703 -	  unsigned long *p3, unsigned long *p4)
  12.704 -{
  12.705 -        unsigned long lines = bytes >> 8;
  12.706 -	char xmm_save[16*4] ALIGN16;
  12.707 -	int cr0;
  12.708 -
  12.709 -	XMMS_SAVE;
  12.710 -
  12.711 -        __asm__ __volatile__ (
  12.712 -#undef BLOCK
  12.713 -#define BLOCK(i) \
  12.714 -		PF1(i)					\
  12.715 -				PF1(i+2)		\
  12.716 -		LD(i,0)					\
  12.717 -			LD(i+1,1)			\
  12.718 -				LD(i+2,2)		\
  12.719 -					LD(i+3,3)	\
  12.720 -		PF2(i)					\
  12.721 -				PF2(i+2)		\
  12.722 -		XO1(i,0)				\
  12.723 -			XO1(i+1,1)			\
  12.724 -				XO1(i+2,2)		\
  12.725 -					XO1(i+3,3)	\
  12.726 -		PF3(i)					\
  12.727 -				PF3(i+2)		\
  12.728 -		PF0(i+4)				\
  12.729 -				PF0(i+6)		\
  12.730 -		XO2(i,0)				\
  12.731 -			XO2(i+1,1)			\
  12.732 -				XO2(i+2,2)		\
  12.733 -					XO2(i+3,3)	\
  12.734 -		XO3(i,0)				\
  12.735 -			XO3(i+1,1)			\
  12.736 -				XO3(i+2,2)		\
  12.737 -					XO3(i+3,3)	\
  12.738 -		ST(i,0)					\
  12.739 -			ST(i+1,1)			\
  12.740 -				ST(i+2,2)		\
  12.741 -					ST(i+3,3)	\
  12.742 -
  12.743 -
  12.744 -		PF0(0)
  12.745 -				PF0(2)
  12.746 -
  12.747 -	" .align 32			;\n"
  12.748 -        " 1:                            ;\n"
  12.749 -
  12.750 -		BLOCK(0)
  12.751 -		BLOCK(4)
  12.752 -		BLOCK(8)
  12.753 -		BLOCK(12)
  12.754 -
  12.755 -        "       addl $256, %1           ;\n"
  12.756 -        "       addl $256, %2           ;\n"
  12.757 -        "       addl $256, %3           ;\n"
  12.758 -        "       addl $256, %4           ;\n"
  12.759 -        "       decl %0                 ;\n"
  12.760 -        "       jnz 1b                  ;\n"
  12.761 -	: "+r" (lines),
  12.762 -	  "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
  12.763 -	:
  12.764 -        : "memory" );
  12.765 -
  12.766 -	XMMS_RESTORE;
  12.767 -}
  12.768 -
  12.769 -static void
  12.770 -xor_sse_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  12.771 -	  unsigned long *p3, unsigned long *p4, unsigned long *p5)
  12.772 -{
  12.773 -        unsigned long lines = bytes >> 8;
  12.774 -	char xmm_save[16*4] ALIGN16;
  12.775 -	int cr0;
  12.776 -
  12.777 -	XMMS_SAVE;
  12.778 -
  12.779 -	/* Make sure GCC forgets anything it knows about p4 or p5,
  12.780 -	   such that it won't pass to the asm volatile below a
  12.781 -	   register that is shared with any other variable.  That's
  12.782 -	   because we modify p4 and p5 there, but we can't mark them
  12.783 -	   as read/write, otherwise we'd overflow the 10-asm-operands
  12.784 -	   limit of GCC < 3.1.  */
  12.785 -	__asm__ ("" : "+r" (p4), "+r" (p5));
  12.786 -
  12.787 -        __asm__ __volatile__ (
  12.788 -#undef BLOCK
  12.789 -#define BLOCK(i) \
  12.790 -		PF1(i)					\
  12.791 -				PF1(i+2)		\
  12.792 -		LD(i,0)					\
  12.793 -			LD(i+1,1)			\
  12.794 -				LD(i+2,2)		\
  12.795 -					LD(i+3,3)	\
  12.796 -		PF2(i)					\
  12.797 -				PF2(i+2)		\
  12.798 -		XO1(i,0)				\
  12.799 -			XO1(i+1,1)			\
  12.800 -				XO1(i+2,2)		\
  12.801 -					XO1(i+3,3)	\
  12.802 -		PF3(i)					\
  12.803 -				PF3(i+2)		\
  12.804 -		XO2(i,0)				\
  12.805 -			XO2(i+1,1)			\
  12.806 -				XO2(i+2,2)		\
  12.807 -					XO2(i+3,3)	\
  12.808 -		PF4(i)					\
  12.809 -				PF4(i+2)		\
  12.810 -		PF0(i+4)				\
  12.811 -				PF0(i+6)		\
  12.812 -		XO3(i,0)				\
  12.813 -			XO3(i+1,1)			\
  12.814 -				XO3(i+2,2)		\
  12.815 -					XO3(i+3,3)	\
  12.816 -		XO4(i,0)				\
  12.817 -			XO4(i+1,1)			\
  12.818 -				XO4(i+2,2)		\
  12.819 -					XO4(i+3,3)	\
  12.820 -		ST(i,0)					\
  12.821 -			ST(i+1,1)			\
  12.822 -				ST(i+2,2)		\
  12.823 -					ST(i+3,3)	\
  12.824 -
  12.825 -
  12.826 -		PF0(0)
  12.827 -				PF0(2)
  12.828 -
  12.829 -	" .align 32			;\n"
  12.830 -        " 1:                            ;\n"
  12.831 -
  12.832 -		BLOCK(0)
  12.833 -		BLOCK(4)
  12.834 -		BLOCK(8)
  12.835 -		BLOCK(12)
  12.836 -
  12.837 -        "       addl $256, %1           ;\n"
  12.838 -        "       addl $256, %2           ;\n"
  12.839 -        "       addl $256, %3           ;\n"
  12.840 -        "       addl $256, %4           ;\n"
  12.841 -        "       addl $256, %5           ;\n"
  12.842 -        "       decl %0                 ;\n"
  12.843 -        "       jnz 1b                  ;\n"
  12.844 -	: "+r" (lines),
  12.845 -	  "+r" (p1), "+r" (p2), "+r" (p3)
  12.846 -	: "r" (p4), "r" (p5)
  12.847 -	: "memory");
  12.848 -
  12.849 -	/* p4 and p5 were modified, and now the variables are dead.
  12.850 -	   Clobber them just to be sure nobody does something stupid
  12.851 -	   like assuming they have some legal value.  */
  12.852 -	__asm__ ("" : "=r" (p4), "=r" (p5));
  12.853 -
  12.854 -	XMMS_RESTORE;
  12.855 -}
  12.856 -
  12.857 -static struct xor_block_template xor_block_pIII_sse = {
  12.858 -        .name = "pIII_sse",
  12.859 -        .do_2 =  xor_sse_2,
  12.860 -        .do_3 =  xor_sse_3,
  12.861 -        .do_4 =  xor_sse_4,
  12.862 -        .do_5 = xor_sse_5,
  12.863 -};
  12.864 -
  12.865 -/* Also try the generic routines.  */
  12.866 -#include <asm-generic/xor.h>
  12.867 -
  12.868 -#undef XOR_TRY_TEMPLATES
  12.869 -#define XOR_TRY_TEMPLATES				\
  12.870 -	do {						\
  12.871 -		xor_speed(&xor_block_8regs);		\
  12.872 -		xor_speed(&xor_block_8regs_p);		\
  12.873 -		xor_speed(&xor_block_32regs);		\
  12.874 -		xor_speed(&xor_block_32regs_p);		\
  12.875 -	        if (cpu_has_xmm)			\
  12.876 -			xor_speed(&xor_block_pIII_sse);	\
  12.877 -	        if (cpu_has_mmx) {			\
  12.878 -	                xor_speed(&xor_block_pII_mmx);	\
  12.879 -	                xor_speed(&xor_block_p5_mmx);	\
  12.880 -	        }					\
  12.881 -	} while (0)
  12.882 -
  12.883 -/* We force the use of the SSE xor block because it can write around L2.
  12.884 -   We may also be able to load into the L1 only depending on how the cpu
  12.885 -   deals with a load to a line that is being prefetched.  */
  12.886 -#define XOR_SELECT_TEMPLATE(FASTEST) \
  12.887 -	(cpu_has_xmm ? &xor_block_pIII_sse : FASTEST)
    13.1 --- a/linux-2.6.10-xen-sparse/include/asm-xen/hypervisor.h	Fri Feb 25 17:27:21 2005 +0000
    13.2 +++ b/linux-2.6.10-xen-sparse/include/asm-xen/hypervisor.h	Fri Feb 25 17:27:55 2005 +0000
    13.3 @@ -212,12 +212,16 @@ HYPERVISOR_set_callbacks(
    13.4  
    13.5  static inline int
    13.6  HYPERVISOR_fpu_taskswitch(
    13.7 -    void)
    13.8 +    int set)
    13.9  {
   13.10      int ret;
   13.11 +    unsigned long ign;
   13.12 +
   13.13      __asm__ __volatile__ (
   13.14          TRAP_INSTR
   13.15 -        : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
   13.16 +        : "=a" (ret), "=b" (ign)
   13.17 +        : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
   13.18 +        : "memory" );
   13.19  
   13.20      return ret;
   13.21  }
    14.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/i386/machdep.c	Fri Feb 25 17:27:21 2005 +0000
    14.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/i386/machdep.c	Fri Feb 25 17:27:55 2005 +0000
    14.3 @@ -412,7 +412,7 @@ i386_proc0_tss_ldt_init()
    14.4  	ltr(lwp0.l_md.md_tss_sel);
    14.5  	lldt(pcb->pcb_ldt_sel);
    14.6  #else
    14.7 -	HYPERVISOR_fpu_taskswitch();
    14.8 +	HYPERVISOR_fpu_taskswitch(1);
    14.9  	XENPRINTF(("lwp tss sp %p ss %04x/%04x\n",
   14.10  		      (void *)pcb->pcb_tss.tss_esp0,
   14.11  		      pcb->pcb_tss.tss_ss0, IDXSEL(pcb->pcb_tss.tss_ss0)));
   14.12 @@ -455,7 +455,7 @@ i386_switch_context(struct pcb *new)
   14.13  
   14.14  	ci = curcpu();
   14.15  	if (ci->ci_fpused) {
   14.16 -		HYPERVISOR_fpu_taskswitch();
   14.17 +		HYPERVISOR_fpu_taskswitch(1);
   14.18  		ci->ci_fpused = 0;
   14.19  	}
   14.20  
    15.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h	Fri Feb 25 17:27:21 2005 +0000
    15.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/include/hypervisor.h	Fri Feb 25 17:27:55 2005 +0000
    15.3 @@ -180,12 +180,16 @@ HYPERVISOR_set_callbacks(
    15.4  }
    15.5  
    15.6  static inline int
    15.7 -HYPERVISOR_fpu_taskswitch(void)
    15.8 +HYPERVISOR_fpu_taskswitch(int set)
    15.9  {
   15.10      int ret;
   15.11 +    unsigned long ign;
   15.12 +
   15.13      __asm__ __volatile__ (
   15.14          TRAP_INSTR
   15.15 -        : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) : "memory" );
   15.16 +        : "=a" (ret), "=b" (ign)
   15.17 +        : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
   15.18 +        : "memory" );
   15.19  
   15.20      return ret;
   15.21  }
    16.1 --- a/tools/Makefile	Fri Feb 25 17:27:21 2005 +0000
    16.2 +++ b/tools/Makefile	Fri Feb 25 17:27:55 2005 +0000
    16.3 @@ -25,6 +25,7 @@ install:
    16.4  	$(MAKE) -C ioemu install
    16.5  
    16.6  clean:
    16.7 +	$(MAKE) -C check clean
    16.8  	$(MAKE) -C libxutil clean
    16.9  	$(MAKE) -C libxc clean
   16.10  	$(MAKE) -C misc clean
    17.1 --- a/tools/Rules.mk	Fri Feb 25 17:27:21 2005 +0000
    17.2 +++ b/tools/Rules.mk	Fri Feb 25 17:27:55 2005 +0000
    17.3 @@ -4,6 +4,9 @@ XEN_XC             = $(XEN_ROOT)/tools/p
    17.4  XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
    17.5  XEN_LIBXUTIL       = $(XEN_ROOT)/tools/libxutil
    17.6  
    17.7 +COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
    17.8 +TARGET_ARCH     ?= $(COMPILE_ARCH)
    17.9 +
   17.10  ifeq ($(TARGET_ARCH),x86_32)
   17.11  CFLAGS  += -m32 -march=i686
   17.12  LDFLAGS += -m elf_i386
   17.13 @@ -13,3 +16,9 @@ ifeq ($(TARGET_ARCH),x86_64)
   17.14  CFLAGS  += -m64
   17.15  LDFLAGS += -m elf_x86_64
   17.16  endif
   17.17 +
   17.18 +%.opic: %.c
   17.19 +	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
   17.20 +
   17.21 +%.o: %.c
   17.22 +	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
    18.1 --- a/tools/examples/xmexample.vmx	Fri Feb 25 17:27:21 2005 +0000
    18.2 +++ b/tools/examples/xmexample.vmx	Fri Feb 25 17:27:55 2005 +0000
    18.3 @@ -75,7 +75,7 @@ root = "/dev/hda1 ro"
    18.4  #nfs_root   = '/full/path/to/root/directory'
    18.5  
    18.6  # Sets runlevel 4.
    18.7 -extra = "1"
    18.8 +extra = "acpi=off 1"
    18.9  
   18.10  #----------------------------------------------------------------------------
   18.11  # Set according to whether you want the domain restarted when it exits.
    19.1 --- a/tools/ioemu/gui/Makefile	Fri Feb 25 17:27:21 2005 +0000
    19.2 +++ b/tools/ioemu/gui/Makefile	Fri Feb 25 17:27:55 2005 +0000
    19.3 @@ -1,6 +1,6 @@
    19.4  TOPDIR= ..
    19.5  CXXFLAGS=-I. -I../include -I..
    19.6 -OBJS= gui.o keymap.o siminterface.o textconfig.o x.o
    19.7 +OBJS= gui.o keymap.o siminterface.o textconfig.o x.o rfb.o term.o
    19.8  
    19.9  all: libgui.a
   19.10  
    20.1 --- a/tools/ioemu/include/config.h	Fri Feb 25 17:27:21 2005 +0000
    20.2 +++ b/tools/ioemu/include/config.h	Fri Feb 25 17:27:55 2005 +0000
    20.3 @@ -388,8 +388,8 @@
    20.4  #define BX_WITH_MACOS 0
    20.5  #define BX_WITH_CARBON 0
    20.6  #define BX_WITH_NOGUI 0
    20.7 -#define BX_WITH_TERM 0
    20.8 -#define BX_WITH_RFB 0
    20.9 +#define BX_WITH_TERM 1
   20.10 +#define BX_WITH_RFB 1
   20.11  #define BX_WITH_AMIGAOS 0
   20.12  #define BX_WITH_SDL 0
   20.13  #define BX_WITH_SVGA 0
    21.1 --- a/tools/ioemu/iodev/Makefile	Fri Feb 25 17:27:21 2005 +0000
    21.2 +++ b/tools/ioemu/iodev/Makefile	Fri Feb 25 17:27:55 2005 +0000
    21.3 @@ -2,7 +2,7 @@ TOPDIR= ..
    21.4  CXXFLAGS=-I. -I../include -I..
    21.5  OBJS=$(patsubst %.cc,%.o,$(wildcard *.cc))
    21.6  BXLIBS = ../gui/libgui.a ../memory/libmemory.a  
    21.7 -LDLIBS= $(BXLIBS) -L/usr/X11R6/lib -lX11 -lXpm -lstdc++ -L ../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil
    21.8 +LDLIBS= $(BXLIBS) -L/usr/X11R6/lib -lX11 -lXpm -lstdc++ -L ../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil -lpthread -lncurses
    21.9  
   21.10  all: device-model
   21.11  
    22.1 --- a/tools/ioemu/iodev/main.cc	Fri Feb 25 17:27:21 2005 +0000
    22.2 +++ b/tools/ioemu/iodev/main.cc	Fri Feb 25 17:27:55 2005 +0000
    22.3 @@ -1964,6 +1964,10 @@ bx_bool load_and_init_display_lib () {
    22.4    if (!strcmp (gui_name, "x")) 
    22.5      PLUG_load_plugin (x, PLUGTYPE_OPTIONAL);
    22.6  #endif
    22.7 +#if BX_WITH_TERM
    22.8 +  if (!strcmp (gui_name, "term"))
    22.9 +    PLUG_load_plugin (term, PLUGTYPE_OPTIONAL);
   22.10 +#endif
   22.11  
   22.12  #if BX_GUI_SIGHANDLER
   22.13    // set the flag for guis requiring a GUI sighandler.
    23.1 --- a/tools/libxc/Makefile	Fri Feb 25 17:27:21 2005 +0000
    23.2 +++ b/tools/libxc/Makefile	Fri Feb 25 17:27:55 2005 +0000
    23.3 @@ -1,11 +1,3 @@
    23.4 -
    23.5 -ifndef BUILD_PIC_LIBS
    23.6 -ifeq ($(wildcard /etc/debian_version),)
    23.7 -BUILD_PIC_LIBS=n
    23.8 -else
    23.9 -BUILD_PIC_LIBS=y
   23.10 -endif
   23.11 -endif
   23.12  
   23.13  INSTALL		= install
   23.14  INSTALL_PROG	= $(INSTALL) -m0755
   23.15 @@ -101,9 +93,6 @@ rpm: all
   23.16  	mv staging/i386/*.rpm .
   23.17  	rm -rf staging
   23.18  
   23.19 -$(PIC_OBJS): %.opic: %.c
   23.20 -	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
   23.21 -
   23.22  libxc.a: $(OBJS)
   23.23  	$(AR) rc $@ $^
   23.24  
   23.25 @@ -112,12 +101,7 @@ libxc.so: libxc.so.$(MAJOR)
   23.26  libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
   23.27  	ln -sf $< $@
   23.28  
   23.29 -ifeq ($(BUILD_PIC_LIBS),y)
   23.30  libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
   23.31  	$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
   23.32 -else
   23.33 -libxc.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
   23.34 -	$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
   23.35 -endif
   23.36  
   23.37  -include $(DEPS)
    24.1 --- a/tools/libxc/xc_vmx_build.c	Fri Feb 25 17:27:21 2005 +0000
    24.2 +++ b/tools/libxc/xc_vmx_build.c	Fri Feb 25 17:27:55 2005 +0000
    24.3 @@ -108,6 +108,44 @@ static void build_e820map(struct mem_map
    24.4      mem_mapp->nr_map = nr_map;
    24.5  }
    24.6  
    24.7 +static void zap_mmio_range(int xc_handle, u32 dom,
    24.8 +                            l2_pgentry_t *vl2tab,
    24.9 +                            unsigned long mmio_range_start,
   24.10 +                            unsigned long mmio_range_size)
   24.11 +{
   24.12 +    unsigned long mmio_addr;
   24.13 +    unsigned long mmio_range_end = mmio_range_start + mmio_range_size;
   24.14 +    unsigned long vl2e;
   24.15 +    l1_pgentry_t *vl1tab;
   24.16 +
   24.17 +    mmio_addr = mmio_range_start & PAGE_MASK;
   24.18 +    for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) {
   24.19 +        vl2e = vl2tab[l2_table_offset(mmio_addr)];
   24.20 +        vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
   24.21 +                                PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT);
   24.22 +        vl1tab[l1_table_offset(mmio_addr)] = 0;
   24.23 +        munmap(vl1tab, PAGE_SIZE);
   24.24 +    }
   24.25 +}
   24.26 +
   24.27 +static void zap_mmio_ranges(int xc_handle, u32 dom,
   24.28 +                            unsigned long l2tab,
   24.29 +                            struct mem_map *mem_mapp)
   24.30 +{
   24.31 +    int i;
   24.32 +    l2_pgentry_t *vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
   24.33 +                                                PROT_READ|PROT_WRITE,
   24.34 +                                                l2tab >> PAGE_SHIFT);
   24.35 +    for (i = 0; i < mem_mapp->nr_map; i++) {
   24.36 +        if ((mem_mapp->map[i].type == E820_IO)
   24.37 +          && (mem_mapp->map[i].caching_attr == MEMMAP_UC))
   24.38 +            zap_mmio_range(xc_handle, dom,
   24.39 +                            vl2tab, mem_mapp->map[i].addr,
   24.40 +                            mem_mapp->map[i].size);
   24.41 +    }
   24.42 +    munmap(vl2tab, PAGE_SIZE);
   24.43 +}
   24.44 +
   24.45  static int setup_guest(int xc_handle,
   24.46                           u32 dom, int memsize,
   24.47                           char *image, unsigned long image_size,
   24.48 @@ -355,6 +393,7 @@ static int setup_guest(int xc_handle,
   24.49  
   24.50      /* memsize is in megabytes */
   24.51      build_e820map(mem_mapp, memsize << 20);
   24.52 +    zap_mmio_ranges(xc_handle, dom, l2tab, mem_mapp);
   24.53      boot_paramsp->e820_map_nr = mem_mapp->nr_map;
   24.54      for (i=0; i<mem_mapp->nr_map; i++) {
   24.55          boot_paramsp->e820_map[i].addr = mem_mapp->map[i].addr; 
    25.1 --- a/tools/libxutil/Makefile	Fri Feb 25 17:27:21 2005 +0000
    25.2 +++ b/tools/libxutil/Makefile	Fri Feb 25 17:27:55 2005 +0000
    25.3 @@ -1,11 +1,3 @@
    25.4 -
    25.5 -ifndef BUILD_PIC_LIBS
    25.6 -ifeq ($(wildcard /etc/debian_version),)
    25.7 -BUILD_PIC_LIBS=n
    25.8 -else
    25.9 -BUILD_PIC_LIBS=y
   25.10 -endif
   25.11 -endif
   25.12  
   25.13  XEN_ROOT = ../..
   25.14  INSTALL		= install
   25.15 @@ -51,22 +43,14 @@ LIB      += libxutil.a
   25.16  all: check-for-zlib
   25.17  	$(MAKE) $(LIB)
   25.18  
   25.19 -$(PIC_OBJS): %.opic: %.c
   25.20 -	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
   25.21 -
   25.22  libxutil.so: libxutil.so.$(MAJOR)
   25.23  	ln -sf $^ $@
   25.24  
   25.25  libxutil.so.$(MAJOR): libxutil.so.$(MAJOR).$(MINOR)
   25.26  	ln -sf $^ $@
   25.27  
   25.28 -ifeq ($(BUILD_PIC_LIBS),y)
   25.29  libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
   25.30  	$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
   25.31 -else
   25.32 -libxutil.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
   25.33 -	$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
   25.34 -endif
   25.35  
   25.36  libxutil.a: $(LIB_OBJS)
   25.37  	$(AR) rc $@ $^
    26.1 --- a/tools/misc/miniterm/Makefile	Fri Feb 25 17:27:21 2005 +0000
    26.2 +++ b/tools/misc/miniterm/Makefile	Fri Feb 25 17:27:55 2005 +0000
    26.3 @@ -14,3 +14,6 @@ install: all
    26.4  
    26.5  clean:
    26.6  	$(RM) *.o $(TARGET) *~
    26.7 +
    26.8 +$(TARGET): $(TARGET).c
    26.9 +	$(CC) $(CFLAGS) -o $@ $<
    27.1 --- a/tools/xcs/Makefile	Fri Feb 25 17:27:21 2005 +0000
    27.2 +++ b/tools/xcs/Makefile	Fri Feb 25 17:27:55 2005 +0000
    27.3 @@ -31,7 +31,7 @@ BIN      = xcs
    27.4  all: $(BIN) xcsdump
    27.5  
    27.6  clean:
    27.7 -	$(RM) *.a *.so *.o *.rpm $(BIN) ctrl_dump
    27.8 +	$(RM) *.a *.so *.o *.rpm $(BIN) xcsdump
    27.9  
   27.10  xcsdump: xcsdump.c
   27.11  	$(CC) $(CFLAGS) -o xcsdump xcsdump.c -L$(XEN_LIBXC) -L$(XEN_LIBXUTIL) \
    28.1 --- a/tools/xfrd/xfrd.c	Fri Feb 25 17:27:21 2005 +0000
    28.2 +++ b/tools/xfrd/xfrd.c	Fri Feb 25 17:27:55 2005 +0000
    28.3 @@ -49,8 +49,7 @@
    28.4  #include "select.h"
    28.5  
    28.6  #define MODULE_NAME "XFRD"
    28.7 -#define DEBUG 1
    28.8 -#undef DEBUG
    28.9 +
   28.10  #include "debug.h"
   28.11  
   28.12  /*
    29.1 --- a/xen/Makefile	Fri Feb 25 17:27:21 2005 +0000
    29.2 +++ b/xen/Makefile	Fri Feb 25 17:27:55 2005 +0000
    29.3 @@ -37,12 +37,12 @@ install: $(TARGET).gz
    29.4  	$(INSTALL_DATA) include/public/io/*.h $(DESTDIR)/usr/include/xen/io
    29.5  	$(INSTALL_DATA) include/public/COPYING $(DESTDIR)/usr/include/xen
    29.6  
    29.7 -clean:
    29.8 +clean: delete-unfresh-files
    29.9  	$(MAKE) -C tools clean
   29.10  	$(MAKE) -C common clean
   29.11  	$(MAKE) -C drivers clean
   29.12  	$(MAKE) -C arch/$(TARGET_ARCH) clean
   29.13 -	rm -f include/asm *.o $(TARGET)* *~ core include/xen/compile.h
   29.14 +	rm -f include/asm *.o $(TARGET)* *~ core
   29.15  	rm -f include/asm-*/asm-offsets.h
   29.16  	rm -f tools/figlet/*.o tools/figlet/figlet
   29.17  
    30.1 --- a/xen/arch/ia64/dom_fw.c	Fri Feb 25 17:27:21 2005 +0000
    30.2 +++ b/xen/arch/ia64/dom_fw.c	Fri Feb 25 17:27:55 2005 +0000
    30.3 @@ -319,12 +319,12 @@ dom_fw_init (struct domain *d, char *arg
    30.4  	unsigned long maxmem = d->max_pages * PAGE_SIZE;
    30.5  	unsigned long start_mpaddr = ((d==dom0)?dom0_start:0);
    30.6  
    30.7 -#	define MAKE_MD(typ, attr, start, end)		\
    30.8 +#	define MAKE_MD(typ, attr, start, end, abs) 	\	
    30.9  	do {						\
   30.10  		md = efi_memmap + i++;			\
   30.11  		md->type = typ;				\
   30.12  		md->pad = 0;				\
   30.13 -		md->phys_addr = start_mpaddr + start;	\
   30.14 +		md->phys_addr = abs ? start : start_mpaddr + start;	\
   30.15  		md->virt_addr = 0;			\
   30.16  		md->num_pages = (end - start) >> 12;	\
   30.17  		md->attribute = attr;			\
   30.18 @@ -472,27 +472,27 @@ dom_fw_init (struct domain *d, char *arg
   30.19  
   30.20  	/* simulate 1MB free memory at physical address zero */
   30.21  	i = 0;
   30.22 -	MAKE_MD(EFI_BOOT_SERVICES_DATA,EFI_MEMORY_WB,0*MB,1*MB);
   30.23 +	MAKE_MD(EFI_BOOT_SERVICES_DATA,EFI_MEMORY_WB,0*MB,1*MB, 0);
   30.24  	/* hypercall patches live here, masquerade as reserved PAL memory */
   30.25 -	MAKE_MD(EFI_PAL_CODE,EFI_MEMORY_WB,HYPERCALL_START,HYPERCALL_END);
   30.26 -	MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem);
   30.27 +	MAKE_MD(EFI_PAL_CODE,EFI_MEMORY_WB,HYPERCALL_START,HYPERCALL_END, 0);
   30.28 +	MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem, 0);
   30.29  #ifdef PASS_THRU_IOPORT_SPACE
   30.30  	if (d == dom0 && !running_on_sim) {
   30.31  		/* pass through the I/O port space */
   30.32 -		efi_memory_desc_t efi_get_io_md(void);
   30.33 -		efi_memory_desc_t ia64_efi_io_md = efi_get_io_md();
   30.34 +		efi_memory_desc_t *efi_get_io_md(void);
   30.35 +		efi_memory_desc_t *ia64_efi_io_md = efi_get_io_md();
   30.36  		u32 type;
   30.37  		u64 iostart, ioend, ioattr;
   30.38  		
   30.39 -		type = ia64_efi_io_md.type;
   30.40 -		iostart = ia64_efi_io_md.phys_addr;
   30.41 -		ioend = ia64_efi_io_md.phys_addr +
   30.42 -			(ia64_efi_io_md.num_pages << 12);
   30.43 -		ioattr = ia64_efi_io_md.attribute;
   30.44 -		MAKE_MD(type,ioattr,iostart,ioend);
   30.45 +		type = ia64_efi_io_md->type;
   30.46 +		iostart = ia64_efi_io_md->phys_addr;
   30.47 +		ioend = ia64_efi_io_md->phys_addr +
   30.48 +			(ia64_efi_io_md->num_pages << 12);
   30.49 +		ioattr = ia64_efi_io_md->attribute;
   30.50 +		MAKE_MD(type,ioattr,iostart,ioend, 1);
   30.51  	}
   30.52  	else
   30.53 -		MAKE_MD(EFI_RESERVED_TYPE,0,0,0);
   30.54 +		MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0);
   30.55  #endif
   30.56  
   30.57  	bp->efi_systab = dom_pa(fw_mem);
    31.1 --- a/xen/arch/ia64/regionreg.c	Fri Feb 25 17:27:21 2005 +0000
    31.2 +++ b/xen/arch/ia64/regionreg.c	Fri Feb 25 17:27:55 2005 +0000
    31.3 @@ -325,6 +325,7 @@ if (!ed->vcpu_info) { printf("Stopping i
    31.4  	ed->vcpu_info->arch.rrs[3] = rrv.rrval;
    31.5  	ed->vcpu_info->arch.rrs[4] = rrv.rrval;
    31.6  	ed->vcpu_info->arch.rrs[5] = rrv.rrval;
    31.7 +	rrv.ve = 0; 
    31.8  	ed->vcpu_info->arch.rrs[6] = rrv.rrval;
    31.9  //	ed->shared_info->arch.rrs[7] = rrv.rrval;
   31.10  }
   31.11 @@ -367,10 +368,13 @@ unsigned long load_region_regs(struct ex
   31.12  	if (ed->vcpu_info->arch.metaphysical_mode) {
   31.13  		ia64_rr rrv;
   31.14  
   31.15 +		rrv.rrval = 0;
   31.16  		rrv.rid = ed->domain->metaphysical_rid;
   31.17  		rrv.ps = PAGE_SHIFT;
   31.18  		rrv.ve = 1;
   31.19 -		rr0 = rr1 = rr2 = rr3 = rr4 = rr5 = rr6 = newrr7 = rrv.rrval;
   31.20 +		rr0 = rr1 = rr2 = rr3 = rr4 = rr5 = newrr7 = rrv.rrval;
   31.21 +		rrv.ve = 0;
   31.22 +		rr6 = rrv.rrval;
   31.23  	}
   31.24  	else {
   31.25  		rr0 = physicalize_rid(ed, ed->vcpu_info->arch.rrs[0]);
    32.1 --- a/xen/arch/ia64/vcpu.c	Fri Feb 25 17:27:21 2005 +0000
    32.2 +++ b/xen/arch/ia64/vcpu.c	Fri Feb 25 17:27:55 2005 +0000
    32.3 @@ -1265,7 +1265,7 @@ unsigned long vcpu_get_rr_ve(VCPU *vcpu,
    32.4  	
    32.5  	ia64_rr rr;
    32.6  
    32.7 -	rr.rrval = PSCB(vcpu,rrs[vadr)>>61];
    32.8 +	rr.rrval = PSCB(vcpu,rrs)[vadr>>61];
    32.9  	return(rr.ve);
   32.10  }
   32.11  
   32.12 @@ -1275,7 +1275,7 @@ unsigned long vcpu_get_rr_ps(VCPU *vcpu,
   32.13  	
   32.14  	ia64_rr rr;
   32.15  
   32.16 -	rr.rrval = PSCB(vcpu,rrs[vadr)>>61];
   32.17 +	rr.rrval = PSCB(vcpu,rrs)[vadr>>61];
   32.18  	return(rr.ps);
   32.19  }
   32.20  
   32.21 @@ -1285,7 +1285,7 @@ unsigned long vcpu_get_rr_rid(VCPU *vcpu
   32.22  	
   32.23  	ia64_rr rr;
   32.24  
   32.25 -	rr.rrval = PSCB(vcpu,rrs[vadr)>>61];
   32.26 +	rr.rrval = PSCB(vcpu,rrs)[vadr>>61];
   32.27  	return(rr.rid);
   32.28  }
   32.29  
   32.30 @@ -1293,7 +1293,7 @@ unsigned long vcpu_get_rr_rid(VCPU *vcpu
   32.31  IA64FAULT vcpu_set_rr(VCPU *vcpu, UINT64 reg, UINT64 val)
   32.32  {
   32.33  	extern void set_one_rr(UINT64, UINT64);
   32.34 -	PSCB(vcpu,rrs[reg)>>61] = val;
   32.35 +	PSCB(vcpu,rrs)[reg>>61] = val;
   32.36  	// warning: set_one_rr() does it "live"
   32.37  	set_one_rr(reg,val);
   32.38  	return (IA64_NO_FAULT);
   32.39 @@ -1301,7 +1301,7 @@ IA64FAULT vcpu_set_rr(VCPU *vcpu, UINT64
   32.40  
   32.41  IA64FAULT vcpu_get_rr(VCPU *vcpu, UINT64 reg, UINT64 *pval)
   32.42  {
   32.43 -	UINT val = PSCB(vcpu,rrs[reg)>>61];
   32.44 +	UINT val = PSCB(vcpu,rrs)[reg>>61];
   32.45  	*pval = val;
   32.46  	return (IA64_NO_FAULT);
   32.47  }
    33.1 --- a/xen/arch/x86/boot/mkelf32.c	Fri Feb 25 17:27:21 2005 +0000
    33.2 +++ b/xen/arch/x86/boot/mkelf32.c	Fri Feb 25 17:27:55 2005 +0000
    33.3 @@ -107,6 +107,94 @@ static Elf32_Shdr out_shdr[] = {
    33.4      }
    33.5  };
    33.6  
    33.7 +#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
    33.8 +#define swap32(_v) (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
    33.9 +#define swap64(_v) (((u64)swap32((u32)(_v))<<32)|(u64)swap32((u32)((_v)>>32)))
   33.10 +
   33.11 +static int big_endian;
   33.12 +
   33.13 +static void endianadjust_ehdr32(Elf32_Ehdr *eh)
   33.14 +{
   33.15 +    if ( !big_endian )
   33.16 +        return;
   33.17 +    eh->e_type      = swap16(eh->e_type);
   33.18 +    eh->e_machine   = swap16(eh->e_machine);
   33.19 +    eh->e_version   = swap32(eh->e_version);
   33.20 +    eh->e_entry     = swap32(eh->e_entry);
   33.21 +    eh->e_phoff     = swap32(eh->e_phoff);
   33.22 +    eh->e_shoff     = swap32(eh->e_shoff);
   33.23 +    eh->e_flags     = swap32(eh->e_flags);
   33.24 +    eh->e_ehsize    = swap16(eh->e_ehsize);
   33.25 +    eh->e_phentsize = swap16(eh->e_phentsize);
   33.26 +    eh->e_phnum     = swap16(eh->e_phnum);
   33.27 +    eh->e_shentsize = swap16(eh->e_shentsize);
   33.28 +    eh->e_shnum     = swap16(eh->e_shnum);
   33.29 +    eh->e_shstrndx  = swap16(eh->e_shstrndx);
   33.30 +}
   33.31 +
   33.32 +static void endianadjust_ehdr64(Elf64_Ehdr *eh)
   33.33 +{
   33.34 +    if ( !big_endian )
   33.35 +        return;
   33.36 +    eh->e_type      = swap16(eh->e_type);
   33.37 +    eh->e_machine   = swap16(eh->e_machine);
   33.38 +    eh->e_version   = swap32(eh->e_version);
   33.39 +    eh->e_entry     = swap64(eh->e_entry);
   33.40 +    eh->e_phoff     = swap64(eh->e_phoff);
   33.41 +    eh->e_shoff     = swap64(eh->e_shoff);
   33.42 +    eh->e_flags     = swap32(eh->e_flags);
   33.43 +    eh->e_ehsize    = swap16(eh->e_ehsize);
   33.44 +    eh->e_phentsize = swap16(eh->e_phentsize);
   33.45 +    eh->e_phnum     = swap16(eh->e_phnum);
   33.46 +    eh->e_shentsize = swap16(eh->e_shentsize);
   33.47 +    eh->e_shnum     = swap16(eh->e_shnum);
   33.48 +    eh->e_shstrndx  = swap16(eh->e_shstrndx);
   33.49 +}
   33.50 +
   33.51 +static void endianadjust_phdr32(Elf32_Phdr *ph)
   33.52 +{
   33.53 +    if ( !big_endian )
   33.54 +        return;
   33.55 +    ph->p_type      = swap32(ph->p_type);
   33.56 +    ph->p_offset    = swap32(ph->p_offset);
   33.57 +    ph->p_vaddr     = swap32(ph->p_vaddr);
   33.58 +    ph->p_paddr     = swap32(ph->p_paddr);
   33.59 +    ph->p_filesz    = swap32(ph->p_filesz);
   33.60 +    ph->p_memsz     = swap32(ph->p_memsz);
   33.61 +    ph->p_flags     = swap32(ph->p_flags);
   33.62 +    ph->p_align     = swap32(ph->p_align);       
   33.63 +}
   33.64 +
   33.65 +static void endianadjust_phdr64(Elf64_Phdr *ph)
   33.66 +{
   33.67 +    if ( !big_endian )
   33.68 +        return;
   33.69 +    ph->p_type      = swap32(ph->p_type);
   33.70 +    ph->p_flags     = swap32(ph->p_flags);
   33.71 +    ph->p_offset    = swap64(ph->p_offset);
   33.72 +    ph->p_vaddr     = swap64(ph->p_vaddr);
   33.73 +    ph->p_paddr     = swap64(ph->p_paddr);
   33.74 +    ph->p_filesz    = swap64(ph->p_filesz);
   33.75 +    ph->p_memsz     = swap64(ph->p_memsz);
   33.76 +    ph->p_align     = swap64(ph->p_align);       
   33.77 +}
   33.78 +
   33.79 +static void endianadjust_shdr32(Elf32_Shdr *sh)
   33.80 +{
   33.81 +    if ( !big_endian )
   33.82 +        return;
   33.83 +    sh->sh_name     = swap32(sh->sh_name);
   33.84 +    sh->sh_type     = swap32(sh->sh_type);
   33.85 +    sh->sh_flags    = swap32(sh->sh_flags);
   33.86 +    sh->sh_addr     = swap32(sh->sh_addr);
   33.87 +    sh->sh_offset   = swap32(sh->sh_offset);
   33.88 +    sh->sh_size     = swap32(sh->sh_size);
   33.89 +    sh->sh_link     = swap32(sh->sh_link);
   33.90 +    sh->sh_info     = swap32(sh->sh_info);
   33.91 +    sh->sh_addralign = swap32(sh->sh_addralign);
   33.92 +    sh->sh_entsize  = swap32(sh->sh_entsize);
   33.93 +}
   33.94 +
   33.95  static void do_write(int fd, void *data, int len)
   33.96  {
   33.97      int   done, left = len;
   33.98 @@ -155,7 +243,7 @@ int main(int argc, char **argv)
   33.99      char      *inimage, *outimage;
  33.100      int        infd, outfd;
  33.101      char       buffer[1024];
  33.102 -    int        bytes, todo;
  33.103 +    int        bytes, todo, i;
  33.104  
  33.105      Elf32_Ehdr in32_ehdr;
  33.106      Elf32_Phdr in32_phdr;
  33.107 @@ -189,6 +277,9 @@ int main(int argc, char **argv)
  33.108          return 1;
  33.109      }
  33.110  
  33.111 +    big_endian = (*(u16 *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
  33.112 +
  33.113 +    endianadjust_ehdr32(&in32_ehdr);
  33.114      switch ( in32_ehdr.e_ident[EI_CLASS] )
  33.115      {
  33.116      case ELFCLASS32:
  33.117 @@ -208,6 +299,7 @@ int main(int argc, char **argv)
  33.118  
  33.119          (void)lseek(infd, in32_ehdr.e_phoff, SEEK_SET);
  33.120          do_read(infd, &in32_phdr, sizeof(in32_phdr));
  33.121 +        endianadjust_phdr32(&in32_phdr);
  33.122  
  33.123          (void)lseek(infd, in32_phdr.p_offset, SEEK_SET);
  33.124          dat_siz = (u32)in32_phdr.p_filesz;
  33.125 @@ -217,6 +309,7 @@ int main(int argc, char **argv)
  33.126      case ELFCLASS64:
  33.127          (void)lseek(infd, 0, SEEK_SET);
  33.128          do_read(infd, &in64_ehdr, sizeof(in64_ehdr));
  33.129 +        endianadjust_ehdr64(&in64_ehdr);
  33.130  
  33.131          if ( in64_ehdr.e_phentsize != sizeof(in64_phdr) )
  33.132          {
  33.133 @@ -234,6 +327,7 @@ int main(int argc, char **argv)
  33.134  
  33.135          (void)lseek(infd, in64_ehdr.e_phoff, SEEK_SET);
  33.136          do_read(infd, &in64_phdr, sizeof(in64_phdr));
  33.137 +        endianadjust_phdr64(&in64_phdr);
  33.138  
  33.139          (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
  33.140          dat_siz = (u32)in64_phdr.p_filesz;
  33.141 @@ -271,7 +365,10 @@ int main(int argc, char **argv)
  33.142          return 1;
  33.143      }
  33.144  
  33.145 +    endianadjust_ehdr32(&out_ehdr);
  33.146      do_write(outfd, &out_ehdr, sizeof(out_ehdr));
  33.147 +
  33.148 +    endianadjust_phdr32(&out_phdr);
  33.149      do_write(outfd, &out_phdr, sizeof(out_phdr));
  33.150      
  33.151      if ( (bytes = RAW_OFFSET - sizeof(out_ehdr) - sizeof(out_phdr)) < 0 )
  33.152 @@ -289,7 +386,10 @@ int main(int argc, char **argv)
  33.153          do_write(outfd, buffer, todo);
  33.154      }
  33.155  
  33.156 +    for ( i = 0; i < (sizeof(out_shdr) / sizeof(out_shdr[0])); i++ )
  33.157 +        endianadjust_shdr32(&out_shdr[i]);
  33.158      do_write(outfd, &out_shdr[0], sizeof(out_shdr));
  33.159 +
  33.160      do_write(outfd, out_shstrtab, sizeof(out_shstrtab));
  33.161      do_write(outfd, buffer, 4-((sizeof(out_shstrtab)+dat_siz)&3));
  33.162  
  33.163 @@ -298,3 +398,12 @@ int main(int argc, char **argv)
  33.164  
  33.165      return 0;
  33.166  }
  33.167 +
  33.168 +/*
  33.169 + * Local variables:
  33.170 + * mode: C
  33.171 + * c-set-style: "BSD"
  33.172 + * c-basic-offset: 4
  33.173 + * tab-width: 4
  33.174 + * indent-tabs-mode: nil
  33.175 + */
    34.1 --- a/xen/arch/x86/dom0_ops.c	Fri Feb 25 17:27:21 2005 +0000
    34.2 +++ b/xen/arch/x86/dom0_ops.c	Fri Feb 25 17:27:55 2005 +0000
    34.3 @@ -349,9 +349,10 @@ void arch_getdomaininfo_ctxt(
    34.4  { 
    34.5      int i;
    34.6  #ifdef __i386__  /* Remove when x86_64 VMX is implemented */
    34.7 -    unsigned long vmx_domain;
    34.8 +#ifdef CONFIG_VMX
    34.9      extern void save_vmx_execution_context(execution_context_t *);
   34.10  #endif
   34.11 +#endif
   34.12  
   34.13      c->flags = 0;
   34.14      memcpy(&c->cpu_ctxt, 
   34.15 @@ -359,10 +360,11 @@ void arch_getdomaininfo_ctxt(
   34.16             sizeof(ed->arch.user_ctxt));
   34.17  
   34.18  #ifdef __i386__
   34.19 -    vmx_domain = ed->arch.arch_vmx.flags;
   34.20 -    if (vmx_domain)
   34.21 +#ifdef CONFIG_VMX
   34.22 +    if ( VMX_DOMAIN(ed) )
   34.23          save_vmx_execution_context(&c->cpu_ctxt);
   34.24  #endif
   34.25 +#endif
   34.26  
   34.27      if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) )
   34.28          c->flags |= ECF_I387_VALID;
    35.1 --- a/xen/arch/x86/domain.c	Fri Feb 25 17:27:21 2005 +0000
    35.2 +++ b/xen/arch/x86/domain.c	Fri Feb 25 17:27:55 2005 +0000
    35.3 @@ -1,4 +1,3 @@
    35.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    35.5  /******************************************************************************
    35.6   * arch/x86/domain.c
    35.7   * 
    35.8 @@ -296,7 +295,7 @@ void arch_vmx_do_launch(struct exec_doma
    35.9      reset_stack_and_jump(vmx_asm_do_launch);
   35.10  }
   35.11  
   35.12 -static void alloc_monitor_pagetable(struct exec_domain *ed)
   35.13 +unsigned long alloc_monitor_pagetable(struct exec_domain *ed)
   35.14  {
   35.15      unsigned long mmfn;
   35.16      l2_pgentry_t *mpl2e;
   35.17 @@ -320,12 +319,13 @@ static void alloc_monitor_pagetable(stru
   35.18          mk_l2_pgentry((__pa(d->arch.mm_perdomain_pt) & PAGE_MASK) 
   35.19                        | __PAGE_HYPERVISOR);
   35.20  
   35.21 -    ed->arch.monitor_table = mk_pagetable(mmfn << PAGE_SHIFT);
   35.22      ed->arch.monitor_vtable = mpl2e;
   35.23  
   35.24      // map the phys_to_machine map into the Read-Only MPT space for this domain
   35.25      mpl2e[l2_table_offset(RO_MPT_VIRT_START)] =
   35.26          mk_l2_pgentry(pagetable_val(ed->arch.phys_table) | __PAGE_HYPERVISOR);
   35.27 +
   35.28 +    return mmfn;
   35.29  }
   35.30  
   35.31  /*
   35.32 @@ -409,13 +409,7 @@ static int vmx_final_setup_guest(struct 
   35.33          shadow_mode_enable(ed->domain, SHM_enable|SHM_translate|SHM_external);
   35.34      }
   35.35  
   35.36 -    /* We don't call update_pagetables() as we actively want fields such as 
   35.37 -     * the linear_pg_table to be null so that we bail out early of 
   35.38 -     * shadow_fault in case the vmx guest tries illegal accesses with
   35.39 -     * paging turned off. 
   35.40 -     */
   35.41 -    //update_pagetables(ed);     /* this assigns shadow_pagetable */
   35.42 -    alloc_monitor_pagetable(ed); /* this assigns monitor_pagetable */
   35.43 +    update_pagetables(ed);
   35.44  
   35.45      return 0;
   35.46  
   35.47 @@ -724,9 +718,6 @@ void switch_to(struct exec_domain *prev_
   35.48      struct tss_struct *tss = init_tss + smp_processor_id();
   35.49      execution_context_t *stack_ec = get_execution_context();
   35.50      int i;
   35.51 -#ifdef CONFIG_VMX
   35.52 -    unsigned long vmx_domain = next_p->arch.arch_vmx.flags; 
   35.53 -#endif
   35.54  
   35.55      __cli();
   35.56  
   35.57 @@ -759,7 +750,7 @@ void switch_to(struct exec_domain *prev_
   35.58          }
   35.59  
   35.60  #ifdef CONFIG_VMX
   35.61 -        if ( vmx_domain )
   35.62 +        if ( VMX_DOMAIN(next_p) )
   35.63          {
   35.64              /* Switch page tables. */
   35.65              write_ptbase(next_p);
   35.66 @@ -1005,3 +996,12 @@ void domain_relinquish_memory(struct dom
   35.67      relinquish_list(d, &d->page_list);
   35.68  }
   35.69  
   35.70 +
   35.71 +/*
   35.72 + * Local variables:
   35.73 + * mode: C
   35.74 + * c-set-style: "BSD"
   35.75 + * c-basic-offset: 4
   35.76 + * tab-width: 4
   35.77 + * indent-tabs-mode: nil
   35.78 + */
    36.1 --- a/xen/arch/x86/i387.c	Fri Feb 25 17:27:21 2005 +0000
    36.2 +++ b/xen/arch/x86/i387.c	Fri Feb 25 17:27:55 2005 +0000
    36.3 @@ -1,4 +1,3 @@
    36.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    36.5  /*
    36.6   *  linux/arch/i386/kernel/i387.c
    36.7   *
    36.8 @@ -16,42 +15,52 @@
    36.9  
   36.10  void init_fpu(void)
   36.11  {
   36.12 -    __asm__("fninit");
   36.13 -    if ( cpu_has_xmm ) load_mxcsr(0x1f80);
   36.14 +    __asm__ __volatile__ ( "fninit" );
   36.15 +    if ( cpu_has_xmm )
   36.16 +        load_mxcsr(0x1f80);
   36.17      set_bit(EDF_DONEFPUINIT, &current->ed_flags);
   36.18  }
   36.19  
   36.20 -static inline void __save_init_fpu( struct exec_domain *tsk )
   36.21 -{
   36.22 -    if ( cpu_has_fxsr ) {
   36.23 -        asm volatile( "fxsave %0 ; fnclex"
   36.24 -                      : "=m" (tsk->arch.i387) );
   36.25 -    } else {
   36.26 -        asm volatile( "fnsave %0 ; fwait"
   36.27 -                      : "=m" (tsk->arch.i387) );
   36.28 -    }
   36.29 -    clear_bit(EDF_USEDFPU, &tsk->ed_flags);
   36.30 -}
   36.31 -
   36.32 -void save_init_fpu( struct exec_domain *tsk )
   36.33 +void save_init_fpu(struct exec_domain *tsk)
   36.34  {
   36.35      /*
   36.36       * The guest OS may have set the 'virtual STTS' flag.
   36.37       * This causes us to set the real flag, so we'll need
   36.38       * to temporarily clear it while saving f-p state.
   36.39       */
   36.40 -    if ( test_bit(EDF_GUEST_STTS, &tsk->ed_flags) ) clts();
   36.41 -    __save_init_fpu(tsk);
   36.42 +    if ( test_bit(EDF_GUEST_STTS, &tsk->ed_flags) )
   36.43 +        clts();
   36.44 +
   36.45 +    if ( cpu_has_fxsr )
   36.46 +        __asm__ __volatile__ (
   36.47 +            "fxsave %0 ; fnclex"
   36.48 +            : "=m" (tsk->arch.i387) );
   36.49 +    else
   36.50 +        __asm__ __volatile__ (
   36.51 +            "fnsave %0 ; fwait"
   36.52 +            : "=m" (tsk->arch.i387) );
   36.53 +
   36.54 +    clear_bit(EDF_USEDFPU, &tsk->ed_flags);
   36.55      stts();
   36.56  }
   36.57  
   36.58 -void restore_fpu( struct exec_domain *tsk )
   36.59 +void restore_fpu(struct exec_domain *tsk)
   36.60  {
   36.61 -    if ( cpu_has_fxsr ) {
   36.62 -        asm volatile( "fxrstor %0"
   36.63 -                      : : "m" (tsk->arch.i387) );
   36.64 -    } else {
   36.65 -        asm volatile( "frstor %0"
   36.66 -                      : : "m" (tsk->arch.i387) );
   36.67 -    }
   36.68 +    if ( cpu_has_fxsr )
   36.69 +        __asm__ __volatile__ (
   36.70 +            "fxrstor %0"
   36.71 +            : : "m" (tsk->arch.i387) );
   36.72 +    else
   36.73 +        __asm__ __volatile__ (
   36.74 +            "frstor %0"
   36.75 +            : : "m" (tsk->arch.i387) );
   36.76  }
   36.77 +
   36.78 +/*
   36.79 + * Local variables:
   36.80 + * mode: C
   36.81 + * c-set-style: "BSD"
   36.82 + * c-basic-offset: 4
   36.83 + * tab-width: 4
   36.84 + * indent-tabs-mode: nil
   36.85 + */
    37.1 --- a/xen/arch/x86/idle0_task.c	Fri Feb 25 17:27:21 2005 +0000
    37.2 +++ b/xen/arch/x86/idle0_task.c	Fri Feb 25 17:27:55 2005 +0000
    37.3 @@ -1,4 +1,3 @@
    37.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    37.5  
    37.6  #include <xen/config.h>
    37.7  #include <xen/sched.h>
    37.8 @@ -17,3 +16,12 @@ struct exec_domain idle0_exec_domain = {
    37.9  };
   37.10  
   37.11  struct tss_struct init_tss[NR_CPUS];
   37.12 +
   37.13 +/*
   37.14 + * Local variables:
   37.15 + * mode: C
   37.16 + * c-set-style: "BSD"
   37.17 + * c-basic-offset: 4
   37.18 + * tab-width: 4
   37.19 + * indent-tabs-mode: nil
   37.20 + */
    38.1 --- a/xen/arch/x86/mm.c	Fri Feb 25 17:27:21 2005 +0000
    38.2 +++ b/xen/arch/x86/mm.c	Fri Feb 25 17:27:55 2005 +0000
    38.3 @@ -1,4 +1,3 @@
    38.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    38.5  /******************************************************************************
    38.6   * arch/x86/mm.c
    38.7   * 
    38.8 @@ -1979,6 +1978,9 @@ int do_update_va_mapping(unsigned long v
    38.9               * page was not shadowed, or that the L2 entry has not yet been
   38.10               * updated to reflect the shadow.
   38.11               */
   38.12 +            if ( shadow_mode_external(current->domain) )
   38.13 +                BUG(); // can't use linear_l2_table with external tables.
   38.14 +
   38.15              l2_pgentry_t gpde = linear_l2_table[l2_table_offset(va)];
   38.16              unsigned long gpfn = l2_pgentry_val(gpde) >> PAGE_SHIFT;
   38.17  
   38.18 @@ -2431,6 +2433,9 @@ int ptwr_do_page_fault(unsigned long add
   38.19       * Attempt to read the PTE that maps the VA being accessed. By checking for
   38.20       * PDE validity in the L2 we avoid many expensive fixups in __get_user().
   38.21       */
   38.22 +    if ( shadow_mode_external(current->domain) )
   38.23 +        BUG(); // can't use linear_l2_table with external tables.
   38.24 +
   38.25      if ( !(l2_pgentry_val(linear_l2_table[addr>>L2_PAGETABLE_SHIFT]) &
   38.26             _PAGE_PRESENT) ||
   38.27           __get_user(pte, (unsigned long *)
   38.28 @@ -2467,6 +2472,9 @@ int ptwr_do_page_fault(unsigned long add
   38.29       * Is the L1 p.t. mapped into the current address space? If so we call it
   38.30       * an ACTIVE p.t., otherwise it is INACTIVE.
   38.31       */
   38.32 +    if ( shadow_mode_external(current->domain) )
   38.33 +        BUG(); // can't use linear_l2_table with external tables.
   38.34 +
   38.35      pl2e = &linear_l2_table[l2_idx];
   38.36      l2e  = l2_pgentry_val(*pl2e);
   38.37      which = PTWR_PT_INACTIVE;
   38.38 @@ -3025,3 +3033,12 @@ void audit_domains_key(unsigned char key
   38.39  }
   38.40  
   38.41  #endif /* NDEBUG */
   38.42 +
   38.43 +/*
   38.44 + * Local variables:
   38.45 + * mode: C
   38.46 + * c-set-style: "BSD"
   38.47 + * c-basic-offset: 4
   38.48 + * tab-width: 4
   38.49 + * indent-tabs-mode: nil
   38.50 + */
    39.1 --- a/xen/arch/x86/pci-pc.c	Fri Feb 25 17:27:21 2005 +0000
    39.2 +++ b/xen/arch/x86/pci-pc.c	Fri Feb 25 17:27:55 2005 +0000
    39.3 @@ -1,4 +1,3 @@
    39.4 -/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    39.5  /*
    39.6   *	Low-Level PCI Support for PC
    39.7   *
    39.8 @@ -1546,3 +1545,12 @@ int pcibios_enable_device(struct pci_dev
    39.9  
   39.10  	return 0;
   39.11  }
   39.12 +
   39.13 +/*
   39.14 + * Local variables:
   39.15 + * mode: C
   39.16 + * c-set-style: "BSD"
   39.17 + * c-basic-offset: 8
   39.18 + * tab-width: 8
   39.19 + * indent-tabs-mode: t
   39.20 + */
    40.1 --- a/xen/arch/x86/setup.c	Fri Feb 25 17:27:21 2005 +0000
    40.2 +++ b/xen/arch/x86/setup.c	Fri Feb 25 17:27:55 2005 +0000
    40.3 @@ -1,4 +1,3 @@
    40.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    40.5  
    40.6  #include <xen/config.h>
    40.7  #include <xen/init.h>
    40.8 @@ -639,3 +638,12 @@ void __init __start_xen(multiboot_info_t
    40.9      domain_unpause_by_systemcontroller(dom0);
   40.10      startup_cpu_idle_loop();
   40.11  }
   40.12 +
   40.13 +/*
   40.14 + * Local variables:
   40.15 + * mode: C
   40.16 + * c-set-style: "BSD"
   40.17 + * c-basic-offset: 4
   40.18 + * tab-width: 4
   40.19 + * indent-tabs-mode: nil
   40.20 + */
    41.1 --- a/xen/arch/x86/shadow.c	Fri Feb 25 17:27:21 2005 +0000
    41.2 +++ b/xen/arch/x86/shadow.c	Fri Feb 25 17:27:55 2005 +0000
    41.3 @@ -1,4 +1,3 @@
    41.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    41.5  
    41.6  #include <xen/config.h>
    41.7  #include <xen/types.h>
    41.8 @@ -111,6 +110,10 @@ static inline int clear_shadow_page(
    41.9      int              restart = 0;
   41.10      struct pfn_info *spage = &frame_table[x->smfn_and_flags & PSH_pfn_mask];
   41.11  
   41.12 +    // We don't clear hl2_table's here.  At least not yet.
   41.13 +    if ( x->pfn & PSH_hl2 )
   41.14 +        return 0;
   41.15 +
   41.16      switch ( spage->u.inuse.type_info & PGT_type_mask )
   41.17      {
   41.18          /* We clear L2 pages by zeroing the guest entries. */
   41.19 @@ -486,7 +489,7 @@ unsigned long shadow_l2_table(
   41.20      spfn_info->u.inuse.type_info = PGT_l2_page_table;
   41.21      perfc_incr(shadow_l2_pages);
   41.22  
   41.23 -    spfn = spfn_info - frame_table;
   41.24 +    spfn = page_to_pfn(spfn_info);
   41.25    /* Mark pfn as being shadowed; update field to point at shadow. */
   41.26      set_shadow_status(d, gpfn, spfn | PSH_shadowed);
   41.27   
   41.28 @@ -770,6 +773,33 @@ void shadow_l2_normal_pt_update(unsigned
   41.29      unmap_domain_mem(spl2e);
   41.30  }
   41.31  
   41.32 +unsigned long mk_hl2_table(struct exec_domain *ed)
   41.33 +{
   41.34 +    struct domain *d = ed->domain;
   41.35 +    unsigned long gmfn = pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT;
   41.36 +    unsigned long gpfn = __mfn_to_gpfn(d, gmfn);
   41.37 +    unsigned long hl2mfn, status;
   41.38 +    struct pfn_info *hl2_info;
   41.39 +    l1_pgentry_t *hl2;
   41.40 +
   41.41 +    perfc_incr(hl2_table_pages);
   41.42 +
   41.43 +    if ( (hl2_info = alloc_shadow_page(d)) == NULL )
   41.44 +        BUG(); /* XXX Deal gracefully with failure. */
   41.45 +
   41.46 +    hl2_info->u.inuse.type_info = PGT_l1_page_table;
   41.47 +
   41.48 +    hl2mfn = page_to_pfn(hl2_info);
   41.49 +    status = hl2mfn | PSH_hl2;
   41.50 +    set_shadow_status(ed->domain, gpfn | PSH_hl2, status);
   41.51 +
   41.52 +    // need to optimize this...
   41.53 +    hl2 = map_domain_mem(hl2mfn << PAGE_SHIFT);
   41.54 +    memset(hl2, 0, PAGE_SIZE);
   41.55 +    unmap_domain_mem(hl2);
   41.56 +
   41.57 +    return status;
   41.58 +}
   41.59  
   41.60  
   41.61  
   41.62 @@ -1129,3 +1159,12 @@ int _check_all_pagetables(struct domain 
   41.63  }
   41.64  
   41.65  #endif // SHADOW_DEBUG
   41.66 +
   41.67 +/*
   41.68 + * Local variables:
   41.69 + * mode: C
   41.70 + * c-set-style: "BSD"
   41.71 + * c-basic-offset: 4
   41.72 + * tab-width: 4
   41.73 + * indent-tabs-mode: nil
   41.74 + */
    42.1 --- a/xen/arch/x86/smpboot.c	Fri Feb 25 17:27:21 2005 +0000
    42.2 +++ b/xen/arch/x86/smpboot.c	Fri Feb 25 17:27:55 2005 +0000
    42.3 @@ -1,4 +1,3 @@
    42.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    42.5  /*
    42.6   *	x86 SMP booting functions
    42.7   *
    42.8 @@ -945,3 +944,12 @@ void __init smp_boot_cpus(void)
    42.9  }
   42.10  
   42.11  #endif /* CONFIG_SMP */
   42.12 +
   42.13 +/*
   42.14 + * Local variables:
   42.15 + * mode: C
   42.16 + * c-set-style: "BSD"
   42.17 + * c-basic-offset: 4
   42.18 + * tab-width: 4
   42.19 + * indent-tabs-mode: nil
   42.20 + */
    43.1 --- a/xen/arch/x86/time.c	Fri Feb 25 17:27:21 2005 +0000
    43.2 +++ b/xen/arch/x86/time.c	Fri Feb 25 17:27:55 2005 +0000
    43.3 @@ -1,5 +1,4 @@
    43.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    43.5 - ****************************************************************************
    43.6 +/****************************************************************************
    43.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    43.8   * (C) 2002-2003 University of Cambridge
    43.9   ****************************************************************************
   43.10 @@ -378,3 +377,12 @@ void __init time_init(void)
   43.11  
   43.12      setup_irq(0, &irq0);
   43.13  }
   43.14 +
   43.15 +/*
   43.16 + * Local variables:
   43.17 + * mode: C
   43.18 + * c-set-style: "BSD"
   43.19 + * c-basic-offset: 4
   43.20 + * tab-width: 4
   43.21 + * indent-tabs-mode: nil
   43.22 + */
    44.1 --- a/xen/arch/x86/traps.c	Fri Feb 25 17:27:21 2005 +0000
    44.2 +++ b/xen/arch/x86/traps.c	Fri Feb 25 17:27:55 2005 +0000
    44.3 @@ -1,4 +1,3 @@
    44.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    44.5  /******************************************************************************
    44.6   * arch/x86/traps.c
    44.7   * 
    44.8 @@ -349,9 +348,27 @@ asmlinkage int do_page_fault(struct xen_
    44.9      return 0;
   44.10  }
   44.11  
   44.12 +long do_fpu_taskswitch(int set)
   44.13 +{
   44.14 +    struct exec_domain *ed = current;
   44.15 +
   44.16 +    if ( set )
   44.17 +    {
   44.18 +        set_bit(EDF_GUEST_STTS, &ed->ed_flags);
   44.19 +        stts();
   44.20 +    }
   44.21 +    else
   44.22 +    {
   44.23 +        clear_bit(EDF_GUEST_STTS, &ed->ed_flags);
   44.24 +        if ( test_bit(EDF_USEDFPU, &ed->ed_flags) )
   44.25 +            clts();
   44.26 +    }
   44.27 +
   44.28 +    return 0;
   44.29 +}
   44.30 +
   44.31  static int emulate_privileged_op(struct xen_regs *regs)
   44.32  {
   44.33 -    extern long do_fpu_taskswitch(void);
   44.34      extern void *decode_reg(struct xen_regs *regs, u8 b);
   44.35  
   44.36      struct exec_domain *ed = current;
   44.37 @@ -371,7 +388,7 @@ static int emulate_privileged_op(struct 
   44.38      switch ( opcode )
   44.39      {
   44.40      case 0x06: /* CLTS */
   44.41 -        (void)do_fpu_taskswitch();
   44.42 +        (void)do_fpu_taskswitch(0);
   44.43          break;
   44.44  
   44.45      case 0x09: /* WBINVD */
   44.46 @@ -420,8 +437,7 @@ static int emulate_privileged_op(struct 
   44.47          switch ( (opcode >> 3) & 7 )
   44.48          {
   44.49          case 0: /* Write CR0 */
   44.50 -            if ( *reg & X86_CR0_TS ) /* XXX ignore all but TS bit */
   44.51 -                (void)do_fpu_taskswitch;
   44.52 +            (void)do_fpu_taskswitch(!!(*reg & X86_CR0_TS));
   44.53              break;
   44.54  
   44.55          case 2: /* Write CR2 */
   44.56 @@ -818,14 +834,6 @@ long do_set_trap_table(trap_info_t *trap
   44.57  }
   44.58  
   44.59  
   44.60 -long do_fpu_taskswitch(void)
   44.61 -{
   44.62 -    set_bit(EDF_GUEST_STTS, &current->ed_flags);
   44.63 -    stts();
   44.64 -    return 0;
   44.65 -}
   44.66 -
   44.67 -
   44.68  #if defined(__i386__)
   44.69  #define DB_VALID_ADDR(_a) \
   44.70      ((_a) <= (PAGE_OFFSET - 4))
   44.71 @@ -908,3 +916,12 @@ unsigned long do_get_debugreg(int reg)
   44.72      if ( (reg < 0) || (reg > 7) ) return -EINVAL;
   44.73      return current->arch.debugreg[reg];
   44.74  }
   44.75 +
   44.76 +/*
   44.77 + * Local variables:
   44.78 + * mode: C
   44.79 + * c-set-style: "BSD"
   44.80 + * c-basic-offset: 4
   44.81 + * tab-width: 4
   44.82 + * indent-tabs-mode: nil
   44.83 + */
    45.1 --- a/xen/arch/x86/vmx.c	Fri Feb 25 17:27:21 2005 +0000
    45.2 +++ b/xen/arch/x86/vmx.c	Fri Feb 25 17:27:55 2005 +0000
    45.3 @@ -1,4 +1,3 @@
    45.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    45.5  /*
    45.6   * vmx.c: handling VMX architecture-related VM exits
    45.7   * Copyright (c) 2004, Intel Corporation.
    45.8 @@ -108,7 +107,7 @@ static void inline __update_guest_eip(un
    45.9  static int vmx_do_page_fault(unsigned long va, struct xen_regs *regs) 
   45.10  {
   45.11      unsigned long eip;
   45.12 -    unsigned long gpa;
   45.13 +    unsigned long gpte, gpa;
   45.14      int result;
   45.15  
   45.16  #if VMX_DEBUG
   45.17 @@ -130,17 +129,26 @@ static int vmx_do_page_fault(unsigned lo
   45.18          return 0;
   45.19      }
   45.20  
   45.21 -    gpa = gva_to_gpa(va);
   45.22 -    if (!gpa)
   45.23 -        return 0;
   45.24 +    gpte = gva_to_gpte(va);
   45.25 +    if (!(gpte & _PAGE_PRESENT) )
   45.26 +            return 0;
   45.27 +    gpa = (gpte & PAGE_MASK) + (va & ~PAGE_MASK);
   45.28  
   45.29 +    /* Use 1:1 page table to identify MMIO address space */
   45.30      if (mmio_space(gpa))
   45.31          handle_mmio(va, gpa);
   45.32  
   45.33 -    if ((result = shadow_fault(va, regs)))
   45.34 -        return result;
   45.35 -    
   45.36 -    return 0;       /* failed to resolve, i.e raise #PG */
   45.37 +    result = shadow_fault(va, regs);
   45.38 +
   45.39 +#if 0
   45.40 +    if ( !result )
   45.41 +    {
   45.42 +        __vmread(GUEST_EIP, &eip);
   45.43 +        printk("vmx pgfault to guest va=%p eip=%p\n", va, eip);
   45.44 +    }
   45.45 +#endif
   45.46 +
   45.47 +    return result;
   45.48  }
   45.49  
   45.50  static void vmx_do_general_protection_fault(struct xen_regs *regs) 
   45.51 @@ -273,19 +281,11 @@ static void vmx_vmexit_do_invlpg(unsigne
   45.52       * copying from guest
   45.53       */
   45.54      shadow_invlpg(ed, va);
   45.55 -    index = (va >> L2_PAGETABLE_SHIFT);
   45.56 +    index = l2_table_offset(va);
   45.57      ed->arch.hl2_vtable[index] = 
   45.58          mk_l2_pgentry(0); /* invalidate pgd cache */
   45.59  }
   45.60  
   45.61 -static inline void hl2_table_invalidate(struct exec_domain *ed)
   45.62 -{
   45.63 -    /*
   45.64 -     * Need to optimize this
   45.65 -     */
   45.66 -    memset(ed->arch.hl2_vtable, 0, PAGE_SIZE);
   45.67 -}
   45.68 -
   45.69  static void vmx_io_instruction(struct xen_regs *regs, 
   45.70                     unsigned long exit_qualification, unsigned long inst_len) 
   45.71  {
   45.72 @@ -704,9 +704,6 @@ void restore_xen_regs(struct xen_regs *r
   45.73  }
   45.74  #endif
   45.75  
   45.76 -#define TRC_VMX_VMEXIT 0x00040001
   45.77 -#define TRC_VMX_VECTOR 0x00040002
   45.78 -
   45.79  asmlinkage void vmx_vmexit_handler(struct xen_regs regs)
   45.80  {
   45.81      unsigned int exit_reason, idtv_info_field;
   45.82 @@ -811,6 +808,7 @@ asmlinkage void vmx_vmexit_handler(struc
   45.83                  __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
   45.84                  __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, regs.error_code);
   45.85                  ed->arch.arch_vmx.cpu_cr2 = va;
   45.86 +                TRACE_3D(TRC_VMX_INT, ed->domain->id, TRAP_page_fault, va);
   45.87              }
   45.88              break;
   45.89          }
   45.90 @@ -942,3 +940,12 @@ asmlinkage void load_cr2(void)
   45.91  }
   45.92  
   45.93  #endif /* CONFIG_VMX */
   45.94 +
   45.95 +/*
   45.96 + * Local variables:
   45.97 + * mode: C
   45.98 + * c-set-style: "BSD"
   45.99 + * c-basic-offset: 4
  45.100 + * tab-width: 4
  45.101 + * indent-tabs-mode: nil
  45.102 + */
    46.1 --- a/xen/arch/x86/vmx_intercept.c	Fri Feb 25 17:27:21 2005 +0000
    46.2 +++ b/xen/arch/x86/vmx_intercept.c	Fri Feb 25 17:27:55 2005 +0000
    46.3 @@ -29,6 +29,8 @@
    46.4  #include <xen/sched.h>
    46.5  #include <asm/current.h>
    46.6  
    46.7 +#ifdef CONFIG_VMX
    46.8 +
    46.9  /* for intercepting io request after vm_exit, return value: 0--not handle; 1--handled */
   46.10  int vmx_io_intercept(ioreq_t *p)
   46.11  {
   46.12 @@ -203,7 +205,7 @@ static void pit_timer_fn(unsigned long d
   46.13  
   46.14  
   46.15  /* Only some PIT operations such as load init counter need a hypervisor hook.
   46.16 - * leave many other operations in user space DM
   46.17 + * leave all other operations in user space DM
   46.18   */
   46.19  void vmx_hooks_assist(struct exec_domain *d)
   46.20  {
   46.21 @@ -213,11 +215,20 @@ void vmx_hooks_assist(struct exec_domain
   46.22      struct vmx_virpit_t *vpit = &(d->arch.arch_vmx.vmx_platform.vmx_pit);
   46.23      int rw_mode;
   46.24  
   46.25 -    if (p->state == STATE_IORESP_HOOK) { /*load init count*/
   46.26 -        vpit->init_val = (p->u.data & 0xFFFF) ; /* frequency(ms) of pit */
   46.27 -        vpit->period = (vpit->init_val) * 1000 / PIT_FREQ; /* frequency(ms) of pit */
   46.28 +    /* load init count*/
   46.29 +    if (p->state == STATE_IORESP_HOOK) { 
   46.30 +        /* init count for this channel */
   46.31 +        vpit->init_val = (p->u.data & 0xFFFF) ; 
   46.32 +        /* frequency(ms) of pit */
   46.33 +        vpit->period = DIV_ROUND(((vpit->init_val) * 1000), PIT_FREQ); 
   46.34 +        if (vpit->period < 1) {
   46.35 +            printk("VMX_PIT: guest programmed too small an init_val: %lx\n",
   46.36 +                   vpit->init_val);
   46.37 +            vpit->period = 1;
   46.38 +        }
   46.39          vpit->vector = ((p->u.data >> 16) & 0xFF);
   46.40          vpit->channel = ((p->u.data >> 24) & 0x3);
   46.41 +        vpit->first_injected = 0;
   46.42  
   46.43  	vpit->count_LSB_latched = 0;
   46.44  	vpit->count_MSB_latched = 0;
   46.45 @@ -255,3 +266,5 @@ void vmx_hooks_assist(struct exec_domain
   46.46      }
   46.47  
   46.48  }
   46.49 +
   46.50 +#endif /* CONFIG_VMX */
    47.1 --- a/xen/arch/x86/vmx_io.c	Fri Feb 25 17:27:21 2005 +0000
    47.2 +++ b/xen/arch/x86/vmx_io.c	Fri Feb 25 17:27:55 2005 +0000
    47.3 @@ -1,4 +1,3 @@
    47.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    47.5  /*
    47.6   * vmx_io.c: handling I/O, interrupts related VMX entry/exit 
    47.7   * Copyright (c) 2004, Intel Corporation.
    47.8 @@ -22,6 +21,7 @@
    47.9  #include <xen/mm.h>
   47.10  #include <xen/lib.h>
   47.11  #include <xen/errno.h>
   47.12 +#include <xen/trace.h>
   47.13  
   47.14  #include <asm/cpufeature.h>
   47.15  #include <asm/processor.h>
   47.16 @@ -367,11 +367,18 @@ void vmx_intr_assist(struct exec_domain 
   47.17      else
   47.18          clear_highest_bit(d, highest_vector); 
   47.19  
   47.20 +    /* close the window between guest PIT initialization and sti */
   47.21 +    if (highest_vector == vpit->vector && !vpit->first_injected){
   47.22 +        vpit->first_injected = 1;
   47.23 +        vpit->pending_intr_nr = 0;
   47.24 +    }
   47.25 +
   47.26      intr_fields = (INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR | highest_vector);
   47.27      __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
   47.28  
   47.29      __vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0);
   47.30  
   47.31 +    TRACE_2D(TRC_VMX_INT, d, highest_vector);
   47.32      if (highest_vector == vpit->vector)
   47.33          vpit->inject_point = NOW();
   47.34  
   47.35 @@ -380,11 +387,11 @@ void vmx_intr_assist(struct exec_domain 
   47.36  
   47.37  void vmx_do_resume(struct exec_domain *d) 
   47.38  {
   47.39 -    if ( d->arch.guest_vtable )
   47.40 +    if ( test_bit(VMX_CPU_STATE_PG_ENABLED, &d->arch.arch_vmx.cpu_state) )
   47.41          __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
   47.42      else
   47.43 -        // we haven't switched off the 1:1 pagetable yet...
   47.44 -        __vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table));
   47.45 +        // paging is not enabled in the guest
   47.46 +        __vmwrite(GUEST_CR3, pagetable_val(d->arch.phys_table));
   47.47  
   47.48      __vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table));
   47.49      __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
   47.50 @@ -409,3 +416,12 @@ void vmx_do_resume(struct exec_domain *d
   47.51  }
   47.52  
   47.53  #endif /* CONFIG_VMX */
   47.54 +
   47.55 +/*
   47.56 + * Local variables:
   47.57 + * mode: C
   47.58 + * c-set-style: "BSD"
   47.59 + * c-basic-offset: 4
   47.60 + * tab-width: 4
   47.61 + * indent-tabs-mode: nil
   47.62 + */
    48.1 --- a/xen/arch/x86/vmx_platform.c	Fri Feb 25 17:27:21 2005 +0000
    48.2 +++ b/xen/arch/x86/vmx_platform.c	Fri Feb 25 17:27:55 2005 +0000
    48.3 @@ -1,4 +1,3 @@
    48.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    48.5  /*
    48.6   * vmx_platform.c: handling x86 platform related MMIO instructions
    48.7   * Copyright (c) 2004, Intel Corporation.
    48.8 @@ -551,3 +550,12 @@ void handle_mmio(unsigned long va, unsig
    48.9  }
   48.10  
   48.11  #endif /* CONFIG_VMX */
   48.12 +
   48.13 +/*
   48.14 + * Local variables:
   48.15 + * mode: C
   48.16 + * c-set-style: "BSD"
   48.17 + * c-basic-offset: 4
   48.18 + * tab-width: 4
   48.19 + * indent-tabs-mode: nil
   48.20 + */
    49.1 --- a/xen/arch/x86/vmx_vmcs.c	Fri Feb 25 17:27:21 2005 +0000
    49.2 +++ b/xen/arch/x86/vmx_vmcs.c	Fri Feb 25 17:27:55 2005 +0000
    49.3 @@ -1,4 +1,3 @@
    49.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    49.5  /*
    49.6   * vmx_vmcs.c: VMCS management
    49.7   * Copyright (c) 2004, Intel Corporation.
    49.8 @@ -162,7 +161,6 @@ void vmx_do_launch(struct exec_domain *e
    49.9      struct host_execution_env host_env;
   49.10      struct Xgt_desc_struct desc;
   49.11      struct list_head *list_ent;
   49.12 -    l2_pgentry_t *mpl2e, *hl2_vtable;
   49.13      unsigned long i, pfn = 0;
   49.14      struct pfn_info *page;
   49.15      execution_context_t *ec = get_execution_context();
   49.16 @@ -174,8 +172,6 @@ void vmx_do_launch(struct exec_domain *e
   49.17      spin_lock(&d->page_alloc_lock);
   49.18      list_ent = d->page_list.next;
   49.19  
   49.20 -    mpl2e = (l2_pgentry_t *)map_domain_mem(pagetable_val(ed->arch.monitor_table));
   49.21 -
   49.22      for ( i = 0; list_ent != &d->page_list; i++ )
   49.23      {
   49.24          pfn = list_entry(list_ent, struct pfn_info, list) - frame_table;
   49.25 @@ -189,18 +185,6 @@ void vmx_do_launch(struct exec_domain *e
   49.26      page = (struct pfn_info *) alloc_domheap_page(NULL);
   49.27      pfn = (unsigned long) (page - frame_table);
   49.28  
   49.29 -    /*
   49.30 -     * make linear_pt_table work for guest ptes
   49.31 -     */
   49.32 -    mpl2e[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
   49.33 -        mk_l2_pgentry((pfn << PAGE_SHIFT)| __PAGE_HYPERVISOR);
   49.34 -
   49.35 -    hl2_vtable = map_domain_mem(pfn << PAGE_SHIFT);
   49.36 -    memset(hl2_vtable, 0, PAGE_SIZE); /* clean it up */
   49.37 -    ed->arch.hl2_vtable = hl2_vtable; 
   49.38 -        
   49.39 -    unmap_domain_mem(mpl2e);
   49.40 -
   49.41      vmx_setup_platform(ed, ec);
   49.42  
   49.43      __asm__ __volatile__ ("sgdt  (%%eax) \n" :: "a"(&desc) : "memory");
   49.44 @@ -479,3 +463,12 @@ void vm_resume_fail(unsigned long eflags
   49.45  }
   49.46  
   49.47  #endif /* CONFIG_VMX */
   49.48 +
   49.49 +/*
   49.50 + * Local variables:
   49.51 + * mode: C
   49.52 + * c-set-style: "BSD"
   49.53 + * c-basic-offset: 4
   49.54 + * tab-width: 4
   49.55 + * indent-tabs-mode: nil
   49.56 + */
    50.1 --- a/xen/arch/x86/x86_32/domain_build.c	Fri Feb 25 17:27:21 2005 +0000
    50.2 +++ b/xen/arch/x86/x86_32/domain_build.c	Fri Feb 25 17:27:55 2005 +0000
    50.3 @@ -1,4 +1,3 @@
    50.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    50.5  /******************************************************************************
    50.6   * domain_build.c
    50.7   * 
    50.8 @@ -406,3 +405,12 @@ int elf_sanity_check(Elf_Ehdr *ehdr)
    50.9  
   50.10      return 1;
   50.11  }
   50.12 +
   50.13 +/*
   50.14 + * Local variables:
   50.15 + * mode: C
   50.16 + * c-set-style: "BSD"
   50.17 + * c-basic-offset: 4
   50.18 + * tab-width: 4
   50.19 + * indent-tabs-mode: nil
   50.20 + */
    51.1 --- a/xen/arch/x86/x86_32/domain_page.c	Fri Feb 25 17:27:21 2005 +0000
    51.2 +++ b/xen/arch/x86/x86_32/domain_page.c	Fri Feb 25 17:27:55 2005 +0000
    51.3 @@ -44,6 +44,9 @@ void *map_domain_mem(unsigned long pa)
    51.4      unsigned long va;
    51.5      unsigned int idx, cpu = smp_processor_id();
    51.6      unsigned long *cache = mapcache;
    51.7 +#ifndef NDEBUG
    51.8 +    unsigned flush_count = 0;
    51.9 +#endif
   51.10  
   51.11      ASSERT(!in_irq());
   51.12      perfc_incrc(map_domain_mem_count);
   51.13 @@ -66,6 +69,13 @@ void *map_domain_mem(unsigned long pa)
   51.14              perfc_incrc(domain_page_tlb_flush);
   51.15              local_flush_tlb();
   51.16              shadow_epoch[cpu] = ++epoch;
   51.17 +#ifndef NDEBUG
   51.18 +            if ( unlikely(flush_count++) )
   51.19 +            {
   51.20 +                // we've run out of map cache entries...
   51.21 +                BUG();
   51.22 +            }
   51.23 +#endif
   51.24          }
   51.25      }
   51.26      while ( cache[idx] != 0 );
    52.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Feb 25 17:27:21 2005 +0000
    52.2 +++ b/xen/arch/x86/x86_32/entry.S	Fri Feb 25 17:27:55 2005 +0000
    52.3 @@ -99,6 +99,7 @@
    52.4          pushl $VMX_MONITOR_EFLAGS; \
    52.5          popf; \
    52.6          subl $(NR_SKIPPED_REGS*4), %esp; \
    52.7 +        movl $0, 0xc(%esp); /* eflags==0 identifies xen_regs as VMX guest */ \
    52.8          pushl %eax; \
    52.9          pushl %ebp; \
   52.10          pushl %edi; \
    53.1 --- a/xen/arch/x86/x86_32/mm.c	Fri Feb 25 17:27:21 2005 +0000
    53.2 +++ b/xen/arch/x86/x86_32/mm.c	Fri Feb 25 17:27:55 2005 +0000
    53.3 @@ -1,4 +1,3 @@
    53.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    53.5  /******************************************************************************
    53.6   * arch/x86/x86_32/mm.c
    53.7   * 
    53.8 @@ -386,3 +385,12 @@ void memguard_unguard_range(void *p, uns
    53.9  }
   53.10  
   53.11  #endif
   53.12 +
   53.13 +/*
   53.14 + * Local variables:
   53.15 + * mode: C
   53.16 + * c-set-style: "BSD"
   53.17 + * c-basic-offset: 4
   53.18 + * tab-width: 4
   53.19 + * indent-tabs-mode: nil
   53.20 + */
    54.1 --- a/xen/arch/x86/x86_32/seg_fixup.c	Fri Feb 25 17:27:21 2005 +0000
    54.2 +++ b/xen/arch/x86/x86_32/seg_fixup.c	Fri Feb 25 17:27:55 2005 +0000
    54.3 @@ -1,4 +1,3 @@
    54.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    54.5  /******************************************************************************
    54.6   * arch/x86/x86_32/seg_fixup.c
    54.7   * 
    54.8 @@ -492,3 +491,12 @@ int gpf_emulate_4gb(struct xen_regs *reg
    54.9      propagate_page_fault((unsigned long)pb, 4);
   54.10      return EXCRET_fault_fixed;
   54.11  }
   54.12 +
   54.13 +/*
   54.14 + * Local variables:
   54.15 + * mode: C
   54.16 + * c-set-style: "BSD"
   54.17 + * c-basic-offset: 4
   54.18 + * tab-width: 4
   54.19 + * indent-tabs-mode: nil
   54.20 + */
    55.1 --- a/xen/arch/x86/x86_32/traps.c	Fri Feb 25 17:27:21 2005 +0000
    55.2 +++ b/xen/arch/x86/x86_32/traps.c	Fri Feb 25 17:27:55 2005 +0000
    55.3 @@ -1,4 +1,3 @@
    55.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    55.5  
    55.6  #include <xen/config.h>
    55.7  #include <xen/init.h>
    55.8 @@ -9,6 +8,10 @@
    55.9  #include <xen/irq.h>
   55.10  #include <asm/flushtlb.h>
   55.11  
   55.12 +#ifdef CONFIG_VMX
   55.13 +#include <asm/vmx.h>
   55.14 +#endif
   55.15 +
   55.16  /* All CPUs have their own IDT to allow set_fast_trap(). */
   55.17  idt_entry_t *idt_tables[NR_CPUS] = { 0 };
   55.18  
   55.19 @@ -88,37 +91,63 @@ void show_stack(unsigned long *esp)
   55.20  
   55.21  void show_registers(struct xen_regs *regs)
   55.22  {
   55.23 -    unsigned long esp;
   55.24 -    unsigned short ss, ds, es, fs, gs;
   55.25 +    unsigned long ss, ds, es, fs, gs, cs;
   55.26 +    unsigned long eip, esp, eflags;
   55.27 +    const char *context;
   55.28  
   55.29 -    if ( GUEST_MODE(regs) )
   55.30 +#ifdef CONFIG_VMX
   55.31 +    if ( VMX_DOMAIN(current) && (regs->eflags == 0) )
   55.32      {
   55.33 -        esp = regs->esp;
   55.34 -        ss  = regs->ss & 0xffff;
   55.35 -        ds  = regs->ds & 0xffff;
   55.36 -        es  = regs->es & 0xffff;
   55.37 -        fs  = regs->fs & 0xffff;
   55.38 -        gs  = regs->gs & 0xffff;
   55.39 +        __vmread(GUEST_EIP, &eip);
   55.40 +        __vmread(GUEST_ESP, &esp);
   55.41 +        __vmread(GUEST_EFLAGS, &eflags);
   55.42 +        __vmread(GUEST_SS_SELECTOR, &ss);
   55.43 +        __vmread(GUEST_DS_SELECTOR, &ds);
   55.44 +        __vmread(GUEST_ES_SELECTOR, &es);
   55.45 +        __vmread(GUEST_FS_SELECTOR, &fs);
   55.46 +        __vmread(GUEST_GS_SELECTOR, &gs);
   55.47 +        __vmread(GUEST_CS_SELECTOR, &cs);
   55.48 +        context = "vmx guest";
   55.49      }
   55.50      else
   55.51 +#endif
   55.52      {
   55.53 -        esp = (unsigned long)(&regs->esp);
   55.54 -        ss  = __HYPERVISOR_DS;
   55.55 -        ds  = __HYPERVISOR_DS;
   55.56 -        es  = __HYPERVISOR_DS;
   55.57 -        fs  = __HYPERVISOR_DS;
   55.58 -        gs  = __HYPERVISOR_DS;
   55.59 +        eip = regs->eip;
   55.60 +        eflags = regs->eflags;
   55.61 +
   55.62 +        if ( GUEST_MODE(regs) )
   55.63 +        {
   55.64 +            esp = regs->esp;
   55.65 +            ss  = regs->ss & 0xffff;
   55.66 +            ds  = regs->ds & 0xffff;
   55.67 +            es  = regs->es & 0xffff;
   55.68 +            fs  = regs->fs & 0xffff;
   55.69 +            gs  = regs->gs & 0xffff;
   55.70 +            cs  = regs->cs & 0xffff;
   55.71 +            context = "guest";
   55.72 +        }
   55.73 +        else
   55.74 +        {
   55.75 +            esp = (unsigned long)(&regs->esp);
   55.76 +            ss  = __HYPERVISOR_DS;
   55.77 +            ds  = __HYPERVISOR_DS;
   55.78 +            es  = __HYPERVISOR_DS;
   55.79 +            fs  = __HYPERVISOR_DS;
   55.80 +            gs  = __HYPERVISOR_DS;
   55.81 +            cs  = __HYPERVISOR_CS;
   55.82 +            
   55.83 +            context = "hypervisor";
   55.84 +        }
   55.85      }
   55.86  
   55.87 -    printk("CPU:    %d\nEIP:    %04lx:[<%p>]      \nEFLAGS: %p\n",
   55.88 -           smp_processor_id(), 0xffff & regs->cs, regs->eip, regs->eflags);
   55.89 +    printk("CPU:    %d\nEIP:    %04lx:[<%p>]      \nEFLAGS: %p   CONTEXT: %s\n",
   55.90 +           smp_processor_id(), 0xffff & regs->cs, eip, eflags, context);
   55.91      printk("eax: %p   ebx: %p   ecx: %p   edx: %p\n",
   55.92             regs->eax, regs->ebx, regs->ecx, regs->edx);
   55.93      printk("esi: %p   edi: %p   ebp: %p   esp: %p\n",
   55.94             regs->esi, regs->edi, regs->ebp, esp);
   55.95 -    printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
   55.96 -           ds, es, fs, gs, ss);
   55.97 -    printk("cr3: %08lx\n", read_cr3());
   55.98 +    printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x   cs: %04x\n",
   55.99 +           ds, es, fs, gs, ss, cs);
  55.100  
  55.101      show_stack((unsigned long *)&regs->esp);
  55.102  } 
  55.103 @@ -292,3 +321,12 @@ long do_set_callbacks(unsigned long even
  55.104  
  55.105      return 0;
  55.106  }
  55.107 +
  55.108 +/*
  55.109 + * Local variables:
  55.110 + * mode: C
  55.111 + * c-set-style: "BSD"
  55.112 + * c-basic-offset: 4
  55.113 + * tab-width: 4
  55.114 + * indent-tabs-mode: nil
  55.115 + */
    56.1 --- a/xen/arch/x86/x86_64/domain_build.c	Fri Feb 25 17:27:21 2005 +0000
    56.2 +++ b/xen/arch/x86/x86_64/domain_build.c	Fri Feb 25 17:27:55 2005 +0000
    56.3 @@ -1,4 +1,3 @@
    56.4 -/* -*-  Modes:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    56.5  /******************************************************************************
    56.6   * domain_build.c
    56.7   * 
    56.8 @@ -414,3 +413,12 @@ int elf_sanity_check(Elf_Ehdr *ehdr)
    56.9  
   56.10      return 1;
   56.11  }
   56.12 +
   56.13 +/*
   56.14 + * Local variables:
   56.15 + * mode: C
   56.16 + * c-set-style: "BSD"
   56.17 + * c-basic-offset: 4
   56.18 + * tab-width: 4
   56.19 + * indent-tabs-mode: nil
   56.20 + */
    57.1 --- a/xen/arch/x86/x86_64/mm.c	Fri Feb 25 17:27:21 2005 +0000
    57.2 +++ b/xen/arch/x86/x86_64/mm.c	Fri Feb 25 17:27:55 2005 +0000
    57.3 @@ -1,4 +1,3 @@
    57.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    57.5  /******************************************************************************
    57.6   * arch/x86/x86_64/mm.c
    57.7   * 
    57.8 @@ -407,3 +406,12 @@ void memguard_unguard_range(void *p, uns
    57.9  }
   57.10  
   57.11  #endif
   57.12 +
   57.13 +/*
   57.14 + * Local variables:
   57.15 + * mode: C
   57.16 + * c-set-style: "BSD"
   57.17 + * c-basic-offset: 4
   57.18 + * tab-width: 4
   57.19 + * indent-tabs-mode: nil
   57.20 + */
    58.1 --- a/xen/common/ac_timer.c	Fri Feb 25 17:27:21 2005 +0000
    58.2 +++ b/xen/common/ac_timer.c	Fri Feb 25 17:27:55 2005 +0000
    58.3 @@ -1,5 +1,4 @@
    58.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    58.5 - ****************************************************************************
    58.6 +/****************************************************************************
    58.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    58.8   * (C) 2002-2003 University of Cambridge
    58.9   ****************************************************************************
   58.10 @@ -287,3 +286,12 @@ void __init ac_timer_init(void)
   58.11  
   58.12      register_keyhandler('a', dump_timerq, "dump ac_timer queues");
   58.13  }
   58.14 +
   58.15 +/*
   58.16 + * Local variables:
   58.17 + * mode: C
   58.18 + * c-set-style: "BSD"
   58.19 + * c-basic-offset: 4
   58.20 + * tab-width: 4
   58.21 + * indent-tabs-mode: nil
   58.22 + */
    59.1 --- a/xen/common/dom0_ops.c	Fri Feb 25 17:27:21 2005 +0000
    59.2 +++ b/xen/common/dom0_ops.c	Fri Feb 25 17:27:55 2005 +0000
    59.3 @@ -1,4 +1,3 @@
    59.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    59.5  /******************************************************************************
    59.6   * dom0_ops.c
    59.7   * 
    59.8 @@ -488,3 +487,12 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    59.9  
   59.10      return ret;
   59.11  }
   59.12 +
   59.13 +/*
   59.14 + * Local variables:
   59.15 + * mode: C
   59.16 + * c-set-style: "BSD"
   59.17 + * c-basic-offset: 4
   59.18 + * tab-width: 4
   59.19 + * indent-tabs-mode: nil
   59.20 + */
    60.1 --- a/xen/common/dom_mem_ops.c	Fri Feb 25 17:27:21 2005 +0000
    60.2 +++ b/xen/common/dom_mem_ops.c	Fri Feb 25 17:27:55 2005 +0000
    60.3 @@ -1,4 +1,3 @@
    60.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    60.5  /******************************************************************************
    60.6   * dom_mem_ops.c
    60.7   *
    60.8 @@ -167,3 +166,12 @@ do_dom_mem_op(unsigned long  op,
    60.9  
   60.10      return rc;
   60.11  }
   60.12 +
   60.13 +/*
   60.14 + * Local variables:
   60.15 + * mode: C
   60.16 + * c-set-style: "BSD"
   60.17 + * c-basic-offset: 4
   60.18 + * tab-width: 4
   60.19 + * indent-tabs-mode: nil
   60.20 + */
    61.1 --- a/xen/common/domain.c	Fri Feb 25 17:27:21 2005 +0000
    61.2 +++ b/xen/common/domain.c	Fri Feb 25 17:27:55 2005 +0000
    61.3 @@ -1,4 +1,3 @@
    61.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    61.5  /******************************************************************************
    61.6   * domain.c
    61.7   * 
    61.8 @@ -379,3 +378,12 @@ long vm_assist(struct domain *p, unsigne
    61.9  
   61.10      return -ENOSYS;
   61.11  }
   61.12 +
   61.13 +/*
   61.14 + * Local variables:
   61.15 + * mode: C
   61.16 + * c-set-style: "BSD"
   61.17 + * c-basic-offset: 4
   61.18 + * tab-width: 4
   61.19 + * indent-tabs-mode: nil
   61.20 + */
    62.1 --- a/xen/common/elf.c	Fri Feb 25 17:27:21 2005 +0000
    62.2 +++ b/xen/common/elf.c	Fri Feb 25 17:27:55 2005 +0000
    62.3 @@ -1,4 +1,3 @@
    62.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    62.5  /******************************************************************************
    62.6   * elf.c
    62.7   * 
    62.8 @@ -151,3 +150,12 @@ int loadelfimage(char *elfbase)
    62.9  
   62.10      return 0;
   62.11  }
   62.12 +
   62.13 +/*
   62.14 + * Local variables:
   62.15 + * mode: C
   62.16 + * c-set-style: "BSD"
   62.17 + * c-basic-offset: 4
   62.18 + * tab-width: 4
   62.19 + * indent-tabs-mode: nil
   62.20 + */
    63.1 --- a/xen/common/event_channel.c	Fri Feb 25 17:27:21 2005 +0000
    63.2 +++ b/xen/common/event_channel.c	Fri Feb 25 17:27:55 2005 +0000
    63.3 @@ -1,4 +1,3 @@
    63.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    63.5  /******************************************************************************
    63.6   * event_channel.c
    63.7   * 
    63.8 @@ -660,3 +659,12 @@ void destroy_event_channels(struct domai
    63.9          xfree(d->event_channel);
   63.10      }
   63.11  }
   63.12 +
   63.13 +/*
   63.14 + * Local variables:
   63.15 + * mode: C
   63.16 + * c-set-style: "BSD"
   63.17 + * c-basic-offset: 4
   63.18 + * tab-width: 4
   63.19 + * indent-tabs-mode: nil
   63.20 + */
    64.1 --- a/xen/common/grant_table.c	Fri Feb 25 17:27:21 2005 +0000
    64.2 +++ b/xen/common/grant_table.c	Fri Feb 25 17:27:55 2005 +0000
    64.3 @@ -1,4 +1,3 @@
    64.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    64.5  /******************************************************************************
    64.6   * common/grant_table.c
    64.7   * 
    64.8 @@ -631,3 +630,12 @@ grant_table_init(
    64.9  {
   64.10      /* Nothing. */
   64.11  }
   64.12 +
   64.13 +/*
   64.14 + * Local variables:
   64.15 + * mode: C
   64.16 + * c-set-style: "BSD"
   64.17 + * c-basic-offset: 4
   64.18 + * tab-width: 4
   64.19 + * indent-tabs-mode: nil
   64.20 + */
    65.1 --- a/xen/common/kernel.c	Fri Feb 25 17:27:21 2005 +0000
    65.2 +++ b/xen/common/kernel.c	Fri Feb 25 17:27:55 2005 +0000
    65.3 @@ -1,4 +1,3 @@
    65.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    65.5  /******************************************************************************
    65.6   * kernel.c
    65.7   * 
    65.8 @@ -87,3 +86,12 @@ long do_ni_hypercall(void)
    65.9      /* No-op hypercall. */
   65.10      return -ENOSYS;
   65.11  }
   65.12 +
   65.13 +/*
   65.14 + * Local variables:
   65.15 + * mode: C
   65.16 + * c-set-style: "BSD"
   65.17 + * c-basic-offset: 4
   65.18 + * tab-width: 4
   65.19 + * indent-tabs-mode: nil
   65.20 + */
    66.1 --- a/xen/common/keyhandler.c	Fri Feb 25 17:27:21 2005 +0000
    66.2 +++ b/xen/common/keyhandler.c	Fri Feb 25 17:27:55 2005 +0000
    66.3 @@ -1,4 +1,3 @@
    66.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    66.5  /******************************************************************************
    66.6   * keyhandler.c
    66.7   */
    66.8 @@ -201,3 +200,12 @@ void initialize_keytable(void)
    66.9  
   66.10      register_irq_keyhandler('%', do_debug_key,   "Trap to xendbg");
   66.11  }
   66.12 +
   66.13 +/*
   66.14 + * Local variables:
   66.15 + * mode: C
   66.16 + * c-set-style: "BSD"
   66.17 + * c-basic-offset: 4
   66.18 + * tab-width: 4
   66.19 + * indent-tabs-mode: nil
   66.20 + */
    67.1 --- a/xen/common/lib.c	Fri Feb 25 17:27:21 2005 +0000
    67.2 +++ b/xen/common/lib.c	Fri Feb 25 17:27:55 2005 +0000
    67.3 @@ -1,4 +1,3 @@
    67.4 -/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    67.5  
    67.6  #include <xen/ctype.h>
    67.7  #include <xen/lib.h>
    67.8 @@ -441,3 +440,12 @@ s64 __moddi3(s64 a, s64 b)
    67.9  }
   67.10  
   67.11  #endif /* BITS_PER_LONG == 32 */
   67.12 +
   67.13 +/*
   67.14 + * Local variables:
   67.15 + * mode: C
   67.16 + * c-set-style: "BSD"
   67.17 + * c-basic-offset: 8
   67.18 + * tab-width: 8
   67.19 + * indent-tabs-mode: t
   67.20 + */
    68.1 --- a/xen/common/multicall.c	Fri Feb 25 17:27:21 2005 +0000
    68.2 +++ b/xen/common/multicall.c	Fri Feb 25 17:27:55 2005 +0000
    68.3 @@ -1,4 +1,3 @@
    68.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    68.5  /******************************************************************************
    68.6   * multicall.c
    68.7   */
    68.8 @@ -80,3 +79,12 @@ long do_multicall(multicall_entry_t *cal
    68.9      mcs->flags = 0;
   68.10      return -EFAULT;
   68.11  }
   68.12 +
   68.13 +/*
   68.14 + * Local variables:
   68.15 + * mode: C
   68.16 + * c-set-style: "BSD"
   68.17 + * c-basic-offset: 4
   68.18 + * tab-width: 4
   68.19 + * indent-tabs-mode: nil
   68.20 + */
    69.1 --- a/xen/common/page_alloc.c	Fri Feb 25 17:27:21 2005 +0000
    69.2 +++ b/xen/common/page_alloc.c	Fri Feb 25 17:27:55 2005 +0000
    69.3 @@ -1,4 +1,3 @@
    69.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    69.5  /******************************************************************************
    69.6   * page_alloc.c
    69.7   * 
    69.8 @@ -608,3 +607,12 @@ unsigned long avail_domheap_pages(void)
    69.9  {
   69.10      return avail[MEMZONE_DOM];
   69.11  }
   69.12 +
   69.13 +/*
   69.14 + * Local variables:
   69.15 + * mode: C
   69.16 + * c-set-style: "BSD"
   69.17 + * c-basic-offset: 4
   69.18 + * tab-width: 4
   69.19 + * indent-tabs-mode: nil
   69.20 + */
    70.1 --- a/xen/common/perfc.c	Fri Feb 25 17:27:21 2005 +0000
    70.2 +++ b/xen/common/perfc.c	Fri Feb 25 17:27:55 2005 +0000
    70.3 @@ -1,4 +1,3 @@
    70.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    70.5  
    70.6  #include <xen/lib.h>
    70.7  #include <xen/smp.h>
    70.8 @@ -32,7 +31,7 @@ static struct {
    70.9  
   70.10  #define NR_PERFCTRS (sizeof(perfc_info) / sizeof(perfc_info[0]))
   70.11  
   70.12 -struct perfcounter_t perfcounters;
   70.13 +struct perfcounter perfcounters;
   70.14  
   70.15  void perfc_printall(unsigned char key)
   70.16  {
   70.17 @@ -221,3 +220,12 @@ int perfc_control(dom0_perfccontrol_t *p
   70.18  
   70.19      return rc;
   70.20  }
   70.21 +
   70.22 +/*
   70.23 + * Local variables:
   70.24 + * mode: C
   70.25 + * c-set-style: "BSD"
   70.26 + * c-basic-offset: 4
   70.27 + * tab-width: 4
   70.28 + * indent-tabs-mode: nil
   70.29 + */
    71.1 --- a/xen/common/physdev.c	Fri Feb 25 17:27:21 2005 +0000
    71.2 +++ b/xen/common/physdev.c	Fri Feb 25 17:27:55 2005 +0000
    71.3 @@ -1,5 +1,4 @@
    71.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    71.5 - ****************************************************************************
    71.6 +/****************************************************************************
    71.7   * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
    71.8   * (c) 2004 - Keir Fraser - University of Cambridge
    71.9   ****************************************************************************
   71.10 @@ -776,3 +775,12 @@ void physdev_init_dom0(struct domain *p)
   71.11      set_bit(DF_PHYSDEV, &p->d_flags);
   71.12  }
   71.13  
   71.14 +
   71.15 +/*
   71.16 + * Local variables:
   71.17 + * mode: C
   71.18 + * c-set-style: "BSD"
   71.19 + * c-basic-offset: 4
   71.20 + * tab-width: 4
   71.21 + * indent-tabs-mode: nil
   71.22 + */
    72.1 --- a/xen/common/resource.c	Fri Feb 25 17:27:21 2005 +0000
    72.2 +++ b/xen/common/resource.c	Fri Feb 25 17:27:55 2005 +0000
    72.3 @@ -1,4 +1,3 @@
    72.4 -/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    72.5  /*
    72.6   *	linux/kernel/resource.c
    72.7   *
    72.8 @@ -318,3 +317,12 @@ static int __init reserve_setup(char *st
    72.9  
   72.10  __setup("reserve=", reserve_setup);
   72.11  #endif
   72.12 +
   72.13 +/*
   72.14 + * Local variables:
   72.15 + * mode: C
   72.16 + * c-set-style: "BSD"
   72.17 + * c-basic-offset: 8
   72.18 + * tab-width: 8
   72.19 + * indent-tabs-mode: t
   72.20 + */
    73.1 --- a/xen/common/sched_atropos.c	Fri Feb 25 17:27:21 2005 +0000
    73.2 +++ b/xen/common/sched_atropos.c	Fri Feb 25 17:27:55 2005 +0000
    73.3 @@ -1,4 +1,3 @@
    73.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    73.5  /*
    73.6   * atropos.c
    73.7   * ---------
    73.8 @@ -684,3 +683,12 @@ struct scheduler sched_atropos_def = {
    73.9      .dump_cpu_state = at_dump_cpu_state,
   73.10      .prn_state      = at_prn_state,
   73.11  };
   73.12 +
   73.13 +/*
   73.14 + * Local variables:
   73.15 + * mode: C
   73.16 + * c-set-style: "BSD"
   73.17 + * c-basic-offset: 4
   73.18 + * tab-width: 4
   73.19 + * indent-tabs-mode: nil
   73.20 + */
    74.1 --- a/xen/common/sched_bvt.c	Fri Feb 25 17:27:21 2005 +0000
    74.2 +++ b/xen/common/sched_bvt.c	Fri Feb 25 17:27:55 2005 +0000
    74.3 @@ -1,5 +1,4 @@
    74.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    74.5 - ****************************************************************************
    74.6 +/****************************************************************************
    74.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    74.8   * (C) 2002-2003 University of Cambridge
    74.9   * (C) 2004      - Mark Williamson - Intel Research Cambridge
   74.10 @@ -589,3 +588,12 @@ struct scheduler sched_bvt_def = {
   74.11      .sleep          = bvt_sleep,
   74.12      .wake           = bvt_wake,
   74.13  };
   74.14 +
   74.15 +/*
   74.16 + * Local variables:
   74.17 + * mode: C
   74.18 + * c-set-style: "BSD"
   74.19 + * c-basic-offset: 4
   74.20 + * tab-width: 4
   74.21 + * indent-tabs-mode: nil
   74.22 + */
    75.1 --- a/xen/common/sched_rrobin.c	Fri Feb 25 17:27:21 2005 +0000
    75.2 +++ b/xen/common/sched_rrobin.c	Fri Feb 25 17:27:55 2005 +0000
    75.3 @@ -1,4 +1,3 @@
    75.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    75.5  /****************************************************************************
    75.6   * Round Robin Scheduler for Xen
    75.7   *
    75.8 @@ -216,3 +215,12 @@ struct scheduler sched_rrobin_def = {
    75.9  };
   75.10  
   75.11  
   75.12 +
   75.13 +/*
   75.14 + * Local variables:
   75.15 + * mode: C
   75.16 + * c-set-style: "BSD"
   75.17 + * c-basic-offset: 4
   75.18 + * tab-width: 4
   75.19 + * indent-tabs-mode: nil
   75.20 + */
    76.1 --- a/xen/common/schedule.c	Fri Feb 25 17:27:21 2005 +0000
    76.2 +++ b/xen/common/schedule.c	Fri Feb 25 17:27:55 2005 +0000
    76.3 @@ -1,5 +1,4 @@
    76.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    76.5 - ****************************************************************************
    76.6 +/****************************************************************************
    76.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    76.8   * (C) 2002-2003 University of Cambridge
    76.9   * (C) 2004      - Mark Williamson - Intel Research Cambridge
   76.10 @@ -633,3 +632,12 @@ void reset_sched_histo(unsigned char key
   76.11  void print_sched_histo(unsigned char key) { }
   76.12  void reset_sched_histo(unsigned char key) { }
   76.13  #endif
   76.14 +
   76.15 +/*
   76.16 + * Local variables:
   76.17 + * mode: C
   76.18 + * c-set-style: "BSD"
   76.19 + * c-basic-offset: 4
   76.20 + * tab-width: 4
   76.21 + * indent-tabs-mode: nil
   76.22 + */
    77.1 --- a/xen/common/softirq.c	Fri Feb 25 17:27:21 2005 +0000
    77.2 +++ b/xen/common/softirq.c	Fri Feb 25 17:27:55 2005 +0000
    77.3 @@ -1,4 +1,3 @@
    77.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    77.5  /******************************************************************************
    77.6   * common/softirq.c
    77.7   * 
    77.8 @@ -40,3 +39,12 @@ void open_softirq(int nr, softirq_handle
    77.9  {
   77.10      softirq_handlers[nr] = handler;
   77.11  }
   77.12 +
   77.13 +/*
   77.14 + * Local variables:
   77.15 + * mode: C
   77.16 + * c-set-style: "BSD"
   77.17 + * c-basic-offset: 4
   77.18 + * tab-width: 4
   77.19 + * indent-tabs-mode: nil
   77.20 + */
    78.1 --- a/xen/common/string.c	Fri Feb 25 17:27:21 2005 +0000
    78.2 +++ b/xen/common/string.c	Fri Feb 25 17:27:55 2005 +0000
    78.3 @@ -1,4 +1,3 @@
    78.4 -/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    78.5  /*
    78.6   *  linux/lib/string.c
    78.7   *
    78.8 @@ -558,3 +557,12 @@ void *memchr(const void *s, int c, size_
    78.9  }
   78.10  
   78.11  #endif
   78.12 +
   78.13 +/*
   78.14 + * Local variables:
   78.15 + * mode: C
   78.16 + * c-set-style: "BSD"
   78.17 + * c-basic-offset: 8
   78.18 + * tab-width: 8
   78.19 + * indent-tabs-mode: t
   78.20 + */
    79.1 --- a/xen/common/trace.c	Fri Feb 25 17:27:21 2005 +0000
    79.2 +++ b/xen/common/trace.c	Fri Feb 25 17:27:55 2005 +0000
    79.3 @@ -1,4 +1,3 @@
    79.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    79.5  /******************************************************************************
    79.6   * common/trace.c
    79.7   *
    79.8 @@ -121,3 +120,12 @@ int get_tb_info(dom0_gettbufs_t *st)
    79.9          return -ENODATA;
   79.10      }
   79.11  }
   79.12 +
   79.13 +/*
   79.14 + * Local variables:
   79.15 + * mode: C
   79.16 + * c-set-style: "BSD"
   79.17 + * c-basic-offset: 4
   79.18 + * tab-width: 4
   79.19 + * indent-tabs-mode: nil
   79.20 + */
    80.1 --- a/xen/common/vsprintf.c	Fri Feb 25 17:27:21 2005 +0000
    80.2 +++ b/xen/common/vsprintf.c	Fri Feb 25 17:27:55 2005 +0000
    80.3 @@ -1,4 +1,3 @@
    80.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    80.5  /*
    80.6   *  linux/lib/vsprintf.c
    80.7   *
    80.8 @@ -514,3 +513,12 @@ int sprintf(char * buf, const char *fmt,
    80.9      return i;
   80.10  }
   80.11  
   80.12 +
   80.13 +/*
   80.14 + * Local variables:
   80.15 + * mode: C
   80.16 + * c-set-style: "BSD"
   80.17 + * c-basic-offset: 4
   80.18 + * tab-width: 4
   80.19 + * indent-tabs-mode: nil
   80.20 + */
    81.1 --- a/xen/common/xmalloc.c	Fri Feb 25 17:27:21 2005 +0000
    81.2 +++ b/xen/common/xmalloc.c	Fri Feb 25 17:27:55 2005 +0000
    81.3 @@ -1,4 +1,3 @@
    81.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    81.5  /******************************************************************************
    81.6   * Simple allocator for Xen.  If larger than a page, simply use the
    81.7   * page-order allocator.
    81.8 @@ -200,3 +199,12 @@ void xfree(const void *p)
    81.9  
   81.10      spin_unlock_irqrestore(&freelist_lock, flags);
   81.11  }
   81.12 +
   81.13 +/*
   81.14 + * Local variables:
   81.15 + * mode: C
   81.16 + * c-set-style: "BSD"
   81.17 + * c-basic-offset: 4
   81.18 + * tab-width: 4
   81.19 + * indent-tabs-mode: nil
   81.20 + */
    82.1 --- a/xen/drivers/char/console.c	Fri Feb 25 17:27:21 2005 +0000
    82.2 +++ b/xen/drivers/char/console.c	Fri Feb 25 17:27:55 2005 +0000
    82.3 @@ -1,4 +1,3 @@
    82.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    82.5  /******************************************************************************
    82.6   * console.c
    82.7   * 
    82.8 @@ -633,3 +632,12 @@ void __out_of_line_bug(int line)
    82.9      BUG();
   82.10      for ( ; ; ) ;
   82.11  }
   82.12 +
   82.13 +/*
   82.14 + * Local variables:
   82.15 + * mode: C
   82.16 + * c-set-style: "BSD"
   82.17 + * c-basic-offset: 4
   82.18 + * tab-width: 4
   82.19 + * indent-tabs-mode: nil
   82.20 + */
    83.1 --- a/xen/drivers/char/serial.c	Fri Feb 25 17:27:21 2005 +0000
    83.2 +++ b/xen/drivers/char/serial.c	Fri Feb 25 17:27:55 2005 +0000
    83.3 @@ -1,4 +1,3 @@
    83.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    83.5  /******************************************************************************
    83.6   * serial.c
    83.7   * 
    83.8 @@ -479,3 +478,12 @@ void serial_force_unlock(int handle)
    83.9      if ( handle != -1 )
   83.10          uart->lock = SPIN_LOCK_UNLOCKED;
   83.11  }
   83.12 +
   83.13 +/*
   83.14 + * Local variables:
   83.15 + * mode: C
   83.16 + * c-set-style: "BSD"
   83.17 + * c-basic-offset: 4
   83.18 + * tab-width: 4
   83.19 + * indent-tabs-mode: nil
   83.20 + */
    84.1 --- a/xen/include/asm-ia64/domain.h	Fri Feb 25 17:27:21 2005 +0000
    84.2 +++ b/xen/include/asm-ia64/domain.h	Fri Feb 25 17:27:55 2005 +0000
    84.3 @@ -1,4 +1,3 @@
    84.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    84.5  #ifndef __ASM_DOMAIN_H__
    84.6  #define __ASM_DOMAIN_H__
    84.7  
    84.8 @@ -99,3 +98,12 @@ extern struct mm_struct init_mm;
    84.9  #include <asm/pgtable.h>
   84.10  
   84.11  #endif /* __ASM_DOMAIN_H__ */
   84.12 +
   84.13 +/*
   84.14 + * Local variables:
   84.15 + * mode: C
   84.16 + * c-set-style: "BSD"
   84.17 + * c-basic-offset: 4
   84.18 + * tab-width: 4
   84.19 + * indent-tabs-mode: nil
   84.20 + */
    85.1 --- a/xen/include/asm-x86/domain.h	Fri Feb 25 17:27:21 2005 +0000
    85.2 +++ b/xen/include/asm-x86/domain.h	Fri Feb 25 17:27:55 2005 +0000
    85.3 @@ -1,4 +1,3 @@
    85.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    85.5  
    85.6  #ifndef __ASM_DOMAIN_H__
    85.7  #define __ASM_DOMAIN_H__
    85.8 @@ -129,3 +128,12 @@ struct arch_exec_domain
    85.9  }
   85.10  
   85.11  #endif /* __ASM_DOMAIN_H__ */
   85.12 +
   85.13 +/*
   85.14 + * Local variables:
   85.15 + * mode: C
   85.16 + * c-set-style: "BSD"
   85.17 + * c-basic-offset: 4
   85.18 + * tab-width: 4
   85.19 + * indent-tabs-mode: nil
   85.20 + */
    86.1 --- a/xen/include/asm-x86/i387.h	Fri Feb 25 17:27:21 2005 +0000
    86.2 +++ b/xen/include/asm-x86/i387.h	Fri Feb 25 17:27:55 2005 +0000
    86.3 @@ -15,24 +15,17 @@
    86.4  #include <asm/processor.h>
    86.5  
    86.6  extern void init_fpu(void);
    86.7 -extern void save_init_fpu( struct exec_domain *tsk );
    86.8 -extern void restore_fpu( struct exec_domain *tsk );
    86.9 +extern void save_init_fpu(struct exec_domain *tsk);
   86.10 +extern void restore_fpu(struct exec_domain *tsk);
   86.11  
   86.12 -#define unlazy_fpu( tsk ) do { \
   86.13 -	if ( test_bit(EDF_USEDFPU, &tsk->ed_flags) ) \
   86.14 -		save_init_fpu( tsk ); \
   86.15 -} while (0)
   86.16 -
   86.17 -#define clear_fpu( tsk ) do { \
   86.18 -	if ( test_and_clear_bit(EDF_USEDFPU, &tsk->ed_flags) ) { \
   86.19 -		asm volatile("fwait"); \
   86.20 -		stts(); \
   86.21 -	} \
   86.22 -} while (0)
   86.23 +#define unlazy_fpu(_tsk) do { \
   86.24 +    if ( test_bit(EDF_USEDFPU, &(_tsk)->ed_flags) ) \
   86.25 +        save_init_fpu(_tsk); \
   86.26 +} while ( 0 )
   86.27  
   86.28  #define load_mxcsr( val ) do { \
   86.29 -        unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \
   86.30 -        asm volatile( "ldmxcsr %0" : : "m" (__mxcsr) ); \
   86.31 -} while (0)
   86.32 +    unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \
   86.33 +    __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
   86.34 +} while ( 0 )
   86.35  
   86.36  #endif /* __ASM_I386_I387_H */
    87.1 --- a/xen/include/asm-x86/ldt.h	Fri Feb 25 17:27:21 2005 +0000
    87.2 +++ b/xen/include/asm-x86/ldt.h	Fri Feb 25 17:27:55 2005 +0000
    87.3 @@ -1,4 +1,3 @@
    87.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    87.5  
    87.6  #ifndef __ARCH_LDT_H
    87.7  #define __ARCH_LDT_H
    87.8 @@ -29,3 +28,12 @@ static inline void load_LDT(struct exec_
    87.9  #endif /* !__ASSEMBLY__ */
   87.10  
   87.11  #endif
   87.12 +
   87.13 +/*
   87.14 + * Local variables:
   87.15 + * mode: C
   87.16 + * c-set-style: "BSD"
   87.17 + * c-basic-offset: 4
   87.18 + * tab-width: 4
   87.19 + * indent-tabs-mode: nil
   87.20 + */
    88.1 --- a/xen/include/asm-x86/page.h	Fri Feb 25 17:27:21 2005 +0000
    88.2 +++ b/xen/include/asm-x86/page.h	Fri Feb 25 17:27:55 2005 +0000
    88.3 @@ -1,4 +1,3 @@
    88.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    88.5  
    88.6  #ifndef __X86_PAGE_H__
    88.7  #define __X86_PAGE_H__
    88.8 @@ -146,3 +145,12 @@ map_pages(
    88.9  #endif /* !__ASSEMBLY__ */
   88.10  
   88.11  #endif /* __I386_PAGE_H__ */
   88.12 +
   88.13 +/*
   88.14 + * Local variables:
   88.15 + * mode: C
   88.16 + * c-set-style: "BSD"
   88.17 + * c-basic-offset: 4
   88.18 + * tab-width: 4
   88.19 + * indent-tabs-mode: nil
   88.20 + */
    89.1 --- a/xen/include/asm-x86/processor.h	Fri Feb 25 17:27:21 2005 +0000
    89.2 +++ b/xen/include/asm-x86/processor.h	Fri Feb 25 17:27:55 2005 +0000
    89.3 @@ -1,4 +1,3 @@
    89.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    89.5  
    89.6  /* Portions are: Copyright (c) 1994 Linus Torvalds */
    89.7  
    89.8 @@ -511,3 +510,12 @@ asmlinkage void fatal_trap(int trapnr, s
    89.9  #endif /* !__ASSEMBLY__ */
   89.10  
   89.11  #endif /* __ASM_X86_PROCESSOR_H */
   89.12 +
   89.13 +/*
   89.14 + * Local variables:
   89.15 + * mode: C
   89.16 + * c-set-style: "BSD"
   89.17 + * c-basic-offset: 4
   89.18 + * tab-width: 4
   89.19 + * indent-tabs-mode: nil
   89.20 + */
    90.1 --- a/xen/include/asm-x86/serial.h	Fri Feb 25 17:27:21 2005 +0000
    90.2 +++ b/xen/include/asm-x86/serial.h	Fri Feb 25 17:27:55 2005 +0000
    90.3 @@ -1,4 +1,3 @@
    90.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    90.5  
    90.6  #ifndef __ASM_X86_SERIAL_H__
    90.7  #define __ASM_X86_SERIAL_H__
    90.8 @@ -11,3 +10,12 @@
    90.9        (outb((_c), (_uart)->io_base + THR), 1) : 0 )
   90.10  
   90.11  #endif /* __ASM_X86_SERIAL_H__ */
   90.12 +
   90.13 +/*
   90.14 + * Local variables:
   90.15 + * mode: C
   90.16 + * c-set-style: "BSD"
   90.17 + * c-basic-offset: 4
   90.18 + * tab-width: 4
   90.19 + * indent-tabs-mode: nil
   90.20 + */
    91.1 --- a/xen/include/asm-x86/shadow.h	Fri Feb 25 17:27:21 2005 +0000
    91.2 +++ b/xen/include/asm-x86/shadow.h	Fri Feb 25 17:27:55 2005 +0000
    91.3 @@ -1,4 +1,3 @@
    91.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    91.5  
    91.6  #ifndef _XEN_SHADOW_H
    91.7  #define _XEN_SHADOW_H
    91.8 @@ -9,8 +8,9 @@
    91.9  #include <asm/processor.h>
   91.10  #include <asm/domain_page.h>
   91.11  
   91.12 -/* Shadow PT flag bits in pfn_info */
   91.13 +/* Shadow PT flag bits in shadow_status */
   91.14  #define PSH_shadowed    (1<<31) /* page has a shadow. PFN points to shadow */
   91.15 +#define PSH_hl2         (1<<30) /* page is an hl2 */
   91.16  #define PSH_pfn_mask    ((1<<21)-1)
   91.17  
   91.18  /* Shadow PT operation mode : shadow-mode variable in arch_domain. */
   91.19 @@ -44,6 +44,7 @@ extern void unshadow_table(unsigned long
   91.20  extern int shadow_mode_enable(struct domain *p, unsigned int mode);
   91.21  extern void free_shadow_state(struct domain *d);
   91.22  extern void shadow_invlpg(struct exec_domain *, unsigned long);
   91.23 +extern unsigned long mk_hl2_table(struct exec_domain *ed);
   91.24  
   91.25  extern void vmx_shadow_clear_state(struct domain *);
   91.26  
   91.27 @@ -68,7 +69,7 @@ extern unsigned long shadow_l2_table(
   91.28      struct domain *d, unsigned long gmfn);
   91.29    
   91.30  static inline void shadow_invalidate(struct exec_domain *ed) {
   91.31 -    if ( !shadow_mode_translate(ed->domain))
   91.32 +    if ( !VMX_DOMAIN(ed) )
   91.33          BUG();
   91.34      memset(ed->arch.shadow_vtable, 0, PAGE_SIZE);
   91.35  }
   91.36 @@ -118,29 +119,27 @@ struct shadow_status {
   91.37  static inline void __shadow_get_l2e(
   91.38      struct exec_domain *ed, unsigned long va, unsigned long *sl2e)
   91.39  {
   91.40 -    if ( likely(shadow_mode_enabled(ed->domain)) ) {
   91.41 -        if ( shadow_mode_translate(ed->domain) )
   91.42 -            *sl2e = l2_pgentry_val(
   91.43 -                ed->arch.shadow_vtable[l2_table_offset(va)]);       
   91.44 -        else 
   91.45 -            *sl2e = l2_pgentry_val(
   91.46 -                shadow_linear_l2_table[l2_table_offset(va)]);
   91.47 -    }
   91.48 -    else
   91.49 +    if ( !likely(shadow_mode_enabled(ed->domain)) )
   91.50          BUG();
   91.51 +
   91.52 +    if ( shadow_mode_translate(ed->domain) )
   91.53 +        *sl2e = l2_pgentry_val(
   91.54 +            ed->arch.shadow_vtable[l2_table_offset(va)]);       
   91.55 +    else 
   91.56 +        *sl2e = l2_pgentry_val(
   91.57 +            shadow_linear_l2_table[l2_table_offset(va)]);
   91.58  }
   91.59  
   91.60  static inline void __shadow_set_l2e(
   91.61      struct exec_domain *ed, unsigned long va, unsigned long value)
   91.62  {
   91.63 -    if ( likely(shadow_mode_enabled(ed->domain)) ) {
   91.64 -        if ( shadow_mode_translate(ed->domain) ) 
   91.65 -            ed->arch.shadow_vtable[l2_table_offset(va)] = mk_l2_pgentry(value);
   91.66 -        else 
   91.67 -            shadow_linear_l2_table[l2_table_offset(va)] = mk_l2_pgentry(value);
   91.68 -    }
   91.69 -    else
   91.70 +    if ( !likely(shadow_mode_enabled(ed->domain)) )
   91.71          BUG();
   91.72 +
   91.73 +    if ( shadow_mode_translate(ed->domain) ) 
   91.74 +        ed->arch.shadow_vtable[l2_table_offset(va)] = mk_l2_pgentry(value);
   91.75 +    else 
   91.76 +        shadow_linear_l2_table[l2_table_offset(va)] = mk_l2_pgentry(value);
   91.77  }
   91.78  
   91.79  static inline void __guest_get_l2e(
   91.80 @@ -279,7 +278,8 @@ static inline void l1pte_propagate_from_
   91.81      unsigned long old_spte = spte;
   91.82  #endif
   91.83  
   91.84 -    if ( shadow_mode_external(d) && mmio_space(gpte & 0xFFFFF000) ) {
   91.85 +    /* Use 1:1 page table to identify MMIO address space */
   91.86 +    if ( shadow_mode_external(d) && mmio_space(gpte) ) {
   91.87          *spte_p = 0;
   91.88          return;
   91.89      }
   91.90 @@ -347,8 +347,14 @@ static void shadow_audit(struct domain *
   91.91      for ( j = 0; j < shadow_ht_buckets; j++ )
   91.92      {
   91.93          a = &d->arch.shadow_ht[j];        
   91.94 -        if ( a->pfn ) { live++; ASSERT(a->smfn_and_flags & PSH_pfn_mask); }
   91.95 -        ASSERT(a->pfn < 0x00100000UL);
   91.96 +        if ( a->pfn )
   91.97 +        {
   91.98 +            live++;
   91.99 +            ASSERT(a->smfn_and_flags & PSH_pfn_mask);
  91.100 +        }
  91.101 +        else
  91.102 +            ASSERT(!a->next);
  91.103 +        ASSERT( (a->pfn & ~PSH_hl2) < 0x00100000UL);
  91.104          a = a->next;
  91.105          while ( a && (live < 9999) )
  91.106          { 
  91.107 @@ -359,7 +365,7 @@ static void shadow_audit(struct domain *
  91.108                         live, a->pfn, a->smfn_and_flags, a->next);
  91.109                  BUG();
  91.110              }
  91.111 -            ASSERT(a->pfn < 0x00100000UL);
  91.112 +            ASSERT( (a->pfn & ~PSH_hl2) < 0x00100000UL);
  91.113              ASSERT(a->smfn_and_flags & PSH_pfn_mask);
  91.114              a = a->next; 
  91.115          }
  91.116 @@ -369,15 +375,22 @@ static void shadow_audit(struct domain *
  91.117      for ( a = d->arch.shadow_ht_free; a != NULL; a = a->next )
  91.118          free++; 
  91.119  
  91.120 -    if ( print)
  91.121 +    if ( print )
  91.122          printk("Xlive=%d free=%d\n",live,free);
  91.123  
  91.124 -    abs = (perfc_value(shadow_l1_pages) + perfc_value(shadow_l2_pages)) - live;
  91.125 +    // BUG: this only works if there's only a single domain which is
  91.126 +    //      using shadow tables.
  91.127 +    //
  91.128 +    abs = ( perfc_value(shadow_l1_pages) +
  91.129 +            perfc_value(shadow_l2_pages) +
  91.130 +            perfc_value(hl2_table_pages) ) - live;
  91.131  #ifdef PERF_COUNTERS
  91.132      if ( (abs < -1) || (abs > 1) )
  91.133      {
  91.134 -        printk("live=%d free=%d l1=%d l2=%d\n",live,free,
  91.135 -               perfc_value(shadow_l1_pages), perfc_value(shadow_l2_pages) );
  91.136 +        printk("live=%d free=%d l1=%d l2=%d hl2=%d\n", live, free,
  91.137 +               perfc_value(shadow_l1_pages),
  91.138 +               perfc_value(shadow_l2_pages),
  91.139 +               perfc_value(hl2_table_pages));
  91.140          BUG();
  91.141      }
  91.142  #endif
  91.143 @@ -405,6 +418,8 @@ static inline unsigned long __shadow_sta
  91.144  {
  91.145      struct shadow_status *p, *x, *head;
  91.146  
  91.147 +    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  91.148 +
  91.149      x = head = hash_bucket(d, gpfn);
  91.150      p = NULL;
  91.151  
  91.152 @@ -570,7 +585,7 @@ static inline void set_shadow_status(
  91.153  
  91.154      ASSERT(spin_is_locked(&d->arch.shadow_lock));
  91.155      ASSERT(gpfn != 0);
  91.156 -    ASSERT(s & PSH_shadowed);
  91.157 +    ASSERT(s & (PSH_shadowed | PSH_hl2));
  91.158  
  91.159      x = head = hash_bucket(d, gpfn);
  91.160     
  91.161 @@ -658,7 +673,7 @@ static inline unsigned long gva_to_gpte(
  91.162      if (!(gpde & _PAGE_PRESENT))
  91.163          return 0;
  91.164  
  91.165 -    index = (gva >> L2_PAGETABLE_SHIFT);
  91.166 +    index = l2_table_offset(gva);
  91.167  
  91.168      if (!l2_pgentry_val(ed->arch.hl2_vtable[index])) {
  91.169          pfn = phys_to_machine_mapping(gpde >> PAGE_SHIFT);
  91.170 @@ -684,6 +699,14 @@ static inline unsigned long gva_to_gpa(u
  91.171      return (gpte & PAGE_MASK) + (gva & ~PAGE_MASK); 
  91.172  }
  91.173  
  91.174 +static inline void hl2_table_invalidate(struct exec_domain *ed)
  91.175 +{
  91.176 +    /*
  91.177 +     * Need to optimize this
  91.178 +     */
  91.179 +    memset(ed->arch.hl2_vtable, 0, PAGE_SIZE);
  91.180 +}
  91.181 +
  91.182  static inline void __update_pagetables(struct exec_domain *ed)
  91.183  {
  91.184      struct domain *d = ed->domain;
  91.185 @@ -698,63 +721,108 @@ static inline void __update_pagetables(s
  91.186  
  91.187      ed->arch.shadow_table = mk_pagetable(smfn<<PAGE_SHIFT);
  91.188  
  91.189 -    if  ( shadow_mode_translate(ed->domain) )
  91.190 +    if ( shadow_mode_translate(d) )
  91.191      {
  91.192 +        l2_pgentry_t *mpl2e = ed->arch.monitor_vtable;
  91.193          l2_pgentry_t *gpl2e, *spl2e;
  91.194 +        unsigned long hl2_status, hl2mfn, offset;
  91.195 +        int need_flush = 0;
  91.196  
  91.197          if ( ed->arch.guest_vtable )
  91.198              unmap_domain_mem(ed->arch.guest_vtable);
  91.199          if ( ed->arch.shadow_vtable )
  91.200              unmap_domain_mem(ed->arch.shadow_vtable);
  91.201 +        if ( ed->arch.hl2_vtable )
  91.202 +            unmap_domain_mem(ed->arch.hl2_vtable);
  91.203  
  91.204          gpl2e = ed->arch.guest_vtable =
  91.205              map_domain_mem(pagetable_val(ed->arch.guest_table));
  91.206          spl2e = ed->arch.shadow_vtable =
  91.207              map_domain_mem(pagetable_val(ed->arch.shadow_table));
  91.208  
  91.209 -        if ( shadow_mode_external(ed->domain ) )
  91.210 +        hl2_status = __shadow_status(d, gpfn | PSH_hl2);
  91.211 +        if ( unlikely(!(hl2_status & PSH_hl2)) )
  91.212 +            hl2_status = mk_hl2_table(ed);
  91.213 +
  91.214 +        hl2mfn = hl2_status & PSH_pfn_mask;
  91.215 +        ed->arch.hl2_vtable = map_domain_mem(hl2mfn << PAGE_SHIFT);
  91.216 +
  91.217 +        offset = l2_table_offset(LINEAR_PT_VIRT_START);
  91.218 +        if ( hl2mfn != (l2_pgentry_val(mpl2e[offset]) >> PAGE_SHIFT) )
  91.219          {
  91.220 -            l2_pgentry_t *mpl2e = ed->arch.monitor_vtable;
  91.221 -            unsigned long old_smfn;
  91.222 -            unsigned sh_l2offset = l2_table_offset(SH_LINEAR_PT_VIRT_START);
  91.223 -            
  91.224 -            old_smfn = l2_pgentry_val(mpl2e[sh_l2offset]) >> PAGE_SHIFT;
  91.225 -            if ( old_smfn != smfn )
  91.226 +            mpl2e[offset] =
  91.227 +                mk_l2_pgentry((hl2mfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
  91.228 +            need_flush = 1;
  91.229 +        }
  91.230 +
  91.231 +        if ( shadow_mode_external(d ) )
  91.232 +        {
  91.233 +            offset = l2_table_offset(SH_LINEAR_PT_VIRT_START);
  91.234 +            if ( smfn != (l2_pgentry_val(mpl2e[offset]) >> PAGE_SHIFT) )
  91.235              {
  91.236 -                mpl2e[sh_l2offset] =
  91.237 +                mpl2e[offset] =
  91.238                      mk_l2_pgentry((smfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
  91.239 -                local_flush_tlb();
  91.240 +                need_flush = 1;
  91.241              }
  91.242          }
  91.243  
  91.244 -        if ( ed->arch.arch_vmx.flags )
  91.245 +        if ( VMX_DOMAIN(ed) )
  91.246          {
  91.247              // Why is VMX mode doing this?
  91.248 -            memset(spl2e, 0, L2_PAGETABLE_ENTRIES * sizeof(l2_pgentry_t));
  91.249 +            shadow_invalidate(ed);
  91.250 +            hl2_table_invalidate(ed);
  91.251          }
  91.252 +
  91.253 +        if ( need_flush )
  91.254 +            local_flush_tlb();
  91.255      }
  91.256  }
  91.257  
  91.258  static inline void update_pagetables(struct exec_domain *ed)
  91.259  {
  91.260 -     if ( unlikely(shadow_mode_enabled(ed->domain)) )
  91.261 -     {
  91.262 -         shadow_lock(ed->domain);
  91.263 -         __update_pagetables(ed);
  91.264 -         shadow_unlock(ed->domain);
  91.265 -     }
  91.266 -     if ( !shadow_mode_external(ed->domain) )
  91.267 -     {
  91.268 +    struct domain *d = ed->domain;
  91.269 +    int paging_enabled =
  91.270 +#ifdef CONFIG_VMX
  91.271 +        !VMX_DOMAIN(ed) ||
  91.272 +        test_bit(VMX_CPU_STATE_PG_ENABLED, &ed->arch.arch_vmx.cpu_state);
  91.273 +#else
  91.274 +        1;
  91.275 +#endif
  91.276 +
  91.277 +    /*
  91.278 +     * We don't call __update_pagetables() when vmx guest paging is
  91.279 +     * disabled as we want the linear_pg_table to be inaccessible so that
  91.280 +     * we bail out early of shadow_fault() if the vmx guest tries illegal
  91.281 +     * accesses while it thinks paging is turned off.
  91.282 +     */
  91.283 +    if ( unlikely(shadow_mode_enabled(d)) && paging_enabled )
  91.284 +    {
  91.285 +        shadow_lock(d);
  91.286 +        __update_pagetables(ed);
  91.287 +        shadow_unlock(d);
  91.288 +    }
  91.289 +
  91.290 +    if ( !shadow_mode_external(d) )
  91.291 +    {
  91.292  #ifdef __x86_64__
  91.293 -         if ( !(ed->arch.flags & TF_kernel_mode) )
  91.294 -             ed->arch.monitor_table = ed->arch.guest_table_user;
  91.295 -         else
  91.296 +        if ( !(ed->arch.flags & TF_kernel_mode) )
  91.297 +            ed->arch.monitor_table = ed->arch.guest_table_user;
  91.298 +        else
  91.299  #endif
  91.300 -         if ( shadow_mode_enabled(ed->domain) )
  91.301 -             ed->arch.monitor_table = ed->arch.shadow_table;
  91.302 -         else
  91.303 -             ed->arch.monitor_table = ed->arch.guest_table;
  91.304 -     }
  91.305 +        if ( shadow_mode_enabled(d) )
  91.306 +            ed->arch.monitor_table = ed->arch.shadow_table;
  91.307 +        else
  91.308 +            ed->arch.monitor_table = ed->arch.guest_table;
  91.309 +    }
  91.310 +    else
  91.311 +    {
  91.312 +        // External page tables...
  91.313 +        // Allocate a monitor page table if we don't already have one.
  91.314 +        //
  91.315 +        if ( unlikely(!pagetable_val(ed->arch.monitor_table)) )
  91.316 +            ed->arch.monitor_table =
  91.317 +                mk_pagetable(alloc_monitor_pagetable(ed) << PAGE_SHIFT);
  91.318 +    }
  91.319  }
  91.320  
  91.321  #if SHADOW_DEBUG
  91.322 @@ -769,3 +837,12 @@ extern int _check_all_pagetables(struct 
  91.323  #endif
  91.324  
  91.325  #endif /* XEN_SHADOW_H */
  91.326 +
  91.327 +/*
  91.328 + * Local variables:
  91.329 + * mode: C
  91.330 + * c-set-style: "BSD"
  91.331 + * c-basic-offset: 4
  91.332 + * tab-width: 4
  91.333 + * indent-tabs-mode: nil
  91.334 + */
    92.1 --- a/xen/include/asm-x86/vmx.h	Fri Feb 25 17:27:21 2005 +0000
    92.2 +++ b/xen/include/asm-x86/vmx.h	Fri Feb 25 17:27:55 2005 +0000
    92.3 @@ -248,4 +248,9 @@ static inline int __vmxon (u64 addr)
    92.4          return -1;
    92.5      return 0;
    92.6  }
    92.7 +
    92.8 +#define TRC_VMX_VMEXIT 0x00040001
    92.9 +#define TRC_VMX_VECTOR 0x00040002
   92.10 +#define TRC_VMX_INT    0x00040003
   92.11 +
   92.12  #endif /* __ASM_X86_VMX_H__ */
    93.1 --- a/xen/include/asm-x86/vmx_platform.h	Fri Feb 25 17:27:21 2005 +0000
    93.2 +++ b/xen/include/asm-x86/vmx_platform.h	Fri Feb 25 17:27:55 2005 +0000
    93.3 @@ -68,8 +68,6 @@ struct instruction {
    93.4      __u32   flags; //
    93.5  };
    93.6  
    93.7 -#define VGA_SPACE_START   0xA0000
    93.8 -#define VGA_SPACE_END     0xC0000
    93.9  #define MAX_INST_LEN      32
   93.10  
   93.11  struct mi_per_cpu_info
   93.12 @@ -89,12 +87,6 @@ struct virutal_platform_def {
   93.13  extern void handle_mmio(unsigned long, unsigned long);
   93.14  extern int vmx_setup_platform(struct exec_domain *, execution_context_t *);
   93.15  
   93.16 -static inline int mmio_space(unsigned long gpa)
   93.17 -{
   93.18 -    if (gpa >= VGA_SPACE_START && gpa < VGA_SPACE_END) {
   93.19 -        return 1;
   93.20 -    }
   93.21 -    return 0;
   93.22 -}
   93.23 +#define mmio_space(gpa) (!phys_to_machine_mapping((gpa) >> PAGE_SHIFT))
   93.24  
   93.25  #endif
    94.1 --- a/xen/include/asm-x86/vmx_virpit.h	Fri Feb 25 17:27:21 2005 +0000
    94.2 +++ b/xen/include/asm-x86/vmx_virpit.h	Fri Feb 25 17:27:55 2005 +0000
    94.3 @@ -1,4 +1,3 @@
    94.4 -
    94.5  #ifndef _VMX_VIRPIT_H
    94.6  #define _VMX_VIRPIT_H
    94.7  #include <xen/config.h>
    94.8 @@ -25,6 +24,7 @@ struct vmx_virpit_t {
    94.9      unsigned int pending_intr_nr;	/* the couner for pending timer interrupts */
   94.10      unsigned long long inject_point;	/* the time inject virt intr */
   94.11      struct ac_timer pit_timer;		/* periodic timer for mode 2*/
   94.12 +    int first_injected;                 /* flag to prevent shadow window */
   94.13  
   94.14      /* virtual PIT state for handle related I/O */
   94.15      int read_state;
   94.16 @@ -40,42 +40,3 @@ struct vmx_virpit_t {
   94.17  extern void vmx_hooks_assist(struct exec_domain *d);
   94.18  
   94.19  #endif /* _VMX_VIRPIT_H_ */
   94.20 -
   94.21 -#ifndef _VMX_VIRPIT_H
   94.22 -#define _VMX_VIRPIT_H
   94.23 -#include <xen/config.h>
   94.24 -#include <xen/init.h>
   94.25 -#include <xen/lib.h>
   94.26 -#include <xen/time.h>
   94.27 -#include <xen/errno.h>
   94.28 -#include <xen/ac_timer.h>
   94.29 -#include <asm/vmx_vmcs.h>
   94.30 -
   94.31 -#define PIT_FREQ 1193181
   94.32 -
   94.33 -#define LSByte 0
   94.34 -#define MSByte 1
   94.35 -#define LSByte_multiple 2
   94.36 -#define MSByte_multiple 3
   94.37 -
   94.38 -struct vmx_virpit_t {
   94.39 -    /* for simulation of counter 0 in mode 2*/
   94.40 -    int vector;				/* the pit irq vector */
   94.41 -    unsigned int period;		/* the frequency. e.g. 10ms*/
   94.42 -    unsigned int channel;		/* the pit channel, counter 0~2 */
   94.43 -    unsigned long *intr_bitmap;
   94.44 -    unsigned int pending_intr_nr;	/* the couner for pending timer interrupts */
   94.45 -    unsigned long long inject_point;	/* the time inject virt intr */
   94.46 -    struct ac_timer pit_timer;		/* periodic timer for mode 2*/
   94.47 -
   94.48 -    /* virtual PIT state for handle related I/O */
   94.49 -    int read_state;
   94.50 -    int count_LSB_latched;
   94.51 -    int count_MSB_latched;
   94.52 -
   94.53 -    unsigned int count;		/* the 16 bit channel count */
   94.54 -    unsigned int init_val;	/* the init value for the counter */
   94.55 -
   94.56 -} ;
   94.57 -
   94.58 -#endif /* _VMX_VIRPIT_H_ */
    95.1 --- a/xen/include/asm-x86/vmx_vmcs.h	Fri Feb 25 17:27:21 2005 +0000
    95.2 +++ b/xen/include/asm-x86/vmx_vmcs.h	Fri Feb 25 17:27:55 2005 +0000
    95.3 @@ -1,4 +1,3 @@
    95.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    95.5  /*
    95.6   * vmx_vmcs.h: VMCS related definitions
    95.7   * Copyright (c) 2004, Intel Corporation.
    95.8 @@ -212,3 +211,12 @@ extern unsigned int opt_vmx_debug_level;
    95.9      } while (0)
   95.10  
   95.11  #endif /* ASM_X86_VMX_VMCS_H__ */
   95.12 +
   95.13 +/*
   95.14 + * Local variables:
   95.15 + * mode: C
   95.16 + * c-set-style: "BSD"
   95.17 + * c-basic-offset: 4
   95.18 + * tab-width: 4
   95.19 + * indent-tabs-mode: nil
   95.20 + */
    96.1 --- a/xen/include/asm-x86/x86_32/current.h	Fri Feb 25 17:27:21 2005 +0000
    96.2 +++ b/xen/include/asm-x86/x86_32/current.h	Fri Feb 25 17:27:55 2005 +0000
    96.3 @@ -1,4 +1,3 @@
    96.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    96.5  
    96.6  #ifndef _X86_CURRENT_H
    96.7  #define _X86_CURRENT_H
    96.8 @@ -55,3 +54,12 @@ static inline unsigned long get_stack_bo
    96.9  #define schedule_tail(_ed) ((_ed)->arch.schedule_tail)(_ed)
   96.10  
   96.11  #endif /* _X86_CURRENT_H */
   96.12 +
   96.13 +/*
   96.14 + * Local variables:
   96.15 + * mode: C
   96.16 + * c-set-style: "BSD"
   96.17 + * c-basic-offset: 4
   96.18 + * tab-width: 4
   96.19 + * indent-tabs-mode: nil
   96.20 + */
    97.1 --- a/xen/include/asm-x86/x86_32/page.h	Fri Feb 25 17:27:21 2005 +0000
    97.2 +++ b/xen/include/asm-x86/x86_32/page.h	Fri Feb 25 17:27:55 2005 +0000
    97.3 @@ -1,4 +1,3 @@
    97.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    97.5  
    97.6  #ifndef __X86_32_PAGE_H__
    97.7  #define __X86_32_PAGE_H__
    97.8 @@ -72,3 +71,12 @@ typedef l2_pgentry_t root_pgentry_t;
    97.9  #define L2_DISALLOW_MASK (7UL << 7)
   97.10  
   97.11  #endif /* __X86_32_PAGE_H__ */
   97.12 +
   97.13 +/*
   97.14 + * Local variables:
   97.15 + * mode: C
   97.16 + * c-set-style: "BSD"
   97.17 + * c-basic-offset: 4
   97.18 + * tab-width: 4
   97.19 + * indent-tabs-mode: nil
   97.20 + */
    98.1 --- a/xen/include/asm-x86/x86_64/current.h	Fri Feb 25 17:27:21 2005 +0000
    98.2 +++ b/xen/include/asm-x86/x86_64/current.h	Fri Feb 25 17:27:55 2005 +0000
    98.3 @@ -1,4 +1,3 @@
    98.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    98.5  
    98.6  #ifndef _X86_64_CURRENT_H
    98.7  #define _X86_64_CURRENT_H
    98.8 @@ -41,8 +40,9 @@ static inline execution_context_t *get_e
    98.9  static inline unsigned long get_stack_bottom(void)
   98.10  {
   98.11      unsigned long p;
   98.12 -    __asm__ ( "orq %%rsp,%0; andq $~7,%0" 
   98.13 -              : "=r" (p) : "0" (STACK_SIZE-64) );
   98.14 +    __asm__( "andq %%rsp,%0; addq %2,%0"
   98.15 +	    : "=r" (p)
   98.16 +	    : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-64) );
   98.17      return p;
   98.18  }
   98.19  
   98.20 @@ -54,3 +54,12 @@ static inline unsigned long get_stack_bo
   98.21  #define schedule_tail(_ed) ((_ed)->arch.schedule_tail)(_ed)
   98.22  
   98.23  #endif /* !(_X86_64_CURRENT_H) */
   98.24 +
   98.25 +/*
   98.26 + * Local variables:
   98.27 + * mode: C
   98.28 + * c-set-style: "BSD"
   98.29 + * c-basic-offset: 4
   98.30 + * tab-width: 4
   98.31 + * indent-tabs-mode: nil
   98.32 + */
    99.1 --- a/xen/include/asm-x86/x86_64/page.h	Fri Feb 25 17:27:21 2005 +0000
    99.2 +++ b/xen/include/asm-x86/x86_64/page.h	Fri Feb 25 17:27:55 2005 +0000
    99.3 @@ -1,4 +1,3 @@
    99.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    99.5  
    99.6  #ifndef __X86_64_PAGE_H__
    99.7  #define __X86_64_PAGE_H__
    99.8 @@ -99,3 +98,12 @@ typedef l4_pgentry_t root_pgentry_t;
    99.9  #define L4_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7))
   99.10  
   99.11  #endif /* __X86_64_PAGE_H__ */
   99.12 +
   99.13 +/*
   99.14 + * Local variables:
   99.15 + * mode: C
   99.16 + * c-set-style: "BSD"
   99.17 + * c-basic-offset: 4
   99.18 + * tab-width: 4
   99.19 + * indent-tabs-mode: nil
   99.20 + */
   100.1 --- a/xen/include/public/physdev.h	Fri Feb 25 17:27:21 2005 +0000
   100.2 +++ b/xen/include/public/physdev.h	Fri Feb 25 17:27:55 2005 +0000
   100.3 @@ -1,5 +1,4 @@
   100.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
   100.5 - ****************************************************************************
   100.6 +/****************************************************************************
   100.7   * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
   100.8   * (c) 2004 - Keir Fraser - University of Cambridge
   100.9   ****************************************************************************
  100.10 @@ -78,3 +77,12 @@ typedef struct _physdev_op_st
  100.11  } PACKED physdev_op_t; /* 40 bytes */
  100.12  
  100.13  #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
  100.14 +
  100.15 +/*
  100.16 + * Local variables:
  100.17 + * mode: C
  100.18 + * c-set-style: "BSD"
  100.19 + * c-basic-offset: 4
  100.20 + * tab-width: 4
  100.21 + * indent-tabs-mode: nil
  100.22 + */
   101.1 --- a/xen/include/xen/ac_timer.h	Fri Feb 25 17:27:21 2005 +0000
   101.2 +++ b/xen/include/xen/ac_timer.h	Fri Feb 25 17:27:55 2005 +0000
   101.3 @@ -1,5 +1,4 @@
   101.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
   101.5 - ****************************************************************************
   101.6 +/****************************************************************************
   101.7   * (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
   101.8   ****************************************************************************
   101.9   *
  101.10 @@ -89,3 +88,12 @@ extern void mod_ac_timer(struct ac_timer
  101.11  extern int reprogram_ac_timer(s_time_t timeout);
  101.12  
  101.13  #endif /* _AC_TIMER_H_ */
  101.14 +
  101.15 +/*
  101.16 + * Local variables:
  101.17 + * mode: C
  101.18 + * c-set-style: "BSD"
  101.19 + * c-basic-offset: 4
  101.20 + * tab-width: 4
  101.21 + * indent-tabs-mode: nil
  101.22 + */
   102.1 --- a/xen/include/xen/domain.h	Fri Feb 25 17:27:21 2005 +0000
   102.2 +++ b/xen/include/xen/domain.h	Fri Feb 25 17:27:55 2005 +0000
   102.3 @@ -27,4 +27,6 @@ extern void domain_relinquish_memory(str
   102.4  
   102.5  extern void dump_pageframe_info(struct domain *d);
   102.6  
   102.7 +extern unsigned long alloc_monitor_pagetable(struct exec_domain *ed);
   102.8 +
   102.9  #endif /* __XEN_DOMAIN_H__ */
   103.1 --- a/xen/include/xen/lib.h	Fri Feb 25 17:27:21 2005 +0000
   103.2 +++ b/xen/include/xen/lib.h	Fri Feb 25 17:27:55 2005 +0000
   103.3 @@ -23,6 +23,8 @@
   103.4  #define SWAP(_a, _b) \
   103.5     do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
   103.6  
   103.7 +#define DIV_ROUND(x, y) (((x) + (y) - 1) / (y))
   103.8 +
   103.9  #define reserve_bootmem(_p,_l) ((void)0)
  103.10  
  103.11  struct domain;
   104.1 --- a/xen/include/xen/perfc.h	Fri Feb 25 17:27:21 2005 +0000
   104.2 +++ b/xen/include/xen/perfc.h	Fri Feb 25 17:27:55 2005 +0000
   104.3 @@ -46,12 +46,11 @@
   104.4  #define PERFSTATUS_ARRAY( var, name, size ) \
   104.5    atomic_t var[size];
   104.6  
   104.7 -struct perfcounter_t 
   104.8 -{
   104.9 +struct perfcounter {
  104.10  #include <xen/perfc_defn.h>
  104.11  };
  104.12  
  104.13 -extern struct perfcounter_t perfcounters;
  104.14 +extern struct perfcounter perfcounters;
  104.15  
  104.16  #define perfc_value(x)    atomic_read(&perfcounters.x[0])
  104.17  #define perfc_valuec(x)   atomic_read(&perfcounters.x[smp_processor_id()])
   105.1 --- a/xen/include/xen/perfc_defn.h	Fri Feb 25 17:27:21 2005 +0000
   105.2 +++ b/xen/include/xen/perfc_defn.h	Fri Feb 25 17:27:55 2005 +0000
   105.3 @@ -31,6 +31,7 @@ PERFCOUNTER_CPU( shadow_update_va_fail2,
   105.4  /* STATUS counters do not reset when 'P' is hit */
   105.5  PERFSTATUS( shadow_l2_pages, "current # shadow L2 pages" )
   105.6  PERFSTATUS( shadow_l1_pages, "current # shadow L1 pages" )
   105.7 +PERFSTATUS( hl2_table_pages, "current # hl2 pages" )
   105.8  
   105.9  PERFCOUNTER_CPU( check_pagetable, "calls to check_pagetable" )
  105.10  PERFCOUNTER_CPU( check_all_pagetables, "calls to check_all_pagetables" )
   106.1 --- a/xen/include/xen/sched.h	Fri Feb 25 17:27:21 2005 +0000
   106.2 +++ b/xen/include/xen/sched.h	Fri Feb 25 17:27:55 2005 +0000
   106.3 @@ -1,4 +1,3 @@
   106.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
   106.5  
   106.6  #ifndef __SCHED_H__
   106.7  #define __SCHED_H__
   106.8 @@ -402,3 +401,12 @@ static inline void domain_unpause_by_sys
   106.9  
  106.10  
  106.11  #endif /* __SCHED_H__ */
  106.12 +
  106.13 +/*
  106.14 + * Local variables:
  106.15 + * mode: C
  106.16 + * c-set-style: "BSD"
  106.17 + * c-basic-offset: 4
  106.18 + * tab-width: 4
  106.19 + * indent-tabs-mode: nil
  106.20 + */
   107.1 --- a/xen/include/xen/serial.h	Fri Feb 25 17:27:21 2005 +0000
   107.2 +++ b/xen/include/xen/serial.h	Fri Feb 25 17:27:55 2005 +0000
   107.3 @@ -1,4 +1,3 @@
   107.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
   107.5  /******************************************************************************
   107.6   * serial.h
   107.7   * 
   107.8 @@ -52,3 +51,12 @@ unsigned char irq_serial_getc(int handle
   107.9  void serial_force_unlock(int handle);
  107.10  
  107.11  #endif /* __XEN_SERIAL_H__ */
  107.12 +
  107.13 +/*
  107.14 + * Local variables:
  107.15 + * mode: C
  107.16 + * c-set-style: "BSD"
  107.17 + * c-basic-offset: 4
  107.18 + * tab-width: 4
  107.19 + * indent-tabs-mode: nil
  107.20 + */
   108.1 --- a/xen/include/xen/time.h	Fri Feb 25 17:27:21 2005 +0000
   108.2 +++ b/xen/include/xen/time.h	Fri Feb 25 17:27:55 2005 +0000
   108.3 @@ -1,5 +1,4 @@
   108.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
   108.5 - ****************************************************************************
   108.6 +/****************************************************************************
   108.7   * (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
   108.8   ****************************************************************************
   108.9   *
  108.10 @@ -60,3 +59,12 @@ extern void do_settime(unsigned long sec
  108.11                         u64 system_time_base);
  108.12  
  108.13  #endif /* __XEN_TIME_H__ */
  108.14 +
  108.15 +/*
  108.16 + * Local variables:
  108.17 + * mode: C
  108.18 + * c-set-style: "BSD"
  108.19 + * c-basic-offset: 4
  108.20 + * tab-width: 4
  108.21 + * indent-tabs-mode: nil
  108.22 + */