direct-io.hg

changeset 3280:dda5ab69e74a

bitkeeper revision 1.1159.1.477 (41bf20d2wgoxIqhcE0nzBC8W-yFPhg)

sync w/ head.
author cl349@arcadians.cl.cam.ac.uk
date Tue Dec 14 17:20:18 2004 +0000 (2004-12-14)
parents 510e8b6f4fae 90394f6cfd34
children eb8866af6c4b
files .rootkeys linux-2.6.9-xen-sparse/arch/xen/i386/kernel/traps.c tools/libxc/xc.h tools/libxc/xc_linux_save.c xen/Makefile xen/arch/x86/boot/x86_64.S xen/arch/x86/domain.c xen/arch/x86/setup.c xen/arch/x86/smpboot.c xen/arch/x86/traps.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/xen.lds xen/common/domain.c xen/common/physdev.c xen/include/asm-x86/asm_defns.h xen/include/asm-x86/domain.h xen/include/asm-x86/irq.h xen/include/asm-x86/multicall.h xen/include/asm-x86/processor.h xen/include/asm-x86/system.h xen/include/asm-x86/uaccess.h xen/include/asm-x86/x86_32/asm_defns.h xen/include/asm-x86/x86_32/current.h xen/include/asm-x86/x86_32/uaccess.h xen/include/asm-x86/x86_64/asm_defns.h xen/include/asm-x86/x86_64/current.h xen/include/asm-x86/x86_64/uaccess.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/trace.h xen/include/xen/domain.h xen/include/xen/sched.h
line diff
     1.1 --- a/.rootkeys	Fri Dec 10 19:56:39 2004 +0000
     1.2 +++ b/.rootkeys	Tue Dec 14 17:20:18 2004 +0000
     1.3 @@ -705,7 +705,9 @@ 3ddb79bcHwuCQDjBICDTSis52hWguw xen/arch/
     1.4  40f92331jfOlE7MfKwpdkEb1CEf23g xen/arch/x86/x86_32/seg_fixup.c
     1.5  3ddb79bc4nTpGQOe6_-MbyZzkhlhFQ xen/arch/x86/x86_32/usercopy.c
     1.6  3ddb79bcOMCu9-5mKpjIh5d0qqBDPg xen/arch/x86/x86_32/xen.lds
     1.7 +41bf1717Ty3hwN3E9swdu8QfnvGqww xen/arch/x86/x86_64/asm-offsets.c
     1.8  40e96d3aLDI-nViMuYneD7VKYlZrVg xen/arch/x86/x86_64/entry.S
     1.9 +41bf1717XhPz_dNT5OKSjgmbFuWBuA xen/arch/x86/x86_64/mm.c
    1.10  40e96d3ahBTZqbTViInnq0lM03vs7A xen/arch/x86/x86_64/usercopy.c
    1.11  40e96d3akN3Hu_J5Bk-WXD8OGscrYQ xen/arch/x86/x86_64/xen.lds
    1.12  3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/common/Makefile
    1.13 @@ -793,6 +795,7 @@ 40715b2d1yZkqyAt0kgx2xEwsatuuA xen/inclu
    1.14  40715b2dWe0tDhx9LkLXzTQkvD49RA xen/include/asm-x86/acpi.h
    1.15  3ddb79c3l4IiQtf6MS2jIzcd-hJS8g xen/include/asm-x86/apic.h
    1.16  3ddb79c3QJYWr8LLGdonLbWmNb9pQQ xen/include/asm-x86/apicdef.h
    1.17 +41bf17171g_hhz2k4B-fN9LQlODDjQ xen/include/asm-x86/asm_defns.h
    1.18  3ddb79c3OiG9eTsi9Dy3F_OkuRAzKA xen/include/asm-x86/atomic.h
    1.19  3ddb79c3rM-Ote0Xn6Ytg8Y6YqAG-A xen/include/asm-x86/bitops.h
    1.20  3ddb79c3KhTI0F_Iw_hRL9QEyOVK-g xen/include/asm-x86/cache.h
    1.21 @@ -804,7 +807,6 @@ 3ddb79c2jFkPAZTDmU35L6IUssYMgQ xen/inclu
    1.22  3ddb79c3r9-31dIsewPV3P3i8HALsQ xen/include/asm-x86/delay.h
    1.23  3ddb79c34BFiXjBJ_cCKB0aCsV1IDw xen/include/asm-x86/desc.h
    1.24  40715b2dTokMLYGSuD58BnxOqyWVew xen/include/asm-x86/div64.h
    1.25 -40f2b4a2hC3HtChu-ArD8LyojxWMjg xen/include/asm-x86/domain.h
    1.26  3e20b82fl1jmQiKdLy7fxMcutfpjWA xen/include/asm-x86/domain_page.h
    1.27  3ddb79c3NU8Zy40OTrq3D-i30Y3t4A xen/include/asm-x86/fixmap.h
    1.28  3e2d29944GI24gf7vOP_7x8EyuqxeA xen/include/asm-x86/flushtlb.h
    1.29 @@ -840,6 +842,7 @@ 3ddb79c2ADvRmdexd9y3AYK9_NTx-Q xen/inclu
    1.30  3ddb79c3mbqEM7QQr3zVq7NiBNhouA xen/include/asm-x86/x86_32/regs.h
    1.31  3e7f358aG11EvMI9VJ4_9hD4LUO7rQ xen/include/asm-x86/x86_32/string.h
    1.32  3ddb79c3M2n1ROZH6xk3HbyN4CPDqg xen/include/asm-x86/x86_32/uaccess.h
    1.33 +41bf1717bML6GxpclTWJabiaO5W5vg xen/include/asm-x86/x86_64/asm_defns.h
    1.34  404f1b9ceJeGVaPNIENm2FkK0AgEOQ xen/include/asm-x86/x86_64/current.h
    1.35  404f1b9fl6AQ_a-T1TDK3fuwTPXmHw xen/include/asm-x86/x86_64/desc.h
    1.36  404f1badfXZJZ2sU8sh9PS2EZvd19Q xen/include/asm-x86/x86_64/ldt.h
    1.37 @@ -867,6 +870,7 @@ 3ddb79c259jh8hE7vre_8NuE7nwNSA xen/inclu
    1.38  3eb165e0eawr3R-p2ZQtSdLWtLRN_A xen/include/xen/console.h
    1.39  3ddb79c1V44RD26YqCUm-kqIupM37A xen/include/xen/ctype.h
    1.40  3ddb79c05DdHQ0UxX_jKsXdR4QlMCA xen/include/xen/delay.h
    1.41 +40f2b4a2hC3HtChu-ArD8LyojxWMjg xen/include/xen/domain.h
    1.42  3ddb79c2O729EttZTYu1c8LcsUO_GQ xen/include/xen/elf.h
    1.43  3ddb79c0HIghfBF8zFUdmXhOU8i6hA xen/include/xen/errno.h
    1.44  3ddb79c1W0lQca8gRV7sN6j3iY4Luw xen/include/xen/event.h
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/traps.c	Fri Dec 10 19:56:39 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/traps.c	Tue Dec 14 17:20:18 2004 +0000
     2.3 @@ -1056,7 +1056,6 @@ void __init trap_init(void)
     2.4  	 * default LDT is a single-entry callgate to lcall7 for iBCS
     2.5  	 * and a callgate to lcall27 for Solaris/x86 binaries
     2.6  	 */
     2.7 -	clear_page(&default_ldt[0]);
     2.8  	set_call_gate(&default_ldt[0],lcall7);
     2.9  	set_call_gate(&default_ldt[4],lcall27);
    2.10  	make_lowmem_page_readonly(&default_ldt[0]);
     3.1 --- a/tools/libxc/xc.h	Fri Dec 10 19:56:39 2004 +0000
     3.2 +++ b/tools/libxc/xc.h	Tue Dec 14 17:20:18 2004 +0000
     3.3 @@ -9,14 +9,15 @@
     3.4  #ifndef __XC_H__
     3.5  #define __XC_H__
     3.6  
     3.7 -typedef unsigned char      u8;
     3.8 -typedef unsigned short     u16;
     3.9 -typedef unsigned long      u32;
    3.10 -typedef unsigned long long u64;
    3.11 -typedef signed char        s8;
    3.12 -typedef signed short       s16;
    3.13 -typedef signed long        s32;
    3.14 -typedef signed long long   s64;
    3.15 +#include <stdint.h>
    3.16 +typedef uint8_t            u8;
    3.17 +typedef uint16_t           u16;
    3.18 +typedef uint32_t           u32;
    3.19 +typedef uint64_t           u64;
    3.20 +typedef int8_t             s8;
    3.21 +typedef int16_t            s16;
    3.22 +typedef int32_t            s32;
    3.23 +typedef int64_t            s64;
    3.24  
    3.25  #include <xen/xen.h>
    3.26  #include <xen/dom0_ops.h>
     4.1 --- a/tools/libxc/xc_linux_save.c	Fri Dec 10 19:56:39 2004 +0000
     4.2 +++ b/tools/libxc/xc_linux_save.c	Tue Dec 14 17:20:18 2004 +0000
     4.3 @@ -6,6 +6,7 @@
     4.4   * Copyright (c) 2003, K A Fraser.
     4.5   */
     4.6  
     4.7 +#include <inttypes.h>
     4.8  #include <sys/time.h>
     4.9  #include "xc_private.h"
    4.10  #include <xen/linux/suspend.h>
    4.11 @@ -245,7 +246,7 @@ static int print_stats( int xc_handle, u
    4.12  
    4.13      if ( print )
    4.14          printf("delta %lldms, dom0 %d%%, target %d%%, sent %dMb/s, "
    4.15 -               "dirtied %dMb/s %ld pages\n",
    4.16 +               "dirtied %dMb/s %" PRId32 " pages\n",
    4.17                 wall_delta, 
    4.18                 (int)((d0_cpu_delta*100)/wall_delta),
    4.19                 (int)((d1_cpu_delta*100)/wall_delta),
    4.20 @@ -307,8 +308,8 @@ static int analysis_phase( int xc_handle
    4.21                                 DOM0_SHADOW_CONTROL_OP_PEEK,
    4.22                                 NULL, 0, &stats);
    4.23  
    4.24 -            printf("now= %lld faults= %ld dirty= %ld dirty_net= %ld "
    4.25 -                   "dirty_block= %ld\n", 
    4.26 +            printf("now= %lld faults= %" PRId32 " dirty= %" PRId32
    4.27 +                   " dirty_net= %" PRId32 " dirty_block= %" PRId32"\n", 
    4.28                     ((now-start)+500)/1000, 
    4.29                     stats.fault_count, stats.dirty_count,
    4.30                     stats.dirty_net_count, stats.dirty_block_count);
     5.1 --- a/xen/Makefile	Fri Dec 10 19:56:39 2004 +0000
     5.2 +++ b/xen/Makefile	Tue Dec 14 17:20:18 2004 +0000
     5.3 @@ -1,9 +1,9 @@
     5.4  
     5.5  # This is the correct place to edit the build version.
     5.6  # All other places this is stored (eg. compile.h) should be autogenerated.
     5.7 -export XEN_VERSION       = 2
     5.8 +export XEN_VERSION       = 3
     5.9  export XEN_SUBVERSION    = 0
    5.10 -export XEN_EXTRAVERSION  = ""
    5.11 +export XEN_EXTRAVERSION  = "-devel"
    5.12  
    5.13  export BASEDIR          := $(shell pwd)
    5.14  
     6.1 --- a/xen/arch/x86/boot/x86_64.S	Fri Dec 10 19:56:39 2004 +0000
     6.2 +++ b/xen/arch/x86/boot/x86_64.S	Tue Dec 14 17:20:18 2004 +0000
     6.3 @@ -257,30 +257,22 @@ copy_to_user:
     6.4  set_intr_gate:
     6.5  die:
     6.6  machine_to_phys_mapping:
     6.7 -.globl copy_from_user, show_registers, __set_fixmap, do_iopl, check_descriptor
     6.8 +.globl copy_from_user, show_registers, do_iopl
     6.9  copy_from_user: 
    6.10  show_registers: 
    6.11 -__set_fixmap: 
    6.12  do_iopl: 
    6.13 -check_descriptor:
    6.14 -.globl set_gdt, idt_table, copy_user_generic, memcmp, idt_tables, new_thread
    6.15 -set_gdt:
    6.16 +.globl idt_table, copy_user_generic, memcmp, idt_tables, new_thread
    6.17  idt_table:
    6.18  copy_user_generic:
    6.19  memcmp:
    6.20  idt_tables:
    6.21  new_thread:
    6.22 -.globl switch_to, continue_nonidle_task, __get_user_1, paging_init, trap_init
    6.23 +.globl switch_to, __get_user_1, __get_user_4, __get_user_8, trap_init
    6.24  switch_to:
    6.25 -continue_nonidle_task:
    6.26  __get_user_1:
    6.27 -paging_init:
    6.28 +__get_user_4:
    6.29 +__get_user_8:
    6.30  trap_init: 
    6.31 -.globl __get_user_8, zap_low_mappings, set_debugreg,synchronise_pagetables
    6.32 -__get_user_8:
    6.33 -zap_low_mappings:
    6.34 +.globl set_debugreg
    6.35  set_debugreg:
    6.36 -synchronise_pagetables:
    6.37 -.globl destroy_gdt
    6.38 -destroy_gdt:    
    6.39          
     7.1 --- a/xen/arch/x86/domain.c	Fri Dec 10 19:56:39 2004 +0000
     7.2 +++ b/xen/arch/x86/domain.c	Tue Dec 14 17:20:18 2004 +0000
     7.3 @@ -48,35 +48,16 @@
     7.4  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
     7.5  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
     7.6  
     7.7 -int hlt_counter;
     7.8 -
     7.9 -void disable_hlt(void)
    7.10 +static void default_idle(void)
    7.11  {
    7.12 -    hlt_counter++;
    7.13 -}
    7.14 -
    7.15 -void enable_hlt(void)
    7.16 -{
    7.17 -    hlt_counter--;
    7.18 +    __cli();
    7.19 +    if ( !softirq_pending(smp_processor_id()) )
    7.20 +        safe_halt();
    7.21 +    else
    7.22 +        __sti();
    7.23  }
    7.24  
    7.25 -/*
    7.26 - * We use this if we don't have any better
    7.27 - * idle routine..
    7.28 - */
    7.29 -static void default_idle(void)
    7.30 -{
    7.31 -    if ( hlt_counter == 0 )
    7.32 -    {
    7.33 -        __cli();
    7.34 -        if ( !softirq_pending(smp_processor_id()) )
    7.35 -            safe_halt();
    7.36 -        else
    7.37 -            __sti();
    7.38 -    }
    7.39 -}
    7.40 -
    7.41 -void continue_cpu_idle_loop(void)
    7.42 +static void idle_loop(void)
    7.43  {
    7.44      int cpu = smp_processor_id();
    7.45      for ( ; ; )
    7.46 @@ -102,7 +83,7 @@ void startup_cpu_idle_loop(void)
    7.47      smp_mb();
    7.48      init_idle();
    7.49  
    7.50 -    continue_cpu_idle_loop();
    7.51 +    idle_loop();
    7.52  }
    7.53  
    7.54  static long no_idt[2];
    7.55 @@ -216,23 +197,43 @@ void free_perdomain_pt(struct domain *d)
    7.56      free_xenheap_page((unsigned long)d->mm_perdomain_pt);
    7.57  }
    7.58  
    7.59 -void arch_do_createdomain(struct exec_domain *ed)
    7.60 +static void continue_idle_task(struct domain *d)
    7.61 +{
    7.62 +    reset_stack_and_jump(idle_loop);
    7.63 +}
    7.64 +
    7.65 +static void continue_nonidle_task(struct domain *d)
    7.66 +{
    7.67 +    reset_stack_and_jump(ret_from_intr);
    7.68 +}
    7.69 +
    7.70  {
    7.71      struct domain *d = ed->domain;
    7.72 -    d->shared_info = (void *)alloc_xenheap_page();
    7.73 -    memset(d->shared_info, 0, PAGE_SIZE);
    7.74 -    ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
    7.75 -    d->shared_info->arch.mfn_to_pfn_start = 
    7.76 -	virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT;
    7.77 -    SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
    7.78 -    machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
    7.79 -                           PAGE_SHIFT] = INVALID_P2M_ENTRY;
    7.80 +#ifdef ARCH_HAS_FAST_TRAP
    7.81 +    SET_DEFAULT_FAST_TRAP(&d->thread);
    7.82 +#endif
    7.83  
    7.84 -    d->mm_perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page();
    7.85 -    memset(d->mm_perdomain_pt, 0, PAGE_SIZE);
    7.86 -    machine_to_phys_mapping[virt_to_phys(d->mm_perdomain_pt) >> 
    7.87 -                           PAGE_SHIFT] = INVALID_P2M_ENTRY;
    7.88 -    ed->mm.perdomain_ptes = d->mm_perdomain_pt;
    7.89 +    if ( d->id == IDLE_DOMAIN_ID )
    7.90 +    {
    7.91 +        d->thread.schedule_tail = continue_idle_task;
    7.92 +    }
    7.93 +    else
    7.94 +    {
    7.95 +        d->thread.schedule_tail = continue_nonidle_task;
    7.96 +
    7.97 +        d->shared_info = (void *)alloc_xenheap_page();
    7.98 +        memset(d->shared_info, 0, PAGE_SIZE);
    7.99 +        ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
   7.100 +        d->shared_info->arch.mfn_to_pfn_start = 
   7.101 +            virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT;
   7.102 +        SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
   7.103 +        machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
   7.104 +                               PAGE_SHIFT] = INVALID_P2M_ENTRY;
   7.105 +
   7.106 +        d->mm_perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page();
   7.107 +        memset(d->mm_perdomain_pt, 0, PAGE_SIZE);
   7.108 +        machine_to_phys_mapping[virt_to_phys(d->mm_perdomain_pt) >> 
   7.109 +                               PAGE_SHIFT] = INVALID_P2M_ENTRY;
   7.110  }
   7.111  
   7.112  int arch_final_setup_guestos(struct exec_domain *d, full_execution_context_t *c)
   7.113 @@ -270,7 +271,6 @@ int arch_final_setup_guestos(struct exec
   7.114             sizeof(d->thread.traps));
   7.115  
   7.116  #ifdef ARCH_HAS_FAST_TRAP
   7.117 -    SET_DEFAULT_FAST_TRAP(&d->thread);
   7.118      if ( (rc = (int)set_fast_trap(d, c->fast_trap_idx)) != 0 )
   7.119          return rc;
   7.120  #endif
   7.121 @@ -335,9 +335,6 @@ void new_thread(struct exec_domain *d,
   7.122  
   7.123      __save_flags(ec->eflags);
   7.124      ec->eflags |= X86_EFLAGS_IF;
   7.125 -
   7.126 -    /* No fast trap at start of day. */
   7.127 -    SET_DEFAULT_FAST_TRAP(&d->thread);
   7.128  }
   7.129  
   7.130  
   7.131 @@ -434,6 +431,8 @@ long do_iopl(domid_t domain, unsigned in
   7.132      return 0;
   7.133  }
   7.134  
   7.135 +#endif
   7.136 +
   7.137  unsigned long hypercall_create_continuation(
   7.138      unsigned int op, unsigned int nr_args, ...)
   7.139  {
   7.140 @@ -455,11 +454,15 @@ unsigned long hypercall_create_continuat
   7.141      else
   7.142      {
   7.143          ec       = get_execution_context();
   7.144 +#if defined(__i386__)
   7.145          ec->eax  = op;
   7.146          ec->eip -= 2;  /* re-execute 'int 0x82' */
   7.147          
   7.148          for ( i = 0, preg = &ec->ebx; i < nr_args; i++, preg++ )
   7.149              *preg = va_arg(args, unsigned long);
   7.150 +#else
   7.151 +        preg = NULL; /* XXX x86/64 */
   7.152 +#endif
   7.153      }
   7.154  
   7.155      va_end(args);
   7.156 @@ -467,9 +470,6 @@ unsigned long hypercall_create_continuat
   7.157      return op;
   7.158  }
   7.159  
   7.160 -#endif
   7.161 -
   7.162 -
   7.163  static void relinquish_list(struct domain *d, struct list_head *list)
   7.164  {
   7.165      struct list_head *ent;
     8.1 --- a/xen/arch/x86/setup.c	Fri Dec 10 19:56:39 2004 +0000
     8.2 +++ b/xen/arch/x86/setup.c	Tue Dec 14 17:20:18 2004 +0000
     8.3 @@ -328,6 +328,8 @@ void __init start_of_day(void)
     8.4  
     8.5      sort_exception_tables();
     8.6  
     8.7 +    arch_do_createdomain(current);
     8.8 +
     8.9      /* Tell the PCI layer not to allocate too close to the RAM area.. */
    8.10      low_mem_size = ((max_page << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
    8.11      if ( low_mem_size > pci_mem_start ) pci_mem_start = low_mem_size;
     9.1 --- a/xen/arch/x86/smpboot.c	Fri Dec 10 19:56:39 2004 +0000
     9.2 +++ b/xen/arch/x86/smpboot.c	Tue Dec 14 17:20:18 2004 +0000
     9.3 @@ -665,10 +665,6 @@ static void __init do_boot_cpu (int apic
     9.4  
     9.5      map_cpu_to_boot_apicid(cpu, apicid);
     9.6  
     9.7 -#if defined(__i386__)
     9.8 -    SET_DEFAULT_FAST_TRAP(&ed->thread);
     9.9 -#endif
    9.10 -
    9.11      idle_task[cpu] = ed;
    9.12  
    9.13      /* start_eip had better be page-aligned! */
    10.1 --- a/xen/arch/x86/traps.c	Fri Dec 10 19:56:39 2004 +0000
    10.2 +++ b/xen/arch/x86/traps.c	Tue Dec 14 17:20:18 2004 +0000
    10.3 @@ -998,4 +998,10 @@ unsigned long do_get_debugreg(int reg)
    10.4      return current->thread.debugreg[reg];
    10.5  }
    10.6  
    10.7 +#else
    10.8 +
    10.9 +asmlinkage void fatal_trap(int trapnr, struct xen_regs *regs)
   10.10 +{
   10.11 +}
   10.12 +
   10.13  #endif /* __i386__ */
    11.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Dec 10 19:56:39 2004 +0000
    11.2 +++ b/xen/arch/x86/x86_32/entry.S	Tue Dec 14 17:20:18 2004 +0000
    11.3 @@ -56,7 +56,7 @@
    11.4  #include <xen/config.h>
    11.5  #include <xen/errno.h>
    11.6  #include <xen/softirq.h>
    11.7 -#include <asm/x86_32/asm_defns.h>
    11.8 +#include <asm/asm_defns.h>
    11.9  #include <public/xen.h>
   11.10  
   11.11  #define GET_CURRENT(reg)   \
   11.12 @@ -65,10 +65,6 @@
   11.13          andl $~3,reg;      \
   11.14          movl (reg),reg;
   11.15  
   11.16 -ENTRY(continue_nonidle_task)
   11.17 -        GET_CURRENT(%ebx)
   11.18 -        jmp test_all_events
   11.19 -
   11.20          ALIGN
   11.21  restore_all_guest:
   11.22          testb $TF_failsafe_return,EDOMAIN_thread_flags(%ebx)
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c	Tue Dec 14 17:20:18 2004 +0000
    12.3 @@ -0,0 +1,71 @@
    12.4 +/*
    12.5 + * Generate definitions needed by assembly language modules.
    12.6 + * This code generates raw asm output which is post-processed
    12.7 + * to extract and format the required data.
    12.8 + */
    12.9 +
   12.10 +#include <xen/sched.h>
   12.11 +
   12.12 +#define DEFINE(_sym, _val) \
   12.13 +    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
   12.14 +#define BLANK() \
   12.15 +    __asm__ __volatile__ ( "\n->" : : )
   12.16 +#define OFFSET(_sym, _str, _mem) \
   12.17 +    DEFINE(_sym, offsetof(_str, _mem));
   12.18 +
   12.19 +void __dummy__(void)
   12.20 +{
   12.21 +    OFFSET(XREGS_r15, struct xen_regs, r15);
   12.22 +    OFFSET(XREGS_r14, struct xen_regs, r14);
   12.23 +    OFFSET(XREGS_r13, struct xen_regs, r13);
   12.24 +    OFFSET(XREGS_r12, struct xen_regs, r12);
   12.25 +    OFFSET(XREGS_rbp, struct xen_regs, rbp);
   12.26 +    OFFSET(XREGS_rbx, struct xen_regs, rbx);
   12.27 +    OFFSET(XREGS_r11, struct xen_regs, r11);
   12.28 +    OFFSET(XREGS_r10, struct xen_regs, r10);
   12.29 +    OFFSET(XREGS_r9, struct xen_regs, r9);
   12.30 +    OFFSET(XREGS_r8, struct xen_regs, r8);
   12.31 +    OFFSET(XREGS_rax, struct xen_regs, rax);
   12.32 +    OFFSET(XREGS_rcx, struct xen_regs, rcx);
   12.33 +    OFFSET(XREGS_rdx, struct xen_regs, rdx);
   12.34 +    OFFSET(XREGS_rsi, struct xen_regs, rsi);
   12.35 +    OFFSET(XREGS_rdi, struct xen_regs, rdi);
   12.36 +    OFFSET(XREGS_orig_rax, struct xen_regs, orig_rax);
   12.37 +    OFFSET(XREGS_rip, struct xen_regs, rip);
   12.38 +    OFFSET(XREGS_cs, struct xen_regs, cs);
   12.39 +    OFFSET(XREGS_eflags, struct xen_regs, eflags);
   12.40 +    OFFSET(XREGS_rsp, struct xen_regs, rsp);
   12.41 +    OFFSET(XREGS_ss, struct xen_regs, ss);
   12.42 +    BLANK();
   12.43 +
   12.44 +    OFFSET(DOMAIN_processor, struct domain, processor);
   12.45 +    OFFSET(DOMAIN_shared_info, struct domain, shared_info);
   12.46 +    OFFSET(DOMAIN_event_sel, struct domain, thread.event_selector);
   12.47 +    OFFSET(DOMAIN_event_addr, struct domain, thread.event_address);
   12.48 +    OFFSET(DOMAIN_failsafe_sel, struct domain, thread.failsafe_selector);
   12.49 +    OFFSET(DOMAIN_failsafe_addr, struct domain, thread.failsafe_address);
   12.50 +    OFFSET(DOMAIN_trap_bounce, struct domain, thread.trap_bounce);
   12.51 +    OFFSET(DOMAIN_thread_flags, struct domain, thread.flags);
   12.52 +    BLANK();
   12.53 +
   12.54 +    OFFSET(SHINFO_upcall_pending, shared_info_t, 
   12.55 +           vcpu_data[0].evtchn_upcall_pending);
   12.56 +    OFFSET(SHINFO_upcall_mask, shared_info_t, 
   12.57 +           vcpu_data[0].evtchn_upcall_mask);
   12.58 +    BLANK();
   12.59 +
   12.60 +    OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
   12.61 +    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
   12.62 +    OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
   12.63 +    OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
   12.64 +    OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
   12.65 +    BLANK();
   12.66 +
   12.67 +    OFFSET(MULTICALL_op, multicall_entry_t, op);
   12.68 +    OFFSET(MULTICALL_arg0, multicall_entry_t, args[0]);
   12.69 +    OFFSET(MULTICALL_arg1, multicall_entry_t, args[1]);
   12.70 +    OFFSET(MULTICALL_arg2, multicall_entry_t, args[2]);
   12.71 +    OFFSET(MULTICALL_arg3, multicall_entry_t, args[3]);
   12.72 +    OFFSET(MULTICALL_arg4, multicall_entry_t, args[4]);
   12.73 +    OFFSET(MULTICALL_result, multicall_entry_t, args[5]);
   12.74 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/xen/arch/x86/x86_64/mm.c	Tue Dec 14 17:20:18 2004 +0000
    13.3 @@ -0,0 +1,455 @@
    13.4 +/******************************************************************************
    13.5 + * arch/x86/x86_64/mm.c
    13.6 + * 
    13.7 + * Modifications to Linux original are copyright (c) 2004, K A Fraser
    13.8 + * 
    13.9 + * This program is free software; you can redistribute it and/or modify
   13.10 + * it under the terms of the GNU General Public License as published by
   13.11 + * the Free Software Foundation; either version 2 of the License, or
   13.12 + * (at your option) any later version.
   13.13 + * 
   13.14 + * This program is distributed in the hope that it will be useful,
   13.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13.17 + * GNU General Public License for more details.
   13.18 + * 
   13.19 + * You should have received a copy of the GNU General Public License
   13.20 + * along with this program; if not, write to the Free Software
   13.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   13.22 + */
   13.23 +
   13.24 +#include <xen/config.h>
   13.25 +#include <xen/lib.h>
   13.26 +#include <xen/init.h>
   13.27 +#include <xen/mm.h>
   13.28 +#include <asm/page.h>
   13.29 +#include <asm/flushtlb.h>
   13.30 +#include <asm/fixmap.h>
   13.31 +#include <asm/domain_page.h>
   13.32 +
   13.33 +static inline void set_pte_phys(unsigned long vaddr,
   13.34 +                                l1_pgentry_t entry)
   13.35 +{
   13.36 +    l4_pgentry_t *l4ent;
   13.37 +    l3_pgentry_t *l3ent;
   13.38 +    l2_pgentry_t *l2ent;
   13.39 +    l1_pgentry_t *l1ent;
   13.40 +
   13.41 +    l4ent = &idle_pg_table[l4_table_offset(vaddr)];
   13.42 +    l3ent = l4_pgentry_to_l3(*l4ent) + l3_table_offset(vaddr);
   13.43 +    l2ent = l3_pgentry_to_l2(*l3ent) + l2_table_offset(vaddr);
   13.44 +    l1ent = l2_pgentry_to_l1(*l2ent) + l1_table_offset(vaddr);
   13.45 +    *l1ent = entry;
   13.46 +
   13.47 +    /* It's enough to flush this one mapping. */
   13.48 +    __flush_tlb_one(vaddr);
   13.49 +}
   13.50 +
   13.51 +
   13.52 +void __set_fixmap(enum fixed_addresses idx, 
   13.53 +                  l1_pgentry_t entry)
   13.54 +{
   13.55 +    unsigned long address = fix_to_virt(idx);
   13.56 +
   13.57 +    if ( likely(idx < __end_of_fixed_addresses) )
   13.58 +        set_pte_phys(address, entry);
   13.59 +    else
   13.60 +        printk("Invalid __set_fixmap\n");
   13.61 +}
   13.62 +
   13.63 +
   13.64 +void __init paging_init(void)
   13.65 +{
   13.66 +    void *ioremap_pt;
   13.67 +    int i;
   13.68 +
   13.69 +    /* Create page table for ioremap(). */
   13.70 +    ioremap_pt = (void *)alloc_xenheap_page();
   13.71 +    clear_page(ioremap_pt);
   13.72 +    idle_pg_table[IOREMAP_VIRT_START >> L2_PAGETABLE_SHIFT] = 
   13.73 +        mk_l2_pgentry(__pa(ioremap_pt) | __PAGE_HYPERVISOR);
   13.74 +
   13.75 +    /* Create read-only mapping of MPT for guest-OS use. */
   13.76 +    idle_pg_table[RO_MPT_VIRT_START >> L2_PAGETABLE_SHIFT] =
   13.77 +        mk_l2_pgentry(l2_pgentry_val(
   13.78 +            idle_pg_table[RDWR_MPT_VIRT_START >> L2_PAGETABLE_SHIFT]) & 
   13.79 +                      ~_PAGE_RW);
   13.80 +
   13.81 +    /* Set up mapping cache for domain pages. */
   13.82 +    mapcache = (unsigned long *)alloc_xenheap_page();
   13.83 +    clear_page(mapcache);
   13.84 +    idle_pg_table[MAPCACHE_VIRT_START >> L2_PAGETABLE_SHIFT] =
   13.85 +        mk_l2_pgentry(__pa(mapcache) | __PAGE_HYPERVISOR);
   13.86 +
   13.87 +    /* Set up linear page table mapping. */
   13.88 +    idle_pg_table[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] =
   13.89 +        mk_l2_pgentry(__pa(idle_pg_table) | __PAGE_HYPERVISOR);
   13.90 +
   13.91 +}
   13.92 +
   13.93 +void __init zap_low_mappings(void)
   13.94 +{
   13.95 +    idle_pg_table[0] = 0;
   13.96 +}
   13.97 +
   13.98 +
   13.99 +/*
  13.100 + * Allows shooting down of borrowed page-table use on specific CPUs.
  13.101 + * Specifically, we borrow page tables when running the idle domain.
  13.102 + */
  13.103 +static void __synchronise_pagetables(void *mask)
  13.104 +{
  13.105 +    struct domain *d = current;
  13.106 +    if ( ((unsigned long)mask & (1<<d->processor)) && is_idle_task(d) )
  13.107 +        write_ptbase(&d->mm);
  13.108 +}
  13.109 +void synchronise_pagetables(unsigned long cpu_mask)
  13.110 +{
  13.111 +    __synchronise_pagetables((void *)cpu_mask);
  13.112 +    smp_call_function(__synchronise_pagetables, (void *)cpu_mask, 1, 1);
  13.113 +}
  13.114 +
  13.115 +long do_stack_switch(unsigned long ss, unsigned long esp)
  13.116 +{
  13.117 +    int nr = smp_processor_id();
  13.118 +    struct tss_struct *t = &init_tss[nr];
  13.119 +
  13.120 +    /* We need to do this check as we load and use SS on guest's behalf. */
  13.121 +    if ( (ss & 3) == 0 )
  13.122 +        return -EPERM;
  13.123 +
  13.124 +    current->thread.guestos_ss = ss;
  13.125 +    current->thread.guestos_sp = esp;
  13.126 +    t->ss1  = ss;
  13.127 +    t->esp1 = esp;
  13.128 +
  13.129 +    return 0;
  13.130 +}
  13.131 +
  13.132 +
  13.133 +/* Returns TRUE if given descriptor is valid for GDT or LDT. */
  13.134 +int check_descriptor(unsigned long *d)
  13.135 +{
  13.136 +    unsigned long base, limit, a = d[0], b = d[1];
  13.137 +
  13.138 +    /* A not-present descriptor will always fault, so is safe. */
  13.139 +    if ( !(b & _SEGMENT_P) ) 
  13.140 +        goto good;
  13.141 +
  13.142 +    /*
  13.143 +     * We don't allow a DPL of zero. There is no legitimate reason for 
  13.144 +     * specifying DPL==0, and it gets rather dangerous if we also accept call 
  13.145 +     * gates (consider a call gate pointing at another guestos descriptor with 
  13.146 +     * DPL 0 -- this would get the OS ring-0 privileges).
  13.147 +     */
  13.148 +    if ( (b & _SEGMENT_DPL) == 0 )
  13.149 +        goto bad;
  13.150 +
  13.151 +    if ( !(b & _SEGMENT_S) )
  13.152 +    {
  13.153 +        /*
  13.154 +         * System segment:
  13.155 +         *  1. Don't allow interrupt or trap gates as they belong in the IDT.
  13.156 +         *  2. Don't allow TSS descriptors or task gates as we don't
  13.157 +         *     virtualise x86 tasks.
  13.158 +         *  3. Don't allow LDT descriptors because they're unnecessary and
  13.159 +         *     I'm uneasy about allowing an LDT page to contain LDT
  13.160 +         *     descriptors. In any case, Xen automatically creates the
  13.161 +         *     required descriptor when reloading the LDT register.
  13.162 +         *  4. We allow call gates but they must not jump to a private segment.
  13.163 +         */
  13.164 +
  13.165 +        /* Disallow everything but call gates. */
  13.166 +        if ( (b & _SEGMENT_TYPE) != 0xc00 )
  13.167 +            goto bad;
  13.168 +
  13.169 +        /* Can't allow far jump to a Xen-private segment. */
  13.170 +        if ( !VALID_CODESEL(a>>16) )
  13.171 +            goto bad;
  13.172 +
  13.173 +        /* Reserved bits must be zero. */
  13.174 +        if ( (b & 0xe0) != 0 )
  13.175 +            goto bad;
  13.176 +        
  13.177 +        /* No base/limit check is needed for a call gate. */
  13.178 +        goto good;
  13.179 +    }
  13.180 +    
  13.181 +    /* Check that base is at least a page away from Xen-private area. */
  13.182 +    base  = (b&(0xff<<24)) | ((b&0xff)<<16) | (a>>16);
  13.183 +    if ( base >= (PAGE_OFFSET - PAGE_SIZE) )
  13.184 +        goto bad;
  13.185 +
  13.186 +    /* Check and truncate the limit if necessary. */
  13.187 +    limit = (b&0xf0000) | (a&0xffff);
  13.188 +    limit++; /* We add one because limit is inclusive. */
  13.189 +    if ( (b & _SEGMENT_G) )
  13.190 +        limit <<= 12;
  13.191 +
  13.192 +    if ( (b & (_SEGMENT_CODE | _SEGMENT_EC)) == _SEGMENT_EC )
  13.193 +    {
  13.194 +        /*
  13.195 +         * Grows-down limit check. 
  13.196 +         * NB. limit == 0xFFFFF provides no access      (if G=1).
  13.197 +         *     limit == 0x00000 provides 4GB-4kB access (if G=1).
  13.198 +         */
  13.199 +        if ( (base + limit) > base )
  13.200 +        {
  13.201 +            limit = -(base & PAGE_MASK);
  13.202 +            goto truncate;
  13.203 +        }
  13.204 +    }
  13.205 +    else
  13.206 +    {
  13.207 +        /*
  13.208 +         * Grows-up limit check.
  13.209 +         * NB. limit == 0xFFFFF provides 4GB access (if G=1).
  13.210 +         *     limit == 0x00000 provides 4kB access (if G=1).
  13.211 +         */
  13.212 +        if ( ((base + limit) <= base) || 
  13.213 +             ((base + limit) > PAGE_OFFSET) )
  13.214 +        {
  13.215 +            limit = PAGE_OFFSET - base;
  13.216 +        truncate:
  13.217 +            if ( !(b & _SEGMENT_G) )
  13.218 +                goto bad; /* too dangerous; too hard to work out... */
  13.219 +            limit = (limit >> 12) - 1;
  13.220 +            d[0] &= ~0x0ffff; d[0] |= limit & 0x0ffff;
  13.221 +            d[1] &= ~0xf0000; d[1] |= limit & 0xf0000;
  13.222 +        }
  13.223 +    }
  13.224 +
  13.225 + good:
  13.226 +    return 1;
  13.227 + bad:
  13.228 +    return 0;
  13.229 +}
  13.230 +
  13.231 +
  13.232 +void destroy_gdt(struct domain *d)
  13.233 +{
  13.234 +    int i;
  13.235 +    unsigned long pfn;
  13.236 +
  13.237 +    for ( i = 0; i < 16; i++ )
  13.238 +    {
  13.239 +        if ( (pfn = l1_pgentry_to_pagenr(d->mm.perdomain_pt[i])) != 0 )
  13.240 +            put_page_and_type(&frame_table[pfn]);
  13.241 +        d->mm.perdomain_pt[i] = mk_l1_pgentry(0);
  13.242 +    }
  13.243 +}
  13.244 +
  13.245 +
  13.246 +long set_gdt(struct domain *d, 
  13.247 +             unsigned long *frames,
  13.248 +             unsigned int entries)
  13.249 +{
  13.250 +    /* NB. There are 512 8-byte entries per GDT page. */
  13.251 +    int i = 0, nr_pages = (entries + 511) / 512;
  13.252 +    struct desc_struct *vgdt;
  13.253 +    unsigned long pfn;
  13.254 +
  13.255 +    /* Check the first page in the new GDT. */
  13.256 +    if ( (pfn = frames[0]) >= max_page )
  13.257 +        goto fail;
  13.258 +
  13.259 +    /* The first page is special because Xen owns a range of entries in it. */
  13.260 +    if ( !get_page_and_type(&frame_table[pfn], d, PGT_gdt_page) )
  13.261 +    {
  13.262 +        /* GDT checks failed: try zapping the Xen reserved entries. */
  13.263 +        if ( !get_page_and_type(&frame_table[pfn], d, PGT_writable_page) )
  13.264 +            goto fail;
  13.265 +        vgdt = map_domain_mem(pfn << PAGE_SHIFT);
  13.266 +        memset(vgdt + FIRST_RESERVED_GDT_ENTRY, 0,
  13.267 +               NR_RESERVED_GDT_ENTRIES*8);
  13.268 +        unmap_domain_mem(vgdt);
  13.269 +        put_page_and_type(&frame_table[pfn]);
  13.270 +
  13.271 +        /* Okay, we zapped the entries. Now try the GDT checks again. */
  13.272 +        if ( !get_page_and_type(&frame_table[pfn], d, PGT_gdt_page) )
  13.273 +            goto fail;
  13.274 +    }
  13.275 +
  13.276 +    /* Check the remaining pages in the new GDT. */
  13.277 +    for ( i = 1; i < nr_pages; i++ )
  13.278 +        if ( ((pfn = frames[i]) >= max_page) ||
  13.279 +             !get_page_and_type(&frame_table[pfn], d, PGT_gdt_page) )
  13.280 +            goto fail;
  13.281 +
  13.282 +    /* Copy reserved GDT entries to the new GDT. */
  13.283 +    vgdt = map_domain_mem(frames[0] << PAGE_SHIFT);
  13.284 +    memcpy(vgdt + FIRST_RESERVED_GDT_ENTRY, 
  13.285 +           gdt_table + FIRST_RESERVED_GDT_ENTRY, 
  13.286 +           NR_RESERVED_GDT_ENTRIES*8);
  13.287 +    unmap_domain_mem(vgdt);
  13.288 +
  13.289 +    /* Tear down the old GDT. */
  13.290 +    destroy_gdt(d);
  13.291 +
  13.292 +    /* Install the new GDT. */
  13.293 +    for ( i = 0; i < nr_pages; i++ )
  13.294 +        d->mm.perdomain_pt[i] =
  13.295 +            mk_l1_pgentry((frames[i] << PAGE_SHIFT) | __PAGE_HYPERVISOR);
  13.296 +
  13.297 +    SET_GDT_ADDRESS(d, GDT_VIRT_START);
  13.298 +    SET_GDT_ENTRIES(d, entries);
  13.299 +
  13.300 +    return 0;
  13.301 +
  13.302 + fail:
  13.303 +    while ( i-- > 0 )
  13.304 +        put_page_and_type(&frame_table[frames[i]]);
  13.305 +    return -EINVAL;
  13.306 +}
  13.307 +
  13.308 +
  13.309 +long do_set_gdt(unsigned long *frame_list, unsigned int entries)
  13.310 +{
  13.311 +    int nr_pages = (entries + 511) / 512;
  13.312 +    unsigned long frames[16];
  13.313 +    long ret;
  13.314 +
  13.315 +    if ( (entries <= LAST_RESERVED_GDT_ENTRY) || (entries > 8192) ) 
  13.316 +        return -EINVAL;
  13.317 +    
  13.318 +    if ( copy_from_user(frames, frame_list, nr_pages * sizeof(unsigned long)) )
  13.319 +        return -EFAULT;
  13.320 +
  13.321 +    if ( (ret = set_gdt(current, frames, entries)) == 0 )
  13.322 +    {
  13.323 +        local_flush_tlb();
  13.324 +        __asm__ __volatile__ ("lgdt %0" : "=m" (*current->mm.gdt));
  13.325 +    }
  13.326 +
  13.327 +    return ret;
  13.328 +}
  13.329 +
  13.330 +
  13.331 +long do_update_descriptor(
  13.332 +    unsigned long pa, unsigned long word1, unsigned long word2)
  13.333 +{
  13.334 +    unsigned long *gdt_pent, pfn = pa >> PAGE_SHIFT, d[2];
  13.335 +    struct pfn_info *page;
  13.336 +    long ret = -EINVAL;
  13.337 +
  13.338 +    d[0] = word1;
  13.339 +    d[1] = word2;
  13.340 +
  13.341 +    if ( (pa & 7) || (pfn >= max_page) || !check_descriptor(d) )
  13.342 +        return -EINVAL;
  13.343 +
  13.344 +    page = &frame_table[pfn];
  13.345 +    if ( unlikely(!get_page(page, current)) )
  13.346 +        return -EINVAL;
  13.347 +
  13.348 +    /* Check if the given frame is in use in an unsafe context. */
  13.349 +    switch ( page->u.inuse.type_info & PGT_type_mask )
  13.350 +    {
  13.351 +    case PGT_gdt_page:
  13.352 +        /* Disallow updates of Xen-reserved descriptors in the current GDT. */
  13.353 +        if ( (l1_pgentry_to_pagenr(current->mm.perdomain_pt[0]) == pfn) &&
  13.354 +             (((pa&(PAGE_SIZE-1))>>3) >= FIRST_RESERVED_GDT_ENTRY) &&
  13.355 +             (((pa&(PAGE_SIZE-1))>>3) <= LAST_RESERVED_GDT_ENTRY) )
  13.356 +            goto out;
  13.357 +        if ( unlikely(!get_page_type(page, PGT_gdt_page)) )
  13.358 +            goto out;
  13.359 +        break;
  13.360 +    case PGT_ldt_page:
  13.361 +        if ( unlikely(!get_page_type(page, PGT_ldt_page)) )
  13.362 +            goto out;
  13.363 +        break;
  13.364 +    default:
  13.365 +        if ( unlikely(!get_page_type(page, PGT_writable_page)) )
  13.366 +            goto out;
  13.367 +        break;
  13.368 +    }
  13.369 +
  13.370 +    /* All is good so make the update. */
  13.371 +    gdt_pent = map_domain_mem(pa);
  13.372 +    memcpy(gdt_pent, d, 8);
  13.373 +    unmap_domain_mem(gdt_pent);
  13.374 +
  13.375 +    put_page_type(page);
  13.376 +
  13.377 +    ret = 0; /* success */
  13.378 +
  13.379 + out:
  13.380 +    put_page(page);
  13.381 +    return ret;
  13.382 +}
  13.383 +
  13.384 +#ifdef MEMORY_GUARD
  13.385 +
  13.386 +void *memguard_init(void *heap_start)
  13.387 +{
  13.388 +    l1_pgentry_t *l1;
  13.389 +    int i, j;
  13.390 +
  13.391 +    /* Round the allocation pointer up to a page boundary. */
  13.392 +    heap_start = (void *)(((unsigned long)heap_start + (PAGE_SIZE-1)) & 
  13.393 +                          PAGE_MASK);
  13.394 +
  13.395 +    /* Memory guarding is incompatible with super pages. */
  13.396 +    for ( i = 0; i < (xenheap_phys_end >> L2_PAGETABLE_SHIFT); i++ )
  13.397 +    {
  13.398 +        l1 = (l1_pgentry_t *)heap_start;
  13.399 +        heap_start = (void *)((unsigned long)heap_start + PAGE_SIZE);
  13.400 +        for ( j = 0; j < ENTRIES_PER_L1_PAGETABLE; j++ )
  13.401 +            l1[j] = mk_l1_pgentry((i << L2_PAGETABLE_SHIFT) |
  13.402 +                                   (j << L1_PAGETABLE_SHIFT) | 
  13.403 +                                  __PAGE_HYPERVISOR);
  13.404 +        idle_pg_table[i] = idle_pg_table[i + l2_table_offset(PAGE_OFFSET)] =
  13.405 +            mk_l2_pgentry(virt_to_phys(l1) | __PAGE_HYPERVISOR);
  13.406 +    }
  13.407 +
  13.408 +    return heap_start;
  13.409 +}
  13.410 +
  13.411 +static void __memguard_change_range(void *p, unsigned long l, int guard)
  13.412 +{
  13.413 +    l1_pgentry_t *l1;
  13.414 +    l2_pgentry_t *l2;
  13.415 +    unsigned long _p = (unsigned long)p;
  13.416 +    unsigned long _l = (unsigned long)l;
  13.417 +
  13.418 +    /* Ensure we are dealing with a page-aligned whole number of pages. */
  13.419 +    ASSERT((_p&PAGE_MASK) != 0);
  13.420 +    ASSERT((_l&PAGE_MASK) != 0);
  13.421 +    ASSERT((_p&~PAGE_MASK) == 0);
  13.422 +    ASSERT((_l&~PAGE_MASK) == 0);
  13.423 +
  13.424 +    while ( _l != 0 )
  13.425 +    {
  13.426 +        l2  = &idle_pg_table[l2_table_offset(_p)];
  13.427 +        l1  = l2_pgentry_to_l1(*l2) + l1_table_offset(_p);
  13.428 +        if ( guard )
  13.429 +            *l1 = mk_l1_pgentry(l1_pgentry_val(*l1) & ~_PAGE_PRESENT);
  13.430 +        else
  13.431 +            *l1 = mk_l1_pgentry(l1_pgentry_val(*l1) | _PAGE_PRESENT);
  13.432 +        _p += PAGE_SIZE;
  13.433 +        _l -= PAGE_SIZE;
  13.434 +    }
  13.435 +}
  13.436 +
  13.437 +void memguard_guard_range(void *p, unsigned long l)
  13.438 +{
  13.439 +    __memguard_change_range(p, l, 1);
  13.440 +    local_flush_tlb();
  13.441 +}
  13.442 +
  13.443 +void memguard_unguard_range(void *p, unsigned long l)
  13.444 +{
  13.445 +    __memguard_change_range(p, l, 0);
  13.446 +}
  13.447 +
  13.448 +int memguard_is_guarded(void *p)
  13.449 +{
  13.450 +    l1_pgentry_t *l1;
  13.451 +    l2_pgentry_t *l2;
  13.452 +    unsigned long _p = (unsigned long)p;
  13.453 +    l2  = &idle_pg_table[l2_table_offset(_p)];
  13.454 +    l1  = l2_pgentry_to_l1(*l2) + l1_table_offset(_p);
  13.455 +    return !(l1_pgentry_val(*l1) & _PAGE_PRESENT);
  13.456 +}
  13.457 +
  13.458 +#endif
    14.1 --- a/xen/arch/x86/x86_64/xen.lds	Fri Dec 10 19:56:39 2004 +0000
    14.2 +++ b/xen/arch/x86/x86_64/xen.lds	Tue Dec 14 17:20:18 2004 +0000
    14.3 @@ -28,6 +28,11 @@ SECTIONS
    14.4    __ex_table : { *(__ex_table) } :text
    14.5    __stop___ex_table = .;
    14.6  
    14.7 +  . = ALIGN(16);                /* Pre-exception table */
    14.8 +  __start___pre_ex_table = .;
    14.9 +  __pre_ex_table : { *(__pre_ex_table) } :text
   14.10 +  __stop___pre_ex_table = .;
   14.11 +
   14.12    __start___ksymtab = .;	/* Kernel symbol table */
   14.13    __ksymtab : { *(__ksymtab) } :text
   14.14    __stop___ksymtab = .;
    15.1 --- a/xen/common/domain.c	Fri Dec 10 19:56:39 2004 +0000
    15.2 +++ b/xen/common/domain.c	Tue Dec 14 17:20:18 2004 +0000
    15.3 @@ -55,20 +55,21 @@ struct domain *do_createdomain(domid_t d
    15.4      /* Per-domain PCI-device list. */
    15.5      spin_lock_init(&d->pcidev_lock);
    15.6      INIT_LIST_HEAD(&d->pcidev_list);
    15.7 +    
    15.8 +    if ( (d->id != IDLE_DOMAIN_ID) &&
    15.9 +         ((init_event_channels(d) != 0) || (grant_table_create(d) != 0)) )
   15.10 +    {
   15.11 +        destroy_event_channels(d);
   15.12 +        free_domain_struct(d);
   15.13 +        return NULL;
   15.14 +    }
   15.15 +    
   15.16 +    arch_do_createdomain(ed);
   15.17 +    
   15.18 +    sched_add_domain(ed);
   15.19  
   15.20      if ( d->id != IDLE_DOMAIN_ID )
   15.21      {
   15.22 -        if ( (init_event_channels(d) != 0) || (grant_table_create(d) != 0) )
   15.23 -        {
   15.24 -            destroy_event_channels(d);
   15.25 -            free_domain_struct(d);
   15.26 -            return NULL;
   15.27 -        }
   15.28 -
   15.29 -        arch_do_createdomain(ed);
   15.30 -
   15.31 -        sched_add_domain(ed);
   15.32 -
   15.33          write_lock(&domlist_lock);
   15.34          pd = &domain_list; /* NB. domain_list maintained in order of dom_id. */
   15.35          for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_list )
   15.36 @@ -80,10 +81,6 @@ struct domain *do_createdomain(domid_t d
   15.37          domain_hash[DOMAIN_HASH(dom_id)] = d;
   15.38          write_unlock(&domlist_lock);
   15.39      }
   15.40 -    else
   15.41 -    {
   15.42 -        sched_add_domain(ed);
   15.43 -    }
   15.44  
   15.45      return d;
   15.46  }
    16.1 --- a/xen/common/physdev.c	Fri Dec 10 19:56:39 2004 +0000
    16.2 +++ b/xen/common/physdev.c	Tue Dec 14 17:20:18 2004 +0000
    16.3 @@ -758,7 +758,8 @@ void physdev_init_dom0(struct domain *p)
    16.4           *
    16.5           * In Linux2.6 we set pcibios_scan_all_fns().
    16.6           */
    16.7 -        if ( dev->hdr_type != PCI_HEADER_TYPE_NORMAL )
    16.8 +        if ( (dev->hdr_type != PCI_HEADER_TYPE_NORMAL) &&
    16.9 +             (dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) )
   16.10              continue;
   16.11          pdev = xmalloc(sizeof(phys_dev_t));
   16.12          pdev->dev = dev;
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/xen/include/asm-x86/asm_defns.h	Tue Dec 14 17:20:18 2004 +0000
    17.3 @@ -0,0 +1,18 @@
    17.4 +
    17.5 +#ifndef __X86_ASM_DEFNS_H__
    17.6 +#define __X86_ASM_DEFNS_H__
    17.7 +
    17.8 +/* NB. Auto-generated from arch/.../asm-offsets.c */
    17.9 +#include <asm/asm-offsets.h>
   17.10 +#include <asm/processor.h>
   17.11 +
   17.12 +#define __STR(x) #x
   17.13 +#define STR(x) __STR(x)
   17.14 +
   17.15 +#ifdef __x86_64__
   17.16 +#include <asm/x86_64/asm_defns.h>
   17.17 +#else
   17.18 +#include <asm/x86_32/asm_defns.h>
   17.19 +#endif
   17.20 +
   17.21 +#endif /* __X86_ASM_DEFNS_H__ */
    18.1 --- a/xen/include/asm-x86/domain.h	Fri Dec 10 19:56:39 2004 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,14 +0,0 @@
    18.4 -
    18.5 -#ifndef __ASM_X86_DOMAIN_H__
    18.6 -#define __ASM_X86_DOMAIN_H__
    18.7 -
    18.8 -extern void arch_do_createdomain(struct exec_domain *d);
    18.9 -
   18.10 -extern int  arch_final_setup_guestos(
   18.11 -    struct exec_domain *d, full_execution_context_t *c);
   18.12 -
   18.13 -extern void free_perdomain_pt(struct domain *d);
   18.14 -
   18.15 -extern void domain_relinquish_memory(struct domain *d);
   18.16 -
   18.17 -#endif /* __ASM_X86_DOMAIN_H__ */
    19.1 --- a/xen/include/asm-x86/irq.h	Fri Dec 10 19:56:39 2004 +0000
    19.2 +++ b/xen/include/asm-x86/irq.h	Tue Dec 14 17:20:18 2004 +0000
    19.3 @@ -5,7 +5,7 @@
    19.4  
    19.5  #include <xen/config.h>
    19.6  #include <asm/atomic.h>
    19.7 -#include <asm/x86_32/asm_defns.h>
    19.8 +#include <asm/asm_defns.h>
    19.9  
   19.10  extern void disable_irq(unsigned int);
   19.11  extern void disable_irq_nosync(unsigned int);
    20.1 --- a/xen/include/asm-x86/multicall.h	Fri Dec 10 19:56:39 2004 +0000
    20.2 +++ b/xen/include/asm-x86/multicall.h	Tue Dec 14 17:20:18 2004 +0000
    20.3 @@ -5,7 +5,13 @@
    20.4  #ifndef __ASM_X86_MULTICALL_H__
    20.5  #define __ASM_X86_MULTICALL_H__
    20.6  
    20.7 -#include <asm-x86/x86_32/asm_defns.h>
    20.8 +#include <asm/asm_defns.h>
    20.9 +
   20.10 +#ifdef __x86_64__
   20.11 +
   20.12 +#define do_multicall_call(_call) BUG()
   20.13 +
   20.14 +#else
   20.15  
   20.16  #define do_multicall_call(_call)                       \
   20.17      do {                                               \
   20.18 @@ -23,4 +29,6 @@
   20.19              : : "b" (_call) : "eax", "ecx", "edx" );   \
   20.20      } while ( 0 )
   20.21  
   20.22 +#endif
   20.23 +
   20.24  #endif /* __ASM_X86_MULTICALL_H__ */
    21.1 --- a/xen/include/asm-x86/processor.h	Fri Dec 10 19:56:39 2004 +0000
    21.2 +++ b/xen/include/asm-x86/processor.h	Tue Dec 14 17:20:18 2004 +0000
    21.3 @@ -255,18 +255,18 @@ static inline unsigned int cpuid_edx(uns
    21.4  })
    21.5  
    21.6  #define write_cr0(x) \
    21.7 -	__asm__("mov"__OS" %0,%%cr0": :"r" (x));
    21.8 +	__asm__("mov"__OS" %0,%%cr0": :"r" ((unsigned long)x));
    21.9  
   21.10  #define read_cr4() ({ \
   21.11 -	unsigned int __dummy; \
   21.12 +	unsigned long __dummy; \
   21.13  	__asm__( \
   21.14 -		"movl %%cr4,%0\n\t" \
   21.15 +		"mov"__OS" %%cr4,%0\n\t" \
   21.16  		:"=r" (__dummy)); \
   21.17  	__dummy; \
   21.18  })
   21.19  
   21.20  #define write_cr4(x) \
   21.21 -	__asm__("movl %0,%%cr4": :"r" (x));
   21.22 +	__asm__("mov"__OS" %0,%%cr4": :"r" ((unsigned long)x));
   21.23  
   21.24  /*
   21.25   * Save the cr4 feature set we're using (ie
   21.26 @@ -291,7 +291,7 @@ static inline void clear_in_cr4 (unsigne
   21.27      mmu_cr4_features &= ~mask;
   21.28      __asm__("mov"__OS" %%cr4,%%"__OP"ax\n\t"
   21.29              "and"__OS" %0,%%"__OP"ax\n\t"
   21.30 -            "movl"__OS" %%"__OP"ax,%%cr4\n"
   21.31 +            "mov"__OS" %%"__OP"ax,%%cr4\n"
   21.32              : : "irg" (~mask)
   21.33              :"ax");
   21.34  }
   21.35 @@ -400,6 +400,8 @@ struct thread_struct {
   21.36      /* general user-visible register state */
   21.37      execution_context_t user_ctxt;
   21.38  
   21.39 +    void (*schedule_tail) (struct domain *);
   21.40 +
   21.41      /*
   21.42       * Return vectors pushed to us by guest OS.
   21.43       * The stack frame for events is exactly that of an x86 hardware interrupt.
   21.44 @@ -457,14 +459,10 @@ extern struct desc_struct *idt_tables[];
   21.45  
   21.46  long set_fast_trap(struct exec_domain *p, int idx);
   21.47  
   21.48 -#define INIT_THREAD  { fast_trap_idx: 0x20 }
   21.49 -
   21.50 -#elif defined(__x86_64__)
   21.51 +#endif
   21.52  
   21.53  #define INIT_THREAD { 0 }
   21.54  
   21.55 -#endif /* __x86_64__ */
   21.56 -
   21.57  extern int gpf_emulate_4gb(struct xen_regs *regs);
   21.58  
   21.59  struct mm_struct {
    22.1 --- a/xen/include/asm-x86/system.h	Fri Dec 10 19:56:39 2004 +0000
    22.2 +++ b/xen/include/asm-x86/system.h	Tue Dec 14 17:20:18 2004 +0000
    22.3 @@ -271,13 +271,6 @@ static inline int local_irq_is_enabled(v
    22.4      return !!(flags & (1<<9)); /* EFLAGS_IF */
    22.5  }
    22.6  
    22.7 -/*
    22.8 - * disable hlt during certain critical i/o operations
    22.9 - */
   22.10 -#define HAVE_DISABLE_HLT
   22.11 -void disable_hlt(void);
   22.12 -void enable_hlt(void);
   22.13 -
   22.14  #define BROKEN_ACPI_Sx		0x0001
   22.15  #define BROKEN_INIT_AFTER_S1	0x0002
   22.16  
    23.1 --- a/xen/include/asm-x86/uaccess.h	Fri Dec 10 19:56:39 2004 +0000
    23.2 +++ b/xen/include/asm-x86/uaccess.h	Tue Dec 14 17:20:18 2004 +0000
    23.3 @@ -1,6 +1,32 @@
    23.4 +
    23.5 +#ifndef __X86_UACCESS_H__
    23.6 +#define __X86_UACCESS_H__
    23.7  
    23.8  #ifdef __x86_64__
    23.9  #include <asm/x86_64/uaccess.h>
   23.10  #else
   23.11  #include <asm/x86_32/uaccess.h>
   23.12  #endif
   23.13 +
   23.14 +/*
   23.15 + * The exception table consists of pairs of addresses: the first is the
   23.16 + * address of an instruction that is allowed to fault, and the second is
   23.17 + * the address at which the program should continue.  No registers are
   23.18 + * modified, so it is entirely up to the continuation code to figure out
   23.19 + * what to do.
   23.20 + *
   23.21 + * All the routines below use bits of fixup code that are out of line
   23.22 + * with the main instruction path.  This means when everything is well,
   23.23 + * we don't even have to jump over them.  Further, they do not intrude
   23.24 + * on our cache or tlb entries.
   23.25 + */
   23.26 +
   23.27 +struct exception_table_entry
   23.28 +{
   23.29 +	unsigned long insn, fixup;
   23.30 +};
   23.31 +
   23.32 +extern unsigned long search_exception_table(unsigned long);
   23.33 +extern void sort_exception_tables(void);
   23.34 +
   23.35 +#endif /* __X86_UACCESS_H__ */
    24.1 --- a/xen/include/asm-x86/x86_32/asm_defns.h	Fri Dec 10 19:56:39 2004 +0000
    24.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h	Tue Dec 14 17:20:18 2004 +0000
    24.3 @@ -1,12 +1,5 @@
    24.4 -#ifndef __ASM_DEFNS_H__
    24.5 -#define __ASM_DEFNS_H__
    24.6 -
    24.7 -/* NB. Auto-generated from arch/.../asm-offsets.c */
    24.8 -#include <asm/asm-offsets.h>
    24.9 -#include <asm/processor.h>
   24.10 -
   24.11 -#define __STR(x) #x
   24.12 -#define STR(x) __STR(x)
   24.13 +#ifndef __X86_32_ASM_DEFNS_H__
   24.14 +#define __X86_32_ASM_DEFNS_H__
   24.15  
   24.16  /* Maybe auto-generate the following two cases (quoted vs. unquoted). */
   24.17  #ifndef __ASSEMBLY__
   24.18 @@ -85,4 +78,4 @@
   24.19  
   24.20  #endif
   24.21  
   24.22 -#endif /* __ASM_DEFNS_H__ */
   24.23 +#endif /* __X86_32_ASM_DEFNS_H__ */
    25.1 --- a/xen/include/asm-x86/x86_32/current.h	Fri Dec 10 19:56:39 2004 +0000
    25.2 +++ b/xen/include/asm-x86/x86_32/current.h	Tue Dec 14 17:20:18 2004 +0000
    25.3 @@ -45,14 +45,11 @@ static inline unsigned long get_stack_to
    25.4      return p;
    25.5  }
    25.6  
    25.7 -#define schedule_tail(_p)                                         \
    25.8 +#define reset_stack_and_jump(__fn)                                \
    25.9      __asm__ __volatile__ (                                        \
   25.10 -        "andl %%esp,%0; addl %2,%0; movl %0,%%esp; jmp *%1"       \
   25.11 -        : : "r" (~(STACK_SIZE-1)),                                \
   25.12 -            "r" (unlikely(is_idle_task((_p)->domain)) ?           \
   25.13 -                                continue_cpu_idle_loop :          \
   25.14 -                                continue_nonidle_task),           \
   25.15 -            "i" (STACK_SIZE-STACK_RESERVED) )
   25.16 +        "movl %0,%%esp; jmp "STR(__fn)                            \
   25.17 +        : : "r" (get_execution_context()) )
   25.18  
   25.19 +#define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d)
   25.20  
   25.21  #endif /* _X86_CURRENT_H */
    26.1 --- a/xen/include/asm-x86/x86_32/uaccess.h	Fri Dec 10 19:56:39 2004 +0000
    26.2 +++ b/xen/include/asm-x86/x86_32/uaccess.h	Tue Dec 14 17:20:18 2004 +0000
    26.3 @@ -69,27 +69,6 @@ extern struct movsl_mask {
    26.4  #define array_access_ok(type,addr,count,size) \
    26.5      (likely(count < (~0UL/size)) && access_ok(type,addr,count*size))
    26.6  
    26.7 -/*
    26.8 - * The exception table consists of pairs of addresses: the first is the
    26.9 - * address of an instruction that is allowed to fault, and the second is
   26.10 - * the address at which the program should continue.  No registers are
   26.11 - * modified, so it is entirely up to the continuation code to figure out
   26.12 - * what to do.
   26.13 - *
   26.14 - * All the routines below use bits of fixup code that are out of line
   26.15 - * with the main instruction path.  This means when everything is well,
   26.16 - * we don't even have to jump over them.  Further, they do not intrude
   26.17 - * on our cache or tlb entries.
   26.18 - */
   26.19 -
   26.20 -struct exception_table_entry
   26.21 -{
   26.22 -	unsigned long insn, fixup;
   26.23 -};
   26.24 -
   26.25 -extern unsigned long search_exception_table(unsigned long);
   26.26 -extern void sort_exception_tables(void);
   26.27 -
   26.28  /**
   26.29   * get_user: - Get a simple variable from user space.
   26.30   * @x:   Variable to store result.
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/xen/include/asm-x86/x86_64/asm_defns.h	Tue Dec 14 17:20:18 2004 +0000
    27.3 @@ -0,0 +1,6 @@
    27.4 +#ifndef __X86_64_ASM_DEFNS_H__
    27.5 +#define __X86_64_ASM_DEFNS_H__
    27.6 +
    27.7 +#define SAVE_ALL(_r) ""
    27.8 +
    27.9 +#endif /* __X86_64_ASM_DEFNS_H__ */
    28.1 --- a/xen/include/asm-x86/x86_64/current.h	Fri Dec 10 19:56:39 2004 +0000
    28.2 +++ b/xen/include/asm-x86/x86_64/current.h	Tue Dec 14 17:20:18 2004 +0000
    28.3 @@ -40,15 +40,12 @@ static inline unsigned long get_stack_to
    28.4      return p;
    28.5  }
    28.6  
    28.7 -#define schedule_tail(_p)                                         \
    28.8 +#define reset_stack_and_jump(__fn)                                \
    28.9      __asm__ __volatile__ (                                        \
   28.10 -        "andq %%rsp,%0; addq %2,%0; movq %0,%%rsp; jmp *%1"       \
   28.11 -        : : "r" (~(STACK_SIZE-1)),                                \
   28.12 -            "r" (unlikely(is_idle_task((_p))) ?                   \
   28.13 -                                continue_cpu_idle_loop :          \
   28.14 -                                continue_nonidle_task),           \
   28.15 -            "i" (STACK_SIZE-STACK_RESERVED) )
   28.16 +        "movq %0,%%rsp; jmp "STR(__fn)                            \
   28.17 +        : : "r" (get_execution_context()) )
   28.18  
   28.19 +#define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d)
   28.20  
   28.21  #else
   28.22  
    29.1 --- a/xen/include/asm-x86/x86_64/uaccess.h	Fri Dec 10 19:56:39 2004 +0000
    29.2 +++ b/xen/include/asm-x86/x86_64/uaccess.h	Tue Dec 14 17:20:18 2004 +0000
    29.3 @@ -35,31 +35,15 @@
    29.4  
    29.5  #define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0)
    29.6  
    29.7 +#define array_access_ok(type,addr,count,size)                    \
    29.8 +    (likely(sizeof(count) <= 4) /* disallow 64-bit counts */ &&  \
    29.9 +     access_ok(type,addr,count*size))
   29.10 +
   29.11  extern inline int verify_area(int type, const void __user * addr, unsigned long size)
   29.12  {
   29.13  	return access_ok(type,addr,size) ? 0 : -EFAULT;
   29.14  }
   29.15  
   29.16 -
   29.17 -/*
   29.18 - * The exception table consists of pairs of addresses: the first is the
   29.19 - * address of an instruction that is allowed to fault, and the second is
   29.20 - * the address at which the program should continue.  No registers are
   29.21 - * modified, so it is entirely up to the continuation code to figure out
   29.22 - * what to do.
   29.23 - *
   29.24 - * All the routines below use bits of fixup code that are out of line
   29.25 - * with the main instruction path.  This means when everything is well,
   29.26 - * we don't even have to jump over them.  Further, they do not intrude
   29.27 - * on our cache or tlb entries.
   29.28 - */
   29.29 -
   29.30 -struct exception_table_entry
   29.31 -{
   29.32 -	unsigned long insn, fixup;
   29.33 -};
   29.34 -
   29.35 -
   29.36  /*
   29.37   * These are the main single-value transfer routines.  They automatically
   29.38   * use the right size if we just have the right pointer type.
    30.1 --- a/xen/include/public/arch-x86_32.h	Fri Dec 10 19:56:39 2004 +0000
    30.2 +++ b/xen/include/public/arch-x86_32.h	Tue Dec 14 17:20:18 2004 +0000
    30.3 @@ -2,6 +2,8 @@
    30.4   * arch-x86_32.h
    30.5   * 
    30.6   * Guest OS interface to x86 32-bit Xen.
    30.7 + * 
    30.8 + * Copyright (c) 2004, K A Fraser
    30.9   */
   30.10  
   30.11  #ifndef __XEN_PUBLIC_ARCH_X86_32_H__
    31.1 --- a/xen/include/public/arch-x86_64.h	Fri Dec 10 19:56:39 2004 +0000
    31.2 +++ b/xen/include/public/arch-x86_64.h	Tue Dec 14 17:20:18 2004 +0000
    31.3 @@ -2,6 +2,8 @@
    31.4   * arch-x86_64.h
    31.5   * 
    31.6   * Guest OS interface to x86 64-bit Xen.
    31.7 + * 
    31.8 + * Copyright (c) 2004, K A Fraser
    31.9   */
   31.10  
   31.11  #ifndef __XEN_PUBLIC_ARCH_X86_64_H__
    32.1 --- a/xen/include/public/dom0_ops.h	Fri Dec 10 19:56:39 2004 +0000
    32.2 +++ b/xen/include/public/dom0_ops.h	Tue Dec 14 17:20:18 2004 +0000
    32.3 @@ -19,7 +19,7 @@
    32.4   * This makes sure that old versions of dom0 tools will stop working in a
    32.5   * well-defined way (rather than crashing the machine, for instance).
    32.6   */
    32.7 -#define DOM0_INTERFACE_VERSION   0xAAAA001A
    32.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1001
    32.9  
   32.10  /************************************************************************/
   32.11  
    33.1 --- a/xen/include/public/trace.h	Fri Dec 10 19:56:39 2004 +0000
    33.2 +++ b/xen/include/public/trace.h	Tue Dec 14 17:20:18 2004 +0000
    33.3 @@ -1,5 +1,7 @@
    33.4  /******************************************************************************
    33.5   * trace.h
    33.6 + * 
    33.7 + * Mark Williamson, (C) 2004 Intel Research Cambridge
    33.8   */
    33.9  
   33.10  #ifndef __XEN_PUBLIC_TRACE_H__
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/xen/include/xen/domain.h	Tue Dec 14 17:20:18 2004 +0000
    34.3 @@ -0,0 +1,20 @@
    34.4 +
    34.5 +#ifndef __XEN_DOMAIN_H__
    34.6 +#define __XEN_DOMAIN_H__
    34.7 +
    34.8 +
    34.9 +
   34.10 +/*
   34.11 + * Arch-specifics.
   34.12 + */
   34.13 +
   34.14 +extern void arch_do_createdomain(struct exec_domain *d);
   34.15 +
   34.16 +extern int  arch_final_setup_guestos(
   34.17 +    struct exec_domain *d, full_execution_context_t *c);
   34.18 +
   34.19 +extern void free_perdomain_pt(struct domain *d);
   34.20 +
   34.21 +extern void domain_relinquish_memory(struct domain *d);
   34.22 +
   34.23 +#endif /* __XEN_DOMAIN_H__ */
    35.1 --- a/xen/include/xen/sched.h	Fri Dec 10 19:56:39 2004 +0000
    35.2 +++ b/xen/include/xen/sched.h	Tue Dec 14 17:20:18 2004 +0000
    35.3 @@ -253,9 +253,6 @@ void domain_init(void);
    35.4  int idle_cpu(int cpu); /* Is CPU 'cpu' idle right now? */
    35.5  
    35.6  void startup_cpu_idle_loop(void);
    35.7 -void continue_cpu_idle_loop(void);
    35.8 -
    35.9 -void continue_nonidle_task(void);
   35.10  
   35.11  unsigned long hypercall_create_continuation(
   35.12      unsigned int op, unsigned int nr_args, ...);
   35.13 @@ -369,6 +366,6 @@ static inline void domain_unpause_by_sys
   35.14  #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist))
   35.15  
   35.16  #include <xen/slab.h>
   35.17 -#include <asm/domain.h>
   35.18 +#include <xen/domain.h>
   35.19  
   35.20  #endif /* __SCHED_H__ */