ia64/xen-unstable

changeset 86:4a10fe9b20ec

bitkeeper revision 1.15 (3e24a984iRiWWcgfKCxu2p5q3YbxXw)

Many files:
First half of support for per-domain GDTs and LDTs
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Jan 15 00:21:24 2003 +0000 (2003-01-15)
parents c3e6a52cd801
children 336647fd8f40 c9c0af497875
files xen-2.4.16/arch/i386/boot/boot.S xen-2.4.16/arch/i386/entry.S xen-2.4.16/arch/i386/mm.c xen-2.4.16/arch/i386/process.c xen-2.4.16/arch/i386/setup.c xen-2.4.16/arch/i386/traps.c xen-2.4.16/common/domain.c xen-2.4.16/common/memory.c xen-2.4.16/include/asm-i386/desc.h xen-2.4.16/include/asm-i386/processor.h xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h xen-2.4.16/include/xeno/config.h xen-2.4.16/include/xeno/mm.h xen-2.4.16/include/xeno/sched.h xenolinux-2.4.16-sparse/arch/xeno/kernel/process.c xenolinux-2.4.16-sparse/arch/xeno/kernel/setup.c xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
line diff
     1.1 --- a/xen-2.4.16/arch/i386/boot/boot.S	Sun Jan 12 00:35:09 2003 +0000
     1.2 +++ b/xen-2.4.16/arch/i386/boot/boot.S	Wed Jan 15 00:21:24 2003 +0000
     1.3 @@ -225,11 +225,7 @@ ENTRY(gdt_table)
     1.4          .quad 0x00cff2000000bfff     /* 0x2b ring 3 3.95GB data at 0x0 */
     1.5          .quad 0x00cf9a000000ffff     /* 0x30 ring 0 4.00GB code at 0x0 */
     1.6          .quad 0x00cf92000000ffff     /* 0x38 ring 0 4.00GB data at 0x0 */
     1.7 -        .quad 0x0000000000000000
     1.8 -        .quad 0x0000000000000000
     1.9 -        .quad 0x0000000000000000
    1.10 -        .quad 0x0000000000000000
    1.11 -        .fill NR_CPUS*4,8,0             /* space for TSS's and LDT's */
    1.12 +        .fill NR_CPUS,8,0             /* space for TSS's */
    1.13  
    1.14  # The following adds 12kB to the kernel file size.
    1.15          .org 0x1000
     2.1 --- a/xen-2.4.16/arch/i386/entry.S	Sun Jan 12 00:35:09 2003 +0000
     2.2 +++ b/xen-2.4.16/arch/i386/entry.S	Wed Jan 15 00:21:24 2003 +0000
     2.3 @@ -516,8 +516,8 @@ ENTRY(hypervisor_call_table)
     2.4          .long SYMBOL_NAME(do_set_trap_table)
     2.5          .long SYMBOL_NAME(do_process_page_updates)
     2.6          .long SYMBOL_NAME(do_console_write)
     2.7 -        .long SYMBOL_NAME(sys_ni_syscall)
     2.8 -        .long SYMBOL_NAME(do_set_guest_stack)
     2.9 +        .long SYMBOL_NAME(do_set_gdt)
    2.10 +        .long SYMBOL_NAME(do_stack_and_ldt_switch)
    2.11          .long SYMBOL_NAME(do_net_update)
    2.12          .long SYMBOL_NAME(do_fpu_taskswitch)
    2.13          .long SYMBOL_NAME(do_yield)
    2.14 @@ -526,6 +526,7 @@ ENTRY(hypervisor_call_table)
    2.15          .long SYMBOL_NAME(do_network_op)
    2.16          .long SYMBOL_NAME(do_set_debugreg)
    2.17          .long SYMBOL_NAME(do_get_debugreg)
    2.18 +        .long SYMBOL_NAME(do_update_descriptor)
    2.19          .rept NR_syscalls-(.-hypervisor_call_table)/4
    2.20          .long SYMBOL_NAME(sys_ni_syscall)
    2.21  	.endr
     3.1 --- a/xen-2.4.16/arch/i386/mm.c	Sun Jan 12 00:35:09 2003 +0000
     3.2 +++ b/xen-2.4.16/arch/i386/mm.c	Wed Jan 15 00:21:24 2003 +0000
     3.3 @@ -91,7 +91,8 @@ void __init zap_low_mappings (void)
     3.4  }
     3.5  
     3.6  
     3.7 -long do_set_guest_stack(unsigned long ss, unsigned long esp)
     3.8 +long do_stack_and_ldt_switch(
     3.9 +    unsigned long ss, unsigned long esp, unsigned long ldts)
    3.10  {
    3.11      int nr = smp_processor_id();
    3.12      struct tss_struct *t = &init_tss[nr];
    3.13 @@ -99,6 +100,18 @@ long do_set_guest_stack(unsigned long ss
    3.14      if ( (ss == __HYPERVISOR_CS) || (ss == __HYPERVISOR_DS) )
    3.15          return -1;
    3.16  
    3.17 +    if ( ldts != current->mm.ldt_sel )
    3.18 +    {
    3.19 +        unsigned long *ptabent = GET_GDT_ADDRESS(current);
    3.20 +        /* Out of range for GDT table? */
    3.21 +        if ( (ldts * 8) > GET_GDT_ENTRIES(current) ) return -1;
    3.22 +        ptabent += ldts * 2; /* 8 bytes per desc == 2 * unsigned long */
    3.23 +        /* Not an LDT entry? (S=0b, type =0010b) */
    3.24 +        if ( (*ptabent & 0x00001f00) != 0x00000200 ) return -1;
    3.25 +        current->mm.ldt_sel = ldts;
    3.26 +        __load_LDT(ldts);
    3.27 +    }
    3.28 +
    3.29      current->thread.ss1  = ss;
    3.30      current->thread.esp1 = esp;
    3.31      t->ss1  = ss;
    3.32 @@ -106,3 +119,16 @@ long do_set_guest_stack(unsigned long ss
    3.33  
    3.34      return 0;
    3.35  }
    3.36 +
    3.37 +
    3.38 +long do_set_gdt(unsigned long *frame_list, int entries)
    3.39 +{
    3.40 +    return -ENOSYS;
    3.41 +}
    3.42 +
    3.43 +
    3.44 +long do_update_descriptor(
    3.45 +    unsigned long pa, unsigned long word1, unsigned long word2)
    3.46 +{
    3.47 +    return -ENOSYS;
    3.48 +}
     4.1 --- a/xen-2.4.16/arch/i386/process.c	Sun Jan 12 00:35:09 2003 +0000
     4.2 +++ b/xen-2.4.16/arch/i386/process.c	Wed Jan 15 00:21:24 2003 +0000
     4.3 @@ -380,6 +380,10 @@ void __switch_to(struct task_struct *pre
     4.4      asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs));
     4.5      asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
     4.6  
     4.7 +    /* Switch GDT and LDT. */
     4.8 +    __asm__ __volatile__ ("lgdt %0" : "=m" (*next_p->mm.gdt));
     4.9 +    __load_LDT(next_p->mm.ldt_sel);
    4.10 +
    4.11      /*
    4.12       * Restore %fs and %gs.
    4.13       */
     5.1 --- a/xen-2.4.16/arch/i386/setup.c	Sun Jan 12 00:35:09 2003 +0000
     5.2 +++ b/xen-2.4.16/arch/i386/setup.c	Wed Jan 15 00:21:24 2003 +0000
     5.3 @@ -194,7 +194,10 @@ void __init cpu_init(void)
     5.4          panic("CPU#%d already initialized!!!\n", nr);
     5.5      printk("Initializing CPU#%d\n", nr);
     5.6  
     5.7 -    __asm__ __volatile__("lgdt %0": "=m" (gdt_descr));
     5.8 +    /* Set up GDT and IDT. */
     5.9 +    SET_GDT_ENTRIES(current, DEFAULT_GDT_ENTRIES);
    5.10 +    SET_GDT_ADDRESS(current, DEFAULT_GDT_ADDRESS);
    5.11 +    __asm__ __volatile__("lgdt %0": "=m" (*current->mm.gdt));
    5.12      __asm__ __volatile__("lidt %0": "=m" (idt_descr));
    5.13  
    5.14      /* No nested task. */
     6.1 --- a/xen-2.4.16/arch/i386/traps.c	Sun Jan 12 00:35:09 2003 +0000
     6.2 +++ b/xen-2.4.16/arch/i386/traps.c	Wed Jan 15 00:21:24 2003 +0000
     6.3 @@ -514,11 +514,6 @@ void set_tss_desc(unsigned int n, void *
     6.4      _set_tssldt_desc(gdt_table+__TSS(n), (int)addr, 235, 0x89);
     6.5  }
     6.6  
     6.7 -void set_ldt_desc(unsigned int n, void *addr, unsigned int size)
     6.8 -{
     6.9 -    _set_tssldt_desc(gdt_table+__LDT(n), (int)addr, ((size << 3)-1), 0x82);
    6.10 -}
    6.11 -
    6.12  void __init trap_init(void)
    6.13  {
    6.14      set_trap_gate(0,&divide_error);
     7.1 --- a/xen-2.4.16/common/domain.c	Sun Jan 12 00:35:09 2003 +0000
     7.2 +++ b/xen-2.4.16/common/domain.c	Wed Jan 15 00:21:24 2003 +0000
     7.3 @@ -43,7 +43,10 @@ struct task_struct *do_newdomain(void)
     7.4      if (!p) goto newdomain_out;
     7.5      memset(p, 0, sizeof(*p));
     7.6      p->shared_info = (void *)get_free_page(GFP_KERNEL);
     7.7 -    memset(p->shared_info, 0, sizeof(shared_info_t));
     7.8 +    memset(p->shared_info, 0, PAGE_SIZE);
     7.9 +
    7.10 +    SET_GDT_ENTRIES(p, DEFAULT_GDT_ENTRIES);
    7.11 +    SET_GDT_ADDRESS(p, DEFAULT_GDT_ADDRESS);
    7.12  
    7.13      p->addr_limit = USER_DS;
    7.14      p->state      = TASK_UNINTERRUPTIBLE;
    7.15 @@ -247,6 +250,7 @@ void release_task(struct task_struct *p)
    7.16      {
    7.17          destroy_net_vif(p);
    7.18      }
    7.19 +    if ( p->mm.perdomain_pt ) free_page((unsigned long)p->mm.perdomain_pt);
    7.20      free_page((unsigned long)p->shared_info);
    7.21      free_task_struct(p);
    7.22  }
    7.23 @@ -462,6 +466,8 @@ int setup_guestos(struct task_struct *p,
    7.24      phys_l2tab = ALLOC_FRAME_FROM_DOMAIN();
    7.25      l2tab = map_domain_mem(phys_l2tab);
    7.26      memcpy(l2tab, idle_pg_table[p->processor], PAGE_SIZE);
    7.27 +    l2tab[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT] =
    7.28 +        mk_l2_pgentry(__pa(p->mm.perdomain_pt) | __PAGE_HYPERVISOR);
    7.29      memset(l2tab, 0, DOMAIN_ENTRIES_PER_L2_PAGETABLE*sizeof(l2_pgentry_t));
    7.30      p->mm.pagetable = mk_pagetable(phys_l2tab);
    7.31  
     8.1 --- a/xen-2.4.16/common/memory.c	Sun Jan 12 00:35:09 2003 +0000
     8.2 +++ b/xen-2.4.16/common/memory.c	Wed Jan 15 00:21:24 2003 +0000
     8.3 @@ -329,6 +329,9 @@ static int get_l2_table(unsigned long pa
     8.4      memcpy(p_l2_entry, 
     8.5             idle_pg_table[smp_processor_id()] + DOMAIN_ENTRIES_PER_L2_PAGETABLE,
     8.6             HYPERVISOR_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
     8.7 +    p_l2_entry[(PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT) -
     8.8 +              DOMAIN_ENTRIES_PER_L2_PAGETABLE] =
     8.9 +        mk_l2_pgentry(__pa(current->mm.perdomain_pt) | __PAGE_HYPERVISOR);
    8.10  
    8.11      return(ret);
    8.12  }
     9.1 --- a/xen-2.4.16/include/asm-i386/desc.h	Sun Jan 12 00:35:09 2003 +0000
     9.2 +++ b/xen-2.4.16/include/asm-i386/desc.h	Wed Jan 15 00:21:24 2003 +0000
     9.3 @@ -1,11 +1,8 @@
     9.4  #ifndef __ARCH_DESC_H
     9.5  #define __ARCH_DESC_H
     9.6  
     9.7 -#define __FIRST_TSS_ENTRY 12
     9.8 -#define __FIRST_LDT_ENTRY (__FIRST_TSS_ENTRY+1)
     9.9 -
    9.10 -#define __TSS(n) (((n)<<2) + __FIRST_TSS_ENTRY)
    9.11 -#define __LDT(n) (((n)<<2) + __FIRST_LDT_ENTRY)
    9.12 +#define __FIRST_TSS_ENTRY 8
    9.13 +#define __TSS(n) ((n) + __FIRST_TSS_ENTRY)
    9.14  
    9.15  #ifndef __ASSEMBLY__
    9.16  struct desc_struct {
    9.17 @@ -25,10 +22,9 @@ struct Xgt_desc_struct {
    9.18  
    9.19  #define load_TR(n) __asm__ __volatile__("ltr %%ax"::"a" (__TSS(n)<<3))
    9.20  
    9.21 -#define __load_LDT(n) __asm__ __volatile__("lldt %%ax"::"a" (__LDT(n)<<3))
    9.22 +#define __load_LDT(n) __asm__ __volatile__("lldt %%ax"::"a" ((n)<<3))
    9.23  
    9.24  extern void set_intr_gate(unsigned int irq, void * addr);
    9.25 -extern void set_ldt_desc(unsigned int n, void *addr, unsigned int size);
    9.26  extern void set_tss_desc(unsigned int n, void *addr);
    9.27  
    9.28  #endif /* !__ASSEMBLY__ */
    10.1 --- a/xen-2.4.16/include/asm-i386/processor.h	Sun Jan 12 00:35:09 2003 +0000
    10.2 +++ b/xen-2.4.16/include/asm-i386/processor.h	Wed Jan 15 00:21:24 2003 +0000
    10.3 @@ -375,7 +375,7 @@ struct thread_struct {
    10.4  	0,0,0,0, /* esp,ebp,esi,edi */				\
    10.5  	0,0,0,0,0,0, /* es,cs,ss */				\
    10.6  	0,0,0,0,0,0, /* ds,fs,gs */				\
    10.7 -	__LDT(0),0, /* ldt */					\
    10.8 +	0,0, /* ldt */						\
    10.9  	0, INVALID_IO_BITMAP_OFFSET, /* tace, bitmap */		\
   10.10  	{~0, } /* ioperm */					\
   10.11  }
    11.1 --- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Sun Jan 12 00:35:09 2003 +0000
    11.2 +++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Wed Jan 15 00:21:24 2003 +0000
    11.3 @@ -51,21 +51,34 @@ typedef struct
    11.4  } page_update_request_t;
    11.5  
    11.6  
    11.7 +/*
    11.8 + * Segment descriptor tables.
    11.9 + */
   11.10 +/* 8 entries, plus a TSS entry for each CPU (up to 32 CPUs). */
   11.11 +#define FIRST_DOMAIN_GDT_ENTRY  40
   11.12 +/* These are flat segments for domain bootstrap and fallback. */
   11.13 +#define FLAT_RING1_CS           0x11
   11.14 +#define FLAT_RING1_DS           0x19
   11.15 +#define FLAT_RING3_CS           0x23
   11.16 +#define FLAT_RING3_DS           0x2b
   11.17 +
   11.18 +
   11.19  /* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
   11.20  
   11.21 -#define __HYPERVISOR_set_trap_table  0
   11.22 -#define __HYPERVISOR_pt_update       1
   11.23 -#define __HYPERVISOR_console_write   2
   11.24 -/* vector 3 unused */
   11.25 -#define __HYPERVISOR_set_guest_stack 4
   11.26 -#define __HYPERVISOR_net_update      5
   11.27 -#define __HYPERVISOR_fpu_taskswitch  6
   11.28 -#define __HYPERVISOR_yield           7
   11.29 -#define __HYPERVISOR_exit            8
   11.30 -#define __HYPERVISOR_dom0_op         9
   11.31 -#define __HYPERVISOR_network_op     10
   11.32 -#define __HYPERVISOR_set_debugreg   11
   11.33 -#define __HYPERVISOR_get_debugreg   12
   11.34 +#define __HYPERVISOR_set_trap_table        0
   11.35 +#define __HYPERVISOR_pt_update             1
   11.36 +#define __HYPERVISOR_console_write         2
   11.37 +#define __HYPERVISOR_set_gdt               3
   11.38 +#define __HYPERVISOR_stack_and_ldt_switch  4
   11.39 +#define __HYPERVISOR_net_update            5
   11.40 +#define __HYPERVISOR_fpu_taskswitch        6
   11.41 +#define __HYPERVISOR_yield                 7
   11.42 +#define __HYPERVISOR_exit                  8
   11.43 +#define __HYPERVISOR_dom0_op               9
   11.44 +#define __HYPERVISOR_network_op           10
   11.45 +#define __HYPERVISOR_set_debugreg         11
   11.46 +#define __HYPERVISOR_get_debugreg         12
   11.47 +#define __HYPERVISOR_update_descriptor    13
   11.48  
   11.49  #define TRAP_INSTR "int $0x82"
   11.50  
    12.1 --- a/xen-2.4.16/include/xeno/config.h	Sun Jan 12 00:35:09 2003 +0000
    12.2 +++ b/xen-2.4.16/include/xeno/config.h	Wed Jan 15 00:21:24 2003 +0000
    12.3 @@ -41,12 +41,15 @@
    12.4  #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
    12.5  #define ____cacheline_aligned __cacheline_aligned
    12.6  
    12.7 -/* 0-16MB is fixed monitor space. 0-56MB is direct-mapped at top of memory.*/
    12.8 +/* 0-16MB is fixed monitor space. 0-52MB is direct-mapped at top of memory.*/
    12.9  #define MAX_MONITOR_ADDRESS   (16*1024*1024)
   12.10  #define MAX_DMA_ADDRESS       (16*1024*1024)
   12.11 -#define MAX_DIRECTMAP_ADDRESS (56*1024*1024)
   12.12 +#define MAX_DIRECTMAP_ADDRESS (52*1024*1024)
   12.13 +/* Next 4MB of virtual address space used for per-domain mappings (eg. GDT). */
   12.14 +#define PERDOMAIN_VIRT_START  (PAGE_OFFSET + MAX_DIRECTMAP_ADDRESS)
   12.15 +#define PERDOMAIN_VIRT_END    (PERDOMAIN_VIRT_START + (4*1024*1024))
   12.16  /* Penultimate 4MB of virtual address space used for domain page mappings. */
   12.17 -#define MAPCACHE_VIRT_START   (PAGE_OFFSET + MAX_DIRECTMAP_ADDRESS)
   12.18 +#define MAPCACHE_VIRT_START   (PERDOMAIN_VIRT_END)
   12.19  #define MAPCACHE_VIRT_END     (MAPCACHE_VIRT_START + (4*1024*1024))
   12.20  /* Final 4MB of virtual address space used for ioremap(). */
   12.21  #define IOREMAP_VIRT_START    (MAPCACHE_VIRT_END)
    13.1 --- a/xen-2.4.16/include/xeno/mm.h	Sun Jan 12 00:35:09 2003 +0000
    13.2 +++ b/xen-2.4.16/include/xeno/mm.h	Wed Jan 15 00:21:24 2003 +0000
    13.3 @@ -4,6 +4,7 @@
    13.4  
    13.5  #include <xeno/config.h>
    13.6  #include <asm/atomic.h>
    13.7 +#include <asm/desc.h>
    13.8  #include <xeno/list.h>
    13.9  #include <hypervisor-ifs/hypervisor-if.h>
   13.10  
   13.11 @@ -89,13 +90,15 @@ typedef struct pfn_info {
   13.12   * references exist of teh current type. A change in type can only occur
   13.13   * when type_count == 0.
   13.14   */
   13.15 -#define PG_type_mask        (7<<25) /* bits 25-27 */
   13.16 -#define PGT_none            (0<<25) /* no special uses of this page */
   13.17 -#define PGT_l1_page_table   (1<<25) /* using this page as an L1 page table? */
   13.18 -#define PGT_l2_page_table   (2<<25) /* using this page as an L2 page table? */
   13.19 -#define PGT_l3_page_table   (3<<25) /* using this page as an L3 page table? */
   13.20 -#define PGT_l4_page_table   (4<<25) /* using this page as an L4 page table? */
   13.21 -#define PGT_writeable_page  (7<<25) /* has writable mappings of this page? */
   13.22 +#define PG_type_mask        (7<<24) /* bits 24-26 */
   13.23 +#define PGT_none            (0<<24) /* no special uses of this page */
   13.24 +#define PGT_l1_page_table   (1<<24) /* using this page as an L1 page table? */
   13.25 +#define PGT_l2_page_table   (2<<24) /* using this page as an L2 page table? */
   13.26 +#define PGT_l3_page_table   (3<<24) /* using this page as an L3 page table? */
   13.27 +#define PGT_l4_page_table   (4<<24) /* using this page as an L4 page table? */
   13.28 +#define PGT_gdt_page        (5<<24) /* using this page in a GDT? */
   13.29 +#define PGT_ldt_page        (6<<24) /* using this page in an LDT? */
   13.30 +#define PGT_writeable_page  (7<<24) /* has writable mappings of this page? */
   13.31  
   13.32  #define PageSlab(page)		test_bit(PG_slab, &(page)->flags)
   13.33  #define PageSetSlab(page)	set_bit(PG_slab, &(page)->flags)
   13.34 @@ -114,4 +117,7 @@ void init_frametable(unsigned long nr_pa
   13.35  /* Part of the domain API. */
   13.36  int do_process_page_updates(page_update_request_t *updates, int count);
   13.37  
   13.38 +#define DEFAULT_GDT_ENTRIES     ((FIRST_DOMAIN_GDT_ENTRY*8)-1)
   13.39 +#define DEFAULT_GDT_ADDRESS     ((unsigned long)gdt_table)
   13.40 +
   13.41  #endif /* __XENO_MM_H__ */
    14.1 --- a/xen-2.4.16/include/xeno/sched.h	Sun Jan 12 00:35:09 2003 +0000
    14.2 +++ b/xen-2.4.16/include/xeno/sched.h	Wed Jan 15 00:21:24 2003 +0000
    14.3 @@ -19,13 +19,29 @@ extern rwlock_t tasklist_lock;
    14.4  
    14.5  struct mm_struct {
    14.6      unsigned long cpu_vm_mask;
    14.7 +    /*
    14.8 +     * Every domain has a L1 pagetable of its own. Per-domain mappings
    14.9 +     * are put in this table (eg. the current GDT is mapped here).
   14.10 +     */
   14.11 +    l2_pgentry_t *perdomain_pt;
   14.12      pagetable_t  pagetable;
   14.13 +    /* Current LDT selector. */
   14.14 +    unsigned int ldt_sel;
   14.15 +    /* Next entry is passed to LGDT on domain switch. */
   14.16 +    char gdt[6];
   14.17  };
   14.18  
   14.19 +/* Convenient accessor for mm.gdt. */
   14.20 +#define SET_GDT_ENTRIES(_p, _e) ((*(u16 *)((_p)->mm.gdt + 0)) = (_e))
   14.21 +#define SET_GDT_ADDRESS(_p, _a) ((*(u32 *)((_p)->mm.gdt + 2)) = (_a))
   14.22 +#define GET_GDT_ENTRIES(_p)     ((*(u16 *)((_p)->mm.gdt + 0)))
   14.23 +#define GET_GDT_ADDRESS(_p)     ((*(u32 *)((_p)->mm.gdt + 2)))
   14.24 +
   14.25  extern struct mm_struct init_mm;
   14.26  #define IDLE0_MM                                                    \
   14.27  {                                                                   \
   14.28      cpu_vm_mask: 0,                                                 \
   14.29 +    perdomain_pt: 0,                                                \
   14.30      pagetable:   mk_pagetable(__pa(idle0_pg_table))                 \
   14.31  }
   14.32  
    15.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/kernel/process.c	Sun Jan 12 00:35:09 2003 +0000
    15.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/kernel/process.c	Wed Jan 15 00:21:24 2003 +0000
    15.3 @@ -337,7 +337,7 @@ void __switch_to(struct task_struct *pre
    15.4  
    15.5      unlazy_fpu(prev_p);
    15.6  
    15.7 -    HYPERVISOR_set_guest_stack(__KERNEL_DS, next->esp0);
    15.8 +    HYPERVISOR_stack_and_ldt_switch(__KERNEL_DS, next->esp0, 0);
    15.9  
   15.10      /*
   15.11       * Save away %fs and %gs. No need to save %es and %ds, as
    16.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/kernel/setup.c	Sun Jan 12 00:35:09 2003 +0000
    16.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/kernel/setup.c	Wed Jan 15 00:21:24 2003 +0000
    16.3 @@ -954,7 +954,7 @@ void __init cpu_init (void)
    16.4          BUG();
    16.5      enter_lazy_tlb(&init_mm, current, nr);
    16.6  
    16.7 -    HYPERVISOR_set_guest_stack(__KERNEL_DS, current->thread.esp0);
    16.8 +    HYPERVISOR_stack_and_ldt_switch(__KERNEL_DS, current->thread.esp0, 0);
    16.9  
   16.10      /* Force FPU initialization. */
   16.11      current->flags &= ~PF_USEDFPU;
    17.1 --- a/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h	Sun Jan 12 00:35:09 2003 +0000
    17.2 +++ b/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h	Wed Jan 15 00:21:24 2003 +0000
    17.3 @@ -171,14 +171,26 @@ static inline int HYPERVISOR_console_wri
    17.4      return ret;
    17.5  }
    17.6  
    17.7 -static inline int HYPERVISOR_set_guest_stack(
    17.8 -    unsigned long ss, unsigned long esp)
    17.9 +static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
   17.10  {
   17.11      int ret;
   17.12      __asm__ __volatile__ (
   17.13          TRAP_INSTR
   17.14 -        : "=a" (ret) : "0" (__HYPERVISOR_set_guest_stack),
   17.15 -        "b" (ss), "c" (esp) );
   17.16 +        : "=a" (ret) : "0" (__HYPERVISOR_set_gdt), 
   17.17 +        "b" (frame_list), "c" (entries) );
   17.18 +
   17.19 +
   17.20 +    return ret;
   17.21 +}
   17.22 +
   17.23 +static inline int HYPERVISOR_stack_and_ldt_switch(
   17.24 +    unsigned long ss, unsigned long esp, unsigned long ldts)
   17.25 +{
   17.26 +    int ret;
   17.27 +    __asm__ __volatile__ (
   17.28 +        TRAP_INSTR
   17.29 +        : "=a" (ret) : "0" (__HYPERVISOR_stack_and_ldt_switch),
   17.30 +        "b" (ss), "c" (esp), "d" (ldts) );
   17.31  
   17.32      return ret;
   17.33  }
   17.34 @@ -267,4 +279,17 @@ static inline unsigned long HYPERVISOR_g
   17.35      return ret;
   17.36  }
   17.37  
   17.38 +static inline int HYPERVISOR_update_descriptor(
   17.39 +    unsigned long pa, unsigned long word1, unsigned long word2)
   17.40 +{
   17.41 +    int ret;
   17.42 +    __asm__ __volatile__ (
   17.43 +        TRAP_INSTR
   17.44 +        : "=a" (ret) : "0" (__HYPERVISOR_set_gdt), 
   17.45 +        "b" (pa), "c" (word1), "d" (word2) );
   17.46 +
   17.47 +
   17.48 +    return ret;
   17.49 +}
   17.50 +
   17.51  #endif /* __HYPERVISOR_H__ */