ia64/xen-unstable

changeset 3044:81e74f5bf690

bitkeeper revision 1.1159.170.50 (419cc892pqywup6fAiGc7HTzkaGmWQ)

Merge scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/auto/groups/xeno/BK/xen-unstable.bk
author kaf24@scramble.cl.cam.ac.uk
date Thu Nov 18 16:06:42 2004 +0000 (2004-11-18)
parents 4644bea63898 ceacd1c23c6c
children f5a6b3a8c9b9 e16455258e29
files xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/pdb-stub.c xen/arch/x86/traps.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/seg_fixup.c xen/include/asm-x86/processor.h xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/x86/dom0_ops.c	Thu Nov 18 15:31:32 2004 +0000
     1.2 +++ b/xen/arch/x86/dom0_ops.c	Thu Nov 18 16:06:42 2004 +0000
     1.3 @@ -142,12 +142,8 @@ void arch_getdomaininfo_ctxt(struct doma
     1.4      memcpy(c->debugreg, 
     1.5             d->thread.debugreg, 
     1.6             sizeof(d->thread.debugreg));
     1.7 -    c->event_callback_cs  =
     1.8 -        d->event_selector;
     1.9 -    c->event_callback_eip =
    1.10 -        d->event_address;
    1.11 -    c->failsafe_callback_cs  = 
    1.12 -        d->failsafe_selector;
    1.13 -    c->failsafe_callback_eip = 
    1.14 -        d->failsafe_address;
    1.15 +    c->event_callback_cs     = d->thread.event_selector;
    1.16 +    c->event_callback_eip    = d->thread.event_address;
    1.17 +    c->failsafe_callback_cs  = d->thread.failsafe_selector;
    1.18 +    c->failsafe_callback_eip = d->thread.failsafe_address;
    1.19  }
     2.1 --- a/xen/arch/x86/domain.c	Thu Nov 18 15:31:32 2004 +0000
     2.2 +++ b/xen/arch/x86/domain.c	Thu Nov 18 16:06:42 2004 +0000
     2.3 @@ -276,10 +276,10 @@ int arch_final_setup_guestos(struct doma
     2.4      for ( i = 0; i < 8; i++ )
     2.5          (void)set_debugreg(d, i, c->debugreg[i]);
     2.6  
     2.7 -    d->event_selector    = c->event_callback_cs;
     2.8 -    d->event_address     = c->event_callback_eip;
     2.9 -    d->failsafe_selector = c->failsafe_callback_cs;
    2.10 -    d->failsafe_address  = c->failsafe_callback_eip;
    2.11 +    d->thread.event_selector    = c->event_callback_cs;
    2.12 +    d->thread.event_address     = c->event_callback_eip;
    2.13 +    d->thread.failsafe_selector = c->failsafe_callback_cs;
    2.14 +    d->thread.failsafe_address  = c->failsafe_callback_eip;
    2.15      
    2.16      phys_basetab = c->pt_base;
    2.17      d->mm.pagetable = mk_pagetable(phys_basetab);
    2.18 @@ -741,8 +741,8 @@ int construct_dom0(struct domain *p,
    2.19       * We're basically forcing default RPLs to 1, so that our "what privilege
    2.20       * level are we returning to?" logic works.
    2.21       */
    2.22 -    p->failsafe_selector = FLAT_GUESTOS_CS;
    2.23 -    p->event_selector    = FLAT_GUESTOS_CS;
    2.24 +    p->thread.failsafe_selector = FLAT_GUESTOS_CS;
    2.25 +    p->thread.event_selector    = FLAT_GUESTOS_CS;
    2.26      p->thread.guestos_ss = FLAT_GUESTOS_DS;
    2.27      for ( i = 0; i < 256; i++ ) 
    2.28          p->thread.traps[i].cs = FLAT_GUESTOS_CS;
     3.1 --- a/xen/arch/x86/pdb-stub.c	Thu Nov 18 15:31:32 2004 +0000
     3.2 +++ b/xen/arch/x86/pdb-stub.c	Thu Nov 18 16:06:42 2004 +0000
     3.3 @@ -1217,8 +1217,8 @@ void pdb_key_pressed(unsigned char key)
     3.4  void pdb_handle_debug_trap(struct xen_regs *regs, long error_code)
     3.5  {
     3.6      unsigned int condition;
     3.7 -    struct domain *tsk = current;
     3.8 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
     3.9 +    struct domain *d = current;
    3.10 +    struct trap_bounce *tb = &d->thread.trap_bounce;
    3.11  
    3.12      __asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
    3.13      if ( (condition & (1 << 14)) != (1 << 14) )
    3.14 @@ -1227,11 +1227,11 @@ void pdb_handle_debug_trap(struct xen_re
    3.15  
    3.16      if ( pdb_handle_exception(1, regs) != 0 )
    3.17      {
    3.18 -        tsk->thread.debugreg[6] = condition;
    3.19 +        d->thread.debugreg[6] = condition;
    3.20  
    3.21 -        gtb->flags = GTBF_TRAP_NOCODE;
    3.22 -        gtb->cs    = tsk->thread.traps[1].cs;
    3.23 -        gtb->eip   = tsk->thread.traps[1].address;
    3.24 +        tb->flags = TBF_TRAP_NOCODE;
    3.25 +        tb->cs    = d->thread.traps[1].cs;
    3.26 +        tb->eip   = d->thread.traps[1].address;
    3.27      }
    3.28  }
    3.29  
     4.1 --- a/xen/arch/x86/traps.c	Thu Nov 18 15:31:32 2004 +0000
     4.2 +++ b/xen/arch/x86/traps.c	Thu Nov 18 16:06:42 2004 +0000
     4.3 @@ -52,8 +52,6 @@
     4.4  #include <asm/i387.h>
     4.5  #include <asm/debugger.h>
     4.6  
     4.7 -struct guest_trap_bounce guest_trap_bounce[NR_CPUS] = { { 0 } };
     4.8 -
     4.9  #if defined(__i386__)
    4.10  
    4.11  #define DOUBLEFAULT_STACK_SIZE 1024
    4.12 @@ -234,8 +232,8 @@ static inline void do_trap(int trapnr, c
    4.13                             struct xen_regs *regs, 
    4.14                             long error_code, int use_error_code)
    4.15  {
    4.16 -    struct domain *p = current;
    4.17 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
    4.18 +    struct domain *d = current;
    4.19 +    struct trap_bounce *tb = &d->thread.trap_bounce;
    4.20      trap_info_t *ti;
    4.21      unsigned long fixup;
    4.22  
    4.23 @@ -245,12 +243,12 @@ static inline void do_trap(int trapnr, c
    4.24          goto xen_fault;
    4.25  
    4.26      ti = current->thread.traps + trapnr;
    4.27 -    gtb->flags = use_error_code ? GTBF_TRAP : GTBF_TRAP_NOCODE;
    4.28 -    gtb->error_code = error_code;
    4.29 -    gtb->cs         = ti->cs;
    4.30 -    gtb->eip        = ti->address;
    4.31 +    tb->flags = use_error_code ? TBF_TRAP : TBF_TRAP_NOCODE;
    4.32 +    tb->error_code = error_code;
    4.33 +    tb->cs         = ti->cs;
    4.34 +    tb->eip        = ti->address;
    4.35      if ( TI_GET_IF(ti) )
    4.36 -        p->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.37 +        d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.38      return; 
    4.39  
    4.40   xen_fault:
    4.41 @@ -296,8 +294,8 @@ DO_ERROR_NOCODE(19, "simd error", simd_c
    4.42  
    4.43  asmlinkage void do_int3(struct xen_regs *regs, long error_code)
    4.44  {
    4.45 -    struct domain *p = current;
    4.46 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
    4.47 +    struct domain *d = current;
    4.48 +    struct trap_bounce *tb = &d->thread.trap_bounce;
    4.49      trap_info_t *ti;
    4.50  
    4.51      DEBUGGER_trap_entry(TRAP_int3, regs, error_code);
    4.52 @@ -312,12 +310,12 @@ asmlinkage void do_int3(struct xen_regs 
    4.53      }
    4.54  
    4.55      ti = current->thread.traps + 3;
    4.56 -    gtb->flags      = GTBF_TRAP_NOCODE;
    4.57 -    gtb->error_code = error_code;
    4.58 -    gtb->cs         = ti->cs;
    4.59 -    gtb->eip        = ti->address;
    4.60 +    tb->flags      = TBF_TRAP_NOCODE;
    4.61 +    tb->error_code = error_code;
    4.62 +    tb->cs         = ti->cs;
    4.63 +    tb->eip        = ti->address;
    4.64      if ( TI_GET_IF(ti) )
    4.65 -        p->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.66 +        d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.67  }
    4.68  
    4.69  asmlinkage void do_double_fault(void)
    4.70 @@ -359,11 +357,11 @@ asmlinkage void do_machine_check(struct 
    4.71  
    4.72  asmlinkage void do_page_fault(struct xen_regs *regs, long error_code)
    4.73  {
    4.74 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
    4.75      trap_info_t *ti;
    4.76      unsigned long off, addr, fixup;
    4.77      struct domain *d = current;
    4.78      extern int map_ldt_shadow_page(unsigned int);
    4.79 +    struct trap_bounce *tb = &d->thread.trap_bounce;
    4.80      int cpu = d->processor;
    4.81  
    4.82      __asm__ __volatile__ ("movl %%cr2,%0" : "=r" (addr) : );
    4.83 @@ -409,11 +407,11 @@ asmlinkage void do_page_fault(struct xen
    4.84          goto xen_fault;
    4.85  
    4.86      ti = d->thread.traps + 14;
    4.87 -    gtb->flags = GTBF_TRAP_CR2; /* page fault pushes %cr2 */
    4.88 -    gtb->cr2        = addr;
    4.89 -    gtb->error_code = error_code;
    4.90 -    gtb->cs         = ti->cs;
    4.91 -    gtb->eip        = ti->address;
    4.92 +    tb->flags = TBF_TRAP_CR2; /* page fault pushes %cr2 */
    4.93 +    tb->cr2        = addr;
    4.94 +    tb->error_code = error_code;
    4.95 +    tb->cs         = ti->cs;
    4.96 +    tb->eip        = ti->address;
    4.97      if ( TI_GET_IF(ti) )
    4.98          d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.99      return; 
   4.100 @@ -458,7 +456,7 @@ asmlinkage void do_page_fault(struct xen
   4.101  asmlinkage void do_general_protection(struct xen_regs *regs, long error_code)
   4.102  {
   4.103      struct domain *d = current;
   4.104 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
   4.105 +    struct trap_bounce *tb = &d->thread.trap_bounce;
   4.106      trap_info_t *ti;
   4.107      unsigned long fixup;
   4.108  
   4.109 @@ -494,7 +492,7 @@ asmlinkage void do_general_protection(st
   4.110          ti = current->thread.traps + (error_code>>3);
   4.111          if ( TI_GET_DPL(ti) >= (regs->cs & 3) )
   4.112          {
   4.113 -            gtb->flags = GTBF_TRAP_NOCODE;
   4.114 +            tb->flags = TBF_TRAP_NOCODE;
   4.115              regs->eip += 2;
   4.116              goto finish_propagation;
   4.117          }
   4.118 @@ -509,11 +507,11 @@ asmlinkage void do_general_protection(st
   4.119  
   4.120      /* Pass on GPF as is. */
   4.121      ti = current->thread.traps + 13;
   4.122 -    gtb->flags      = GTBF_TRAP;
   4.123 -    gtb->error_code = error_code;
   4.124 +    tb->flags      = TBF_TRAP;
   4.125 +    tb->error_code = error_code;
   4.126   finish_propagation:
   4.127 -    gtb->cs         = ti->cs;
   4.128 -    gtb->eip        = ti->address;
   4.129 +    tb->cs         = ti->cs;
   4.130 +    tb->eip        = ti->address;
   4.131      if ( TI_GET_IF(ti) )
   4.132          d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
   4.133      return;
   4.134 @@ -599,18 +597,18 @@ asmlinkage void math_state_restore(struc
   4.135  
   4.136      if ( test_and_clear_bit(DF_GUEST_STTS, &current->flags) )
   4.137      {
   4.138 -        struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
   4.139 -        gtb->flags      = GTBF_TRAP_NOCODE;
   4.140 -        gtb->cs         = current->thread.traps[7].cs;
   4.141 -        gtb->eip        = current->thread.traps[7].address;
   4.142 +        struct trap_bounce *tb = &current->thread.trap_bounce;
   4.143 +        tb->flags      = TBF_TRAP_NOCODE;
   4.144 +        tb->cs         = current->thread.traps[7].cs;
   4.145 +        tb->eip        = current->thread.traps[7].address;
   4.146      }
   4.147  }
   4.148  
   4.149  asmlinkage void do_debug(struct xen_regs *regs, long error_code)
   4.150  {
   4.151      unsigned int condition;
   4.152 -    struct domain *tsk = current;
   4.153 -    struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
   4.154 +    struct domain *d = current;
   4.155 +    struct trap_bounce *tb = &d->thread.trap_bounce;
   4.156  
   4.157      DEBUGGER_trap_entry(TRAP_debug, regs, error_code);
   4.158  
   4.159 @@ -618,7 +616,7 @@ asmlinkage void do_debug(struct xen_regs
   4.160  
   4.161      /* Mask out spurious debug traps due to lazy DR7 setting */
   4.162      if ( (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) &&
   4.163 -         (tsk->thread.debugreg[7] == 0) )
   4.164 +         (d->thread.debugreg[7] == 0) )
   4.165      {
   4.166          __asm__("movl %0,%%db7" : : "r" (0));
   4.167          return;
   4.168 @@ -638,11 +636,11 @@ asmlinkage void do_debug(struct xen_regs
   4.169      }
   4.170  
   4.171      /* Save debug status register where guest OS can peek at it */
   4.172 -    tsk->thread.debugreg[6] = condition;
   4.173 +    d->thread.debugreg[6] = condition;
   4.174  
   4.175 -    gtb->flags = GTBF_TRAP_NOCODE;
   4.176 -    gtb->cs    = tsk->thread.traps[1].cs;
   4.177 -    gtb->eip   = tsk->thread.traps[1].address;
   4.178 +    tb->flags = TBF_TRAP_NOCODE;
   4.179 +    tb->cs    = d->thread.traps[1].cs;
   4.180 +    tb->eip   = d->thread.traps[1].address;
   4.181  }
   4.182  
   4.183  
   4.184 @@ -800,15 +798,15 @@ long do_set_callbacks(unsigned long even
   4.185                        unsigned long failsafe_selector,
   4.186                        unsigned long failsafe_address)
   4.187  {
   4.188 -    struct domain *p = current;
   4.189 +    struct domain *d = current;
   4.190  
   4.191      if ( !VALID_CODESEL(event_selector) || !VALID_CODESEL(failsafe_selector) )
   4.192          return -EPERM;
   4.193  
   4.194 -    p->event_selector    = event_selector;
   4.195 -    p->event_address     = event_address;
   4.196 -    p->failsafe_selector = failsafe_selector;
   4.197 -    p->failsafe_address  = failsafe_address;
   4.198 +    d->thread.event_selector    = event_selector;
   4.199 +    d->thread.event_address     = event_address;
   4.200 +    d->thread.failsafe_selector = failsafe_selector;
   4.201 +    d->thread.failsafe_address  = failsafe_address;
   4.202  
   4.203      return 0;
   4.204  }
     5.1 --- a/xen/arch/x86/x86_32/asm-offsets.c	Thu Nov 18 15:31:32 2004 +0000
     5.2 +++ b/xen/arch/x86/x86_32/asm-offsets.c	Thu Nov 18 16:06:42 2004 +0000
     5.3 @@ -36,10 +36,11 @@ void __dummy__(void)
     5.4  
     5.5      OFFSET(DOMAIN_processor, struct domain, processor);
     5.6      OFFSET(DOMAIN_shared_info, struct domain, shared_info);
     5.7 -    OFFSET(DOMAIN_event_sel, struct domain, event_selector);
     5.8 -    OFFSET(DOMAIN_event_addr, struct domain, event_address);
     5.9 -    OFFSET(DOMAIN_failsafe_sel, struct domain, failsafe_selector);
    5.10 -    OFFSET(DOMAIN_failsafe_addr, struct domain, failsafe_address);
    5.11 +    OFFSET(DOMAIN_event_sel, struct domain, thread.event_selector);
    5.12 +    OFFSET(DOMAIN_event_addr, struct domain, thread.event_address);
    5.13 +    OFFSET(DOMAIN_failsafe_sel, struct domain, thread.failsafe_selector);
    5.14 +    OFFSET(DOMAIN_failsafe_addr, struct domain, thread.failsafe_address);
    5.15 +    OFFSET(DOMAIN_trap_bounce, struct domain, thread.trap_bounce);
    5.16      BLANK();
    5.17  
    5.18      OFFSET(SHINFO_upcall_pending, shared_info_t, 
    5.19 @@ -48,10 +49,10 @@ void __dummy__(void)
    5.20             vcpu_data[0].evtchn_upcall_mask);
    5.21      BLANK();
    5.22  
    5.23 -    OFFSET(GTB_error_code, struct guest_trap_bounce, error_code);
    5.24 -    OFFSET(GTB_cr2, struct guest_trap_bounce, cr2);
    5.25 -    OFFSET(GTB_flags, struct guest_trap_bounce, flags);
    5.26 -    OFFSET(GTB_cs, struct guest_trap_bounce, cs);
    5.27 -    OFFSET(GTB_eip, struct guest_trap_bounce, eip);
    5.28 +    OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
    5.29 +    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
    5.30 +    OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
    5.31 +    OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
    5.32 +    OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
    5.33      BLANK();
    5.34  }
     6.1 --- a/xen/arch/x86/x86_32/entry.S	Thu Nov 18 15:31:32 2004 +0000
     6.2 +++ b/xen/arch/x86/x86_32/entry.S	Thu Nov 18 16:06:42 2004 +0000
     6.3 @@ -196,13 +196,11 @@ 7:      SET_XEN_SEGMENTS(a)
     6.4  /* No special register assumptions */
     6.5  failsafe_callback:
     6.6          GET_CURRENT(%ebx)
     6.7 -        movl DOMAIN_processor(%ebx),%eax
     6.8 -        shl  $4,%eax
     6.9 -        lea  guest_trap_bounce(%eax),%edx
    6.10 +        leal DOMAIN_trap_bounce(%ebx),%edx
    6.11          movl DOMAIN_failsafe_addr(%ebx),%eax
    6.12 -        movl %eax,GTB_eip(%edx)
    6.13 +        movl %eax,TRAPBOUNCE_eip(%edx)
    6.14          movl DOMAIN_failsafe_sel(%ebx),%eax
    6.15 -        movw %ax,GTB_cs(%edx)
    6.16 +        movw %ax,TRAPBOUNCE_cs(%edx)
    6.17          call create_bounce_frame
    6.18          subl $16,%esi                # add DS/ES/FS/GS to failsafe stack frame
    6.19          movl XREGS_ds(%esp),%eax
    6.20 @@ -265,13 +263,11 @@ test_all_events:
    6.21          jz   restore_all_guest
    6.22          movb $1,SHINFO_upcall_mask(%eax) # Upcalls are masked during delivery
    6.23  /*process_guest_events:*/
    6.24 -        movl DOMAIN_processor(%ebx),%edx
    6.25 -        shl  $4,%edx                     # sizeof(guest_trap_bounce) == 16
    6.26 -        lea  guest_trap_bounce(%edx),%edx
    6.27 +        leal DOMAIN_trap_bounce(%ebx),%edx
    6.28          movl DOMAIN_event_addr(%ebx),%eax
    6.29 -        movl %eax,GTB_eip(%edx)
    6.30 +        movl %eax,TRAPBOUNCE_eip(%edx)
    6.31          movl DOMAIN_event_sel(%ebx),%eax
    6.32 -        movw %ax,GTB_cs(%edx)
    6.33 +        movw %ax,TRAPBOUNCE_cs(%edx)
    6.34          call create_bounce_frame
    6.35          jmp  restore_all_guest
    6.36  
    6.37 @@ -283,7 +279,7 @@ process_softirqs:
    6.38                  
    6.39  /* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK:            */
    6.40  /*   {EIP, CS, EFLAGS, [ESP, SS]}                                        */
    6.41 -/* %edx == guest_trap_bounce, %ebx == task_struct                        */
    6.42 +/* %edx == trap_bounce, %ebx == task_struct                              */
    6.43  /* %eax,%ecx are clobbered. %gs:%esi contain new XREGS_ss/XREGS_esp. */
    6.44  create_bounce_frame:        
    6.45          mov  XREGS_cs+4(%esp),%cl
    6.46 @@ -323,9 +319,9 @@ FAULT12:movl %eax,%gs:8(%esi)
    6.47          movl %eax,XREGS_eflags+4(%esp)
    6.48          movl %gs,XREGS_ss+4(%esp)
    6.49          movl %esi,XREGS_esp+4(%esp)
    6.50 -        movzwl GTB_cs(%edx),%eax
    6.51 +        movzwl TRAPBOUNCE_cs(%edx),%eax
    6.52          movl %eax,XREGS_cs+4(%esp)
    6.53 -        movl GTB_eip(%edx),%eax
    6.54 +        movl TRAPBOUNCE_eip(%edx),%eax
    6.55          movl %eax,XREGS_eip+4(%esp)
    6.56          ret
    6.57  
    6.58 @@ -362,25 +358,23 @@ crash_domain_fixup3:
    6.59  
    6.60          ALIGN
    6.61  process_guest_exception_and_events:        
    6.62 -        movl DOMAIN_processor(%ebx),%eax
    6.63 -        shl  $4,%eax
    6.64 -        lea  guest_trap_bounce(%eax),%edx
    6.65 -        testb $~0,GTB_flags(%edx)
    6.66 +        leal DOMAIN_trap_bounce(%ebx),%edx
    6.67 +        testb $~0,TRAPBOUNCE_flags(%edx)
    6.68          jz   test_all_events
    6.69          call create_bounce_frame        # just the basic frame
    6.70 -        mov  GTB_flags(%edx),%cl
    6.71 -        test $GTBF_TRAP_NOCODE,%cl
    6.72 +        mov  TRAPBOUNCE_flags(%edx),%cl
    6.73 +        test $TBF_TRAP_NOCODE,%cl
    6.74          jnz  2f
    6.75          subl $4,%esi                    # push error_code onto guest frame
    6.76 -        movl GTB_error_code(%edx),%eax
    6.77 +        movl TRAPBOUNCE_error_code(%edx),%eax
    6.78  FAULT13:movl %eax,%gs:(%esi)
    6.79 -        test $GTBF_TRAP_CR2,%cl
    6.80 +        test $TBF_TRAP_CR2,%cl
    6.81          jz   1f
    6.82          subl $4,%esi                    # push %cr2 onto guest frame
    6.83 -        movl GTB_cr2(%edx),%eax
    6.84 +        movl TRAPBOUNCE_cr2(%edx),%eax
    6.85  FAULT14:movl %eax,%gs:(%esi)
    6.86  1:      movl %esi,XREGS_esp(%esp)        
    6.87 -2:      movb $0,GTB_flags(%edx)
    6.88 +2:      movb $0,TRAPBOUNCE_flags(%edx)
    6.89          jmp  test_all_events
    6.90  
    6.91          ALIGN
     7.1 --- a/xen/arch/x86/x86_32/seg_fixup.c	Thu Nov 18 15:31:32 2004 +0000
     7.2 +++ b/xen/arch/x86/x86_32/seg_fixup.c	Thu Nov 18 16:06:42 2004 +0000
     7.3 @@ -286,7 +286,7 @@ int gpf_emulate_4gb(struct xen_regs *reg
     7.4  {
     7.5      struct domain *d = current;
     7.6      trap_info_t   *ti;
     7.7 -    struct guest_trap_bounce *gtb;
     7.8 +    struct trap_bounce *tb;
     7.9      u8            modrm, mod, reg, rm, decode;
    7.10      void         *memreg, *regreg;
    7.11      unsigned long offset;
    7.12 @@ -466,11 +466,11 @@ int gpf_emulate_4gb(struct xen_regs *reg
    7.13      if ( VM_ASSIST(d, VMASST_TYPE_4gb_segments_notify) )
    7.14      {
    7.15          ti  = &d->thread.traps[15];
    7.16 -        gtb = &guest_trap_bounce[d->processor];
    7.17 -        gtb->flags      = GTBF_TRAP;
    7.18 -        gtb->error_code = pb - eip;
    7.19 -        gtb->cs         = ti->cs;
    7.20 -        gtb->eip        = ti->address;
    7.21 +        tb = &d->thread.trap_bounce;
    7.22 +        tb->flags      = TBF_TRAP;
    7.23 +        tb->error_code = pb - eip;
    7.24 +        tb->cs         = ti->cs;
    7.25 +        tb->eip        = ti->address;
    7.26          if ( TI_GET_IF(ti) )
    7.27              d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    7.28      }
     8.1 --- a/xen/include/asm-x86/processor.h	Thu Nov 18 15:31:32 2004 +0000
     8.2 +++ b/xen/include/asm-x86/processor.h	Thu Nov 18 16:06:42 2004 +0000
     8.3 @@ -85,11 +85,11 @@
     8.4  #define X86_CR4_OSXMMEXCPT	0x0400	/* enable unmasked SSE exceptions */
     8.5  
     8.6  /*
     8.7 - * 'guest_trap_bounce' flags values.
     8.8 + * 'trap_bounce' flags values.
     8.9   */
    8.10 -#define GTBF_TRAP        1
    8.11 -#define GTBF_TRAP_NOCODE 2
    8.12 -#define GTBF_TRAP_CR2    4
    8.13 +#define TBF_TRAP        1
    8.14 +#define TBF_TRAP_NOCODE 2
    8.15 +#define TBF_TRAP_CR2    4
    8.16  
    8.17  #ifndef __ASSEMBLY__
    8.18  
    8.19 @@ -298,16 +298,44 @@ struct tss_struct {
    8.20      u32 __cacheline_filler[5];
    8.21  };
    8.22  
    8.23 +struct trap_bounce {
    8.24 +    unsigned long  error_code;
    8.25 +    unsigned long  cr2;
    8.26 +    unsigned short flags; /* TBF_ */
    8.27 +    unsigned short cs;
    8.28 +    unsigned long  eip;
    8.29 +};
    8.30 +
    8.31  struct thread_struct {
    8.32      unsigned long      guestos_sp;
    8.33      unsigned long      guestos_ss;
    8.34 -/* Hardware debugging registers */
    8.35 +
    8.36 +    /* Hardware debugging registers */
    8.37      unsigned long      debugreg[8];  /* %%db0-7 debug registers */
    8.38 -/* floating point info */
    8.39 +
    8.40 +    /* floating point info */
    8.41      struct i387_state  i387;
    8.42 -/* general user-visible register state */
    8.43 +
    8.44 +    /* general user-visible register state */
    8.45      execution_context_t user_ctxt;
    8.46 -/* Trap info. */
    8.47 +
    8.48 +    /*
    8.49 +     * Return vectors pushed to us by guest OS.
    8.50 +     * The stack frame for events is exactly that of an x86 hardware interrupt.
    8.51 +     * The stack frame for a failsafe callback is augmented with saved values
    8.52 +     * for segment registers %ds, %es, %fs and %gs:
    8.53 +     * 	%ds, %es, %fs, %gs, %eip, %cs, %eflags [, %oldesp, %oldss]
    8.54 +     */
    8.55 +    unsigned long event_selector;    /* 08: entry CS  */
    8.56 +    unsigned long event_address;     /* 12: entry EIP */
    8.57 +
    8.58 +    unsigned long failsafe_selector; /* 16: entry CS  */
    8.59 +    unsigned long failsafe_address;  /* 20: entry EIP */
    8.60 +
    8.61 +    /* Bounce information for propagating an exception to guest OS. */
    8.62 +    struct trap_bounce trap_bounce;
    8.63 +
    8.64 +    /* Trap info. */
    8.65  #ifdef __i386__
    8.66      int                fast_trap_idx;
    8.67      struct desc_struct fast_trap_desc;
    8.68 @@ -343,14 +371,7 @@ extern struct desc_struct *idt_tables[];
    8.69  
    8.70  long set_fast_trap(struct domain *p, int idx);
    8.71  
    8.72 -#define INIT_THREAD  {						\
    8.73 -	0, 0,		      		       			\
    8.74 -	{ [0 ... 7] = 0 },	/* debugging registers */	\
    8.75 -	{ { 0, }, },		/* 387 state */			\
    8.76 -	{ 0 },							\
    8.77 -	0x20, { 0, 0 },		/* DEFAULT_FAST_TRAP */		\
    8.78 -	{ {0} }			/* io permissions */		\
    8.79 -}
    8.80 +#define INIT_THREAD  { fast_trap_idx: 0x20 }
    8.81  
    8.82  #elif defined(__x86_64__)
    8.83  
    8.84 @@ -358,15 +379,6 @@ long set_fast_trap(struct domain *p, int
    8.85  
    8.86  #endif /* __x86_64__ */
    8.87  
    8.88 -struct guest_trap_bounce {
    8.89 -    unsigned long  error_code;        /*   0 */
    8.90 -    unsigned long  cr2;               /*   4 */
    8.91 -    unsigned short flags;             /*   8 */
    8.92 -    unsigned short cs;                /*  10 */
    8.93 -    unsigned long  eip;               /*  12 */
    8.94 -};
    8.95 -extern struct guest_trap_bounce guest_trap_bounce[];
    8.96 -
    8.97  extern int gpf_emulate_4gb(struct xen_regs *regs);
    8.98  
    8.99  struct mm_struct {
     9.1 --- a/xen/include/xen/sched.h	Thu Nov 18 15:31:32 2004 +0000
     9.2 +++ b/xen/include/xen/sched.h	Thu Nov 18 16:06:42 2004 +0000
     9.3 @@ -55,32 +55,9 @@ void destroy_event_channels(struct domai
     9.4  
     9.5  struct domain 
     9.6  {
     9.7 -    /*
     9.8 -     * DO NOT CHANGE THE ORDER OF THE FOLLOWING.
     9.9 -     * Their offsets are hardcoded in entry.S
    9.10 -     */
    9.11 -
    9.12 -    u32 processor;               /* 00: current processor */
    9.13 -
    9.14 -    /* An unsafe pointer into a shared data area. */
    9.15 -    shared_info_t *shared_info;  /* 04: shared data area */
    9.16 +    u32 processor;
    9.17  
    9.18 -    /*
    9.19 -     * Return vectors pushed to us by guest OS.
    9.20 -     * The stack frame for events is exactly that of an x86 hardware interrupt.
    9.21 -     * The stack frame for a failsafe callback is augmented with saved values
    9.22 -     * for segment registers %ds, %es, %fs and %gs:
    9.23 -     * 	%ds, %es, %fs, %gs, %eip, %cs, %eflags [, %oldesp, %oldss]
    9.24 -     */
    9.25 -    unsigned long event_selector;    /* 08: entry CS  */
    9.26 -    unsigned long event_address;     /* 12: entry EIP */
    9.27 -
    9.28 -    unsigned long failsafe_selector; /* 16: entry CS  */
    9.29 -    unsigned long failsafe_address;  /* 20: entry EIP */
    9.30 -
    9.31 -    /*
    9.32 -     * From here on things can be added and shuffled without special attention
    9.33 -     */
    9.34 +    shared_info_t *shared_info;
    9.35  
    9.36      domid_t  id;
    9.37      s_time_t create_time;