ia64/xen-unstable

changeset 16575:d4d3b2f1714d

x86: eliminate (unused) return value from exception handling routines
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Dec 10 11:49:12 2007 +0000 (2007-12-10)
parents 8d5517355aa8
children 40812c9d96e7
files xen/arch/x86/traps.c xen/include/asm-x86/debugger.h xen/include/asm-x86/processor.h
line diff
     1.1 --- a/xen/arch/x86/traps.c	Mon Dec 10 11:41:40 2007 +0000
     1.2 +++ b/xen/arch/x86/traps.c	Mon Dec 10 11:49:12 2007 +0000
     1.3 @@ -86,12 +86,11 @@ idt_entry_t *idt_tables[NR_CPUS] __read_
     1.4  
     1.5  #define DECLARE_TRAP_HANDLER(_name)                     \
     1.6  asmlinkage void _name(void);                            \
     1.7 -asmlinkage int do_ ## _name(struct cpu_user_regs *regs)
     1.8 -
     1.9 -asmlinkage void nmi(void);
    1.10 -asmlinkage void machine_check(void);
    1.11 +asmlinkage void do_ ## _name(struct cpu_user_regs *regs)
    1.12 +
    1.13  DECLARE_TRAP_HANDLER(divide_error);
    1.14  DECLARE_TRAP_HANDLER(debug);
    1.15 +DECLARE_TRAP_HANDLER(nmi);
    1.16  DECLARE_TRAP_HANDLER(int3);
    1.17  DECLARE_TRAP_HANDLER(overflow);
    1.18  DECLARE_TRAP_HANDLER(bounds);
    1.19 @@ -105,6 +104,7 @@ DECLARE_TRAP_HANDLER(general_protection)
    1.20  DECLARE_TRAP_HANDLER(page_fault);
    1.21  DECLARE_TRAP_HANDLER(coprocessor_error);
    1.22  DECLARE_TRAP_HANDLER(simd_coprocessor_error);
    1.23 +DECLARE_TRAP_HANDLER(machine_check);
    1.24  DECLARE_TRAP_HANDLER(alignment_check);
    1.25  DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
    1.26  
    1.27 @@ -382,7 +382,7 @@ asmlinkage void fatal_trap(int trapnr, s
    1.28            (regs->eflags & X86_EFLAGS_IF) ? "" : ", IN INTERRUPT CONTEXT");
    1.29  }
    1.30  
    1.31 -static int do_guest_trap(
    1.32 +static void do_guest_trap(
    1.33      int trapnr, const struct cpu_user_regs *regs, int use_error_code)
    1.34  {
    1.35      struct vcpu *v = current;
    1.36 @@ -411,8 +411,6 @@ static int do_guest_trap(
    1.37          gdprintk(XENLOG_WARNING, "Unhandled %s fault/trap [#%d] "
    1.38                   "on VCPU %d [ec=%04x]\n",
    1.39                   trapstr(trapnr), trapnr, v->vcpu_id, regs->error_code);
    1.40 -
    1.41 -    return 0;
    1.42  }
    1.43  
    1.44  static void instruction_done(
    1.45 @@ -477,7 +475,7 @@ asmlinkage int set_guest_nmi_trapbounce(
    1.46      return !null_trap_bounce(v, tb);
    1.47  }
    1.48  
    1.49 -static inline int do_trap(
    1.50 +static inline void do_trap(
    1.51      int trapnr, struct cpu_user_regs *regs, int use_error_code)
    1.52  {
    1.53      unsigned long fixup;
    1.54 @@ -485,14 +483,17 @@ static inline int do_trap(
    1.55      DEBUGGER_trap_entry(trapnr, regs);
    1.56  
    1.57      if ( guest_mode(regs) )
    1.58 -        return do_guest_trap(trapnr, regs, use_error_code);
    1.59 +    {
    1.60 +        do_guest_trap(trapnr, regs, use_error_code);
    1.61 +        return;
    1.62 +    }
    1.63  
    1.64      if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
    1.65      {
    1.66          dprintk(XENLOG_ERR, "Trap %d: %p -> %p\n",
    1.67                  trapnr, _p(regs->eip), _p(fixup));
    1.68          regs->eip = fixup;
    1.69 -        return 0;
    1.70 +        return;
    1.71      }
    1.72  
    1.73      DEBUGGER_trap_fatal(trapnr, regs);
    1.74 @@ -501,19 +502,18 @@ static inline int do_trap(
    1.75      panic("FATAL TRAP: vector = %d (%s)\n"
    1.76            "[error_code=%04x]\n",
    1.77            trapnr, trapstr(trapnr), regs->error_code);
    1.78 -    return 0;
    1.79  }
    1.80  
    1.81  #define DO_ERROR_NOCODE(trapnr, name)                   \
    1.82 -asmlinkage int do_##name(struct cpu_user_regs *regs)    \
    1.83 +asmlinkage void do_##name(struct cpu_user_regs *regs)   \
    1.84  {                                                       \
    1.85 -    return do_trap(trapnr, regs, 0);                    \
    1.86 +    do_trap(trapnr, regs, 0);                           \
    1.87  }
    1.88  
    1.89  #define DO_ERROR(trapnr, name)                          \
    1.90 -asmlinkage int do_##name(struct cpu_user_regs *regs)    \
    1.91 +asmlinkage void do_##name(struct cpu_user_regs *regs)   \
    1.92  {                                                       \
    1.93 -    return do_trap(trapnr, regs, 1);                    \
    1.94 +    do_trap(trapnr, regs, 1);                           \
    1.95  }
    1.96  
    1.97  DO_ERROR_NOCODE(TRAP_divide_error,    divide_error)
    1.98 @@ -714,20 +714,20 @@ static int emulate_forced_invalid_op(str
    1.99      return EXCRET_fault_fixed;
   1.100  }
   1.101  
   1.102 -asmlinkage int do_invalid_op(struct cpu_user_regs *regs)
   1.103 +asmlinkage void do_invalid_op(struct cpu_user_regs *regs)
   1.104  {
   1.105      struct bug_frame bug;
   1.106      struct bug_frame_str bug_str;
   1.107      char *filename, *predicate, *eip = (char *)regs->eip;
   1.108 -    int rc, id, lineno;
   1.109 +    int id, lineno;
   1.110  
   1.111      DEBUGGER_trap_entry(TRAP_invalid_op, regs);
   1.112  
   1.113      if ( likely(guest_mode(regs)) )
   1.114      {
   1.115 -        if ( (rc = emulate_forced_invalid_op(regs)) != 0 )
   1.116 -            return rc;
   1.117 -        return do_guest_trap(TRAP_invalid_op, regs, 0);
   1.118 +        if ( !emulate_forced_invalid_op(regs) )
   1.119 +            do_guest_trap(TRAP_invalid_op, regs, 0);
   1.120 +        return;
   1.121      }
   1.122  
   1.123      if ( !is_kernel(eip) ||
   1.124 @@ -743,7 +743,7 @@ asmlinkage int do_invalid_op(struct cpu_
   1.125      {
   1.126          show_execution_state(regs);
   1.127          regs->eip = (unsigned long)eip;
   1.128 -        return EXCRET_fault_fixed;
   1.129 +        return;
   1.130      }
   1.131  
   1.132      /* WARN, BUG or ASSERT: decode the filename pointer and line number. */
   1.133 @@ -761,7 +761,7 @@ asmlinkage int do_invalid_op(struct cpu_
   1.134          printk("Xen WARN at %.50s:%d\n", filename, lineno);
   1.135          show_execution_state(regs);
   1.136          regs->eip = (unsigned long)eip;
   1.137 -        return EXCRET_fault_fixed;
   1.138 +        return;
   1.139      }
   1.140  
   1.141      if ( id == BUGFRAME_bug )
   1.142 @@ -792,10 +792,9 @@ asmlinkage int do_invalid_op(struct cpu_
   1.143      DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
   1.144      show_execution_state(regs);
   1.145      panic("FATAL TRAP: vector = %d (invalid opcode)\n", TRAP_invalid_op);
   1.146 -    return 0;
   1.147  }
   1.148  
   1.149 -asmlinkage int do_int3(struct cpu_user_regs *regs)
   1.150 +asmlinkage void do_int3(struct cpu_user_regs *regs)
   1.151  {
   1.152      DEBUGGER_trap_entry(TRAP_int3, regs);
   1.153  
   1.154 @@ -806,7 +805,7 @@ asmlinkage int do_int3(struct cpu_user_r
   1.155          panic("FATAL TRAP: vector = 3 (Int3)\n");
   1.156      } 
   1.157  
   1.158 -    return do_guest_trap(TRAP_int3, regs, 0);
   1.159 +    do_guest_trap(TRAP_int3, regs, 0);
   1.160  }
   1.161  
   1.162  asmlinkage void do_machine_check(struct cpu_user_regs *regs)
   1.163 @@ -1065,10 +1064,9 @@ static int fixup_page_fault(unsigned lon
   1.164   *  Bit 3: Reserved bit violation
   1.165   *  Bit 4: Instruction fetch
   1.166   */
   1.167 -asmlinkage int do_page_fault(struct cpu_user_regs *regs)
   1.168 +asmlinkage void do_page_fault(struct cpu_user_regs *regs)
   1.169  {
   1.170      unsigned long addr, fixup;
   1.171 -    int rc;
   1.172  
   1.173      addr = read_cr2();
   1.174  
   1.175 @@ -1076,19 +1074,19 @@ asmlinkage int do_page_fault(struct cpu_
   1.176  
   1.177      perfc_incr(page_faults);
   1.178  
   1.179 -    if ( unlikely((rc = fixup_page_fault(addr, regs)) != 0) )
   1.180 -        return rc;
   1.181 +    if ( unlikely(fixup_page_fault(addr, regs) != 0) )
   1.182 +        return;
   1.183  
   1.184      if ( unlikely(!guest_mode(regs)) )
   1.185      {
   1.186          if ( spurious_page_fault(addr, regs) )
   1.187 -            return EXCRET_not_a_fault;
   1.188 +            return;
   1.189  
   1.190          if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
   1.191          {
   1.192              perfc_incr(copy_user_faults);
   1.193              regs->eip = fixup;
   1.194 -            return 0;
   1.195 +            return;
   1.196          }
   1.197  
   1.198          DEBUGGER_trap_fatal(TRAP_page_fault, regs);
   1.199 @@ -1102,7 +1100,6 @@ asmlinkage int do_page_fault(struct cpu_
   1.200      }
   1.201  
   1.202      propagate_page_fault(addr, regs->error_code);
   1.203 -    return 0;
   1.204  }
   1.205  
   1.206  /*
   1.207 @@ -1113,7 +1110,7 @@ asmlinkage int do_page_fault(struct cpu_
   1.208   * page fault when it is retired, despite the fact that the PTE is present and 
   1.209   * correct at that point in time.
   1.210   */
   1.211 -asmlinkage int do_early_page_fault(struct cpu_user_regs *regs)
   1.212 +asmlinkage void do_early_page_fault(struct cpu_user_regs *regs)
   1.213  {
   1.214      static int stuck;
   1.215      static unsigned long prev_eip, prev_cr2;
   1.216 @@ -1126,14 +1123,12 @@ asmlinkage int do_early_page_fault(struc
   1.217          prev_eip = regs->eip;
   1.218          prev_cr2 = cr2;
   1.219          stuck    = 0;
   1.220 -        return EXCRET_not_a_fault;
   1.221 +        return;
   1.222      }
   1.223  
   1.224      if ( stuck++ == 1000 )
   1.225          panic("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", 
   1.226                regs->cs, _p(regs->eip), _p(cr2), regs->error_code);
   1.227 -
   1.228 -    return EXCRET_not_a_fault;
   1.229  }
   1.230  
   1.231  long do_fpu_taskswitch(int set)
   1.232 @@ -1351,7 +1346,7 @@ void (*pv_post_outb_hook)(unsigned int p
   1.233      if ( (_rc = copy_from_user(&_x, (type *)_ptr, sizeof(_x))) != 0 )       \
   1.234      {                                                                       \
   1.235          propagate_page_fault(_ptr + sizeof(_x) - _rc, 0);                   \
   1.236 -        return EXCRET_fault_fixed;                                          \
   1.237 +        goto skip;                                                          \
   1.238      }                                                                       \
   1.239      (eip) += sizeof(_x); _x; })
   1.240  
   1.241 @@ -2010,6 +2005,7 @@ static int emulate_privileged_op(struct 
   1.242  
   1.243   done:
   1.244      instruction_done(regs, eip, bpmatch);
   1.245 + skip:
   1.246      return EXCRET_fault_fixed;
   1.247  
   1.248   fail:
   1.249 @@ -2023,7 +2019,7 @@ static inline int check_stack_limit(unsi
   1.250              (!(ar & _SEGMENT_EC) ? (esp - 1) <= limit : (esp - decr) > limit));
   1.251  }
   1.252  
   1.253 -static int emulate_gate_op(struct cpu_user_regs *regs)
   1.254 +static void emulate_gate_op(struct cpu_user_regs *regs)
   1.255  {
   1.256  #ifdef __x86_64__
   1.257      struct vcpu *v = current;
   1.258 @@ -2036,9 +2032,15 @@ static int emulate_gate_op(struct cpu_us
   1.259      if ( !read_gate_descriptor(regs->error_code, v, &sel, &off, &ar) ||
   1.260           ((ar >> 13) & 3) < (regs->cs & 3) ||
   1.261           (ar & _SEGMENT_TYPE) != 0xc00 )
   1.262 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.263 +    {
   1.264 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.265 +        return;
   1.266 +    }
   1.267      if ( !(ar & _SEGMENT_P) )
   1.268 -        return do_guest_trap(TRAP_no_segment, regs, 1);
   1.269 +    {
   1.270 +        do_guest_trap(TRAP_no_segment, regs, 1);
   1.271 +        return;
   1.272 +    }
   1.273      dpl = (ar >> 13) & 3;
   1.274      nparm = ar & 0x1f;
   1.275  
   1.276 @@ -2050,7 +2052,10 @@ static int emulate_gate_op(struct cpu_us
   1.277           !(ar & _SEGMENT_S) ||
   1.278           !(ar & _SEGMENT_P) ||
   1.279           !(ar & _SEGMENT_CODE) )
   1.280 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.281 +    {
   1.282 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.283 +        return;
   1.284 +    }
   1.285  
   1.286      op_bytes = op_default = ar & _SEGMENT_DB ? 4 : 2;
   1.287      ad_default = ad_bytes = op_default;
   1.288 @@ -2199,7 +2204,9 @@ static int emulate_gate_op(struct cpu_us
   1.289      if ( jump < 0 )
   1.290      {
   1.291   fail:
   1.292 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.293 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.294 + skip:
   1.295 +        return;
   1.296      }
   1.297  
   1.298      if ( (opnd_sel != regs->cs &&
   1.299 @@ -2207,7 +2214,10 @@ static int emulate_gate_op(struct cpu_us
   1.300           !(ar & _SEGMENT_S) ||
   1.301           !(ar & _SEGMENT_P) ||
   1.302           ((ar & _SEGMENT_CODE) && !(ar & _SEGMENT_WR)) )
   1.303 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.304 +    {
   1.305 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.306 +        return;
   1.307 +    }
   1.308  
   1.309      opnd_off += op_bytes;
   1.310  #define ad_default ad_bytes
   1.311 @@ -2215,7 +2225,10 @@ static int emulate_gate_op(struct cpu_us
   1.312  #undef ad_default
   1.313      ASSERT((opnd_sel & ~3) == regs->error_code);
   1.314      if ( dpl < (opnd_sel & 3) )
   1.315 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.316 +    {
   1.317 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.318 +        return;
   1.319 +    }
   1.320  
   1.321      if ( !read_descriptor(sel, v, regs, &base, &limit, &ar, 0) ||
   1.322           !(ar & _SEGMENT_S) ||
   1.323 @@ -2225,17 +2238,20 @@ static int emulate_gate_op(struct cpu_us
   1.324            ((ar >> 13) & 3) != (regs->cs & 3)) )
   1.325      {
   1.326          regs->error_code = sel;
   1.327 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.328 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.329 +        return;
   1.330      }
   1.331      if ( !(ar & _SEGMENT_P) )
   1.332      {
   1.333          regs->error_code = sel;
   1.334 -        return do_guest_trap(TRAP_no_segment, regs, 1);
   1.335 +        do_guest_trap(TRAP_no_segment, regs, 1);
   1.336 +        return;
   1.337      }
   1.338      if ( off > limit )
   1.339      {
   1.340          regs->error_code = 0;
   1.341 -        return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.342 +        do_guest_trap(TRAP_gp_fault, regs, 1);
   1.343 +        return;
   1.344      }
   1.345  
   1.346      if ( !jump )
   1.347 @@ -2251,7 +2267,7 @@ static int emulate_gate_op(struct cpu_us
   1.348              { \
   1.349                  propagate_page_fault((unsigned long)(stkp + 1) - rc, \
   1.350                                       PFEC_write_access); \
   1.351 -                return 0; \
   1.352 +                return; \
   1.353              } \
   1.354          } while ( 0 )
   1.355  
   1.356 @@ -2260,7 +2276,10 @@ static int emulate_gate_op(struct cpu_us
   1.357              sel |= (ar >> 13) & 3;
   1.358              /* Inner stack known only for kernel ring. */
   1.359              if ( (sel & 3) != GUEST_KERNEL_RPL(v->domain) )
   1.360 -                return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.361 +            {
   1.362 +                do_guest_trap(TRAP_gp_fault, regs, 1);
   1.363 +                return;
   1.364 +            }
   1.365              esp = v->arch.guest_context.kernel_sp;
   1.366              ss = v->arch.guest_context.kernel_ss;
   1.367              if ( (ss & 3) != (sel & 3) ||
   1.368 @@ -2271,17 +2290,22 @@ static int emulate_gate_op(struct cpu_us
   1.369                   !(ar & _SEGMENT_WR) )
   1.370              {
   1.371                  regs->error_code = ss & ~3;
   1.372 -                return do_guest_trap(TRAP_invalid_tss, regs, 1);
   1.373 +                do_guest_trap(TRAP_invalid_tss, regs, 1);
   1.374 +                return;
   1.375              }
   1.376              if ( !(ar & _SEGMENT_P) ||
   1.377                   !check_stack_limit(ar, limit, esp, (4 + nparm) * 4) )
   1.378              {
   1.379                  regs->error_code = ss & ~3;
   1.380 -                return do_guest_trap(TRAP_stack_error, regs, 1);
   1.381 +                do_guest_trap(TRAP_stack_error, regs, 1);
   1.382 +                return;
   1.383              }
   1.384              stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);
   1.385              if ( !compat_access_ok(stkp - 4 - nparm, (4 + nparm) * 4) )
   1.386 -                return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.387 +            {
   1.388 +                do_guest_trap(TRAP_gp_fault, regs, 1);
   1.389 +                return;
   1.390 +            }
   1.391              push(regs->ss);
   1.392              push(regs->esp);
   1.393              if ( nparm )
   1.394 @@ -2297,7 +2321,10 @@ static int emulate_gate_op(struct cpu_us
   1.395                      return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.396                  ustkp = (unsigned int *)(unsigned long)((unsigned int)base + regs->_esp + nparm * 4);
   1.397                  if ( !compat_access_ok(ustkp - nparm, nparm * 4) )
   1.398 -                    return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.399 +                {
   1.400 +                    do_guest_trap(TRAP_gp_fault, regs, 1);
   1.401 +                    return;
   1.402 +                }
   1.403                  do
   1.404                  {
   1.405                      unsigned int parm;
   1.406 @@ -2307,7 +2334,7 @@ static int emulate_gate_op(struct cpu_us
   1.407                      if ( rc )
   1.408                      {
   1.409                          propagate_page_fault((unsigned long)(ustkp + 1) - rc, 0);
   1.410 -                        return 0;
   1.411 +                        return;
   1.412                      }
   1.413                      push(parm);
   1.414                  } while ( --nparm );
   1.415 @@ -2320,15 +2347,22 @@ static int emulate_gate_op(struct cpu_us
   1.416              ss = regs->ss;
   1.417              if ( !read_descriptor(ss, v, regs, &base, &limit, &ar, 0) ||
   1.418                   ((ar >> 13) & 3) != (sel & 3) )
   1.419 -                return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.420 +            {
   1.421 +                do_guest_trap(TRAP_gp_fault, regs, 1);
   1.422 +                return;
   1.423 +            }
   1.424              if ( !check_stack_limit(ar, limit, esp, 2 * 4) )
   1.425              {
   1.426                  regs->error_code = 0;
   1.427 -                return do_guest_trap(TRAP_stack_error, regs, 1);
   1.428 +                do_guest_trap(TRAP_stack_error, regs, 1);
   1.429 +                return;
   1.430              }
   1.431              stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);
   1.432              if ( !compat_access_ok(stkp - 2, 2 * 4) )
   1.433 -                return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.434 +            {
   1.435 +                do_guest_trap(TRAP_gp_fault, regs, 1);
   1.436 +                return;
   1.437 +            }
   1.438          }
   1.439          push(regs->cs);
   1.440          push(eip);
   1.441 @@ -2342,11 +2376,9 @@ static int emulate_gate_op(struct cpu_us
   1.442      regs->cs = sel;
   1.443      instruction_done(regs, off, 0);
   1.444  #endif
   1.445 -
   1.446 -    return 0;
   1.447  }
   1.448  
   1.449 -asmlinkage int do_general_protection(struct cpu_user_regs *regs)
   1.450 +asmlinkage void do_general_protection(struct cpu_user_regs *regs)
   1.451  {
   1.452      struct vcpu *v = current;
   1.453      unsigned long fixup;
   1.454 @@ -2388,18 +2420,22 @@ asmlinkage int do_general_protection(str
   1.455          if ( permit_softint(TI_GET_DPL(ti), v, regs) )
   1.456          {
   1.457              regs->eip += 2;
   1.458 -            return do_guest_trap(vector, regs, 0);
   1.459 +            do_guest_trap(vector, regs, 0);
   1.460 +            return;
   1.461          }
   1.462      }
   1.463      else if ( is_pv_32on64_vcpu(v) && regs->error_code )
   1.464 -        return emulate_gate_op(regs);
   1.465 +    {
   1.466 +        emulate_gate_op(regs);
   1.467 +        return;
   1.468 +    }
   1.469  
   1.470      /* Emulate some simple privileged and I/O instructions. */
   1.471      if ( (regs->error_code == 0) &&
   1.472           emulate_privileged_op(regs) )
   1.473      {
   1.474          trace_trap_one_addr(TRC_PV_EMULATE_PRIVOP, regs->eip);
   1.475 -        return 0;
   1.476 +        return;
   1.477      }
   1.478  
   1.479  #if defined(__i386__)
   1.480 @@ -2408,12 +2444,13 @@ asmlinkage int do_general_protection(str
   1.481           gpf_emulate_4gb(regs) )
   1.482      {
   1.483          TRACE_1D(TRC_PV_EMULATE_4GB, regs->eip);
   1.484 -        return 0;
   1.485 +        return;
   1.486      }
   1.487  #endif
   1.488  
   1.489      /* Pass on GPF as is. */
   1.490 -    return do_guest_trap(TRAP_gp_fault, regs, 1);
   1.491 +    do_guest_trap(TRAP_gp_fault, regs, 1);
   1.492 +    return;
   1.493  
   1.494   gp_in_kernel:
   1.495  
   1.496 @@ -2422,7 +2459,7 @@ asmlinkage int do_general_protection(str
   1.497          dprintk(XENLOG_INFO, "GPF (%04x): %p -> %p\n",
   1.498                  regs->error_code, _p(regs->eip), _p(fixup));
   1.499          regs->eip = fixup;
   1.500 -        return 0;
   1.501 +        return;
   1.502      }
   1.503  
   1.504      DEBUGGER_trap_fatal(TRAP_gp_fault, regs);
   1.505 @@ -2430,7 +2467,6 @@ asmlinkage int do_general_protection(str
   1.506   hardware_gp:
   1.507      show_execution_state(regs);
   1.508      panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
   1.509 -    return 0;
   1.510  }
   1.511  
   1.512  static void nmi_softirq(void)
   1.513 @@ -2550,7 +2586,7 @@ void unset_nmi_callback(void)
   1.514      nmi_callback = dummy_nmi_callback;
   1.515  }
   1.516  
   1.517 -asmlinkage int do_device_not_available(struct cpu_user_regs *regs)
   1.518 +asmlinkage void do_device_not_available(struct cpu_user_regs *regs)
   1.519  {
   1.520      struct vcpu *curr = current;
   1.521  
   1.522 @@ -2566,10 +2602,10 @@ asmlinkage int do_device_not_available(s
   1.523      else
   1.524          TRACE_0D(TRC_PV_MATH_STATE_RESTORE);
   1.525  
   1.526 -    return EXCRET_fault_fixed;
   1.527 +    return;
   1.528  }
   1.529  
   1.530 -asmlinkage int do_debug(struct cpu_user_regs *regs)
   1.531 +asmlinkage void do_debug(struct cpu_user_regs *regs)
   1.532  {
   1.533      struct vcpu *v = current;
   1.534  
   1.535 @@ -2609,16 +2645,16 @@ asmlinkage int do_debug(struct cpu_user_
   1.536      v->arch.guest_context.debugreg[6] = read_debugreg(6);
   1.537  
   1.538      ler_enable();
   1.539 -    return do_guest_trap(TRAP_debug, regs, 0);
   1.540 +    do_guest_trap(TRAP_debug, regs, 0);
   1.541 +    return;
   1.542  
   1.543   out:
   1.544      ler_enable();
   1.545 -    return EXCRET_not_a_fault;
   1.546 +    return;
   1.547  }
   1.548  
   1.549 -asmlinkage int do_spurious_interrupt_bug(struct cpu_user_regs *regs)
   1.550 +asmlinkage void do_spurious_interrupt_bug(struct cpu_user_regs *regs)
   1.551  {
   1.552 -    return EXCRET_not_a_fault;
   1.553  }
   1.554  
   1.555  void set_intr_gate(unsigned int n, void *addr)
     2.1 --- a/xen/include/asm-x86/debugger.h	Mon Dec 10 11:41:40 2007 +0000
     2.2 +++ b/xen/include/asm-x86/debugger.h	Mon Dec 10 11:49:12 2007 +0000
     2.3 @@ -35,9 +35,9 @@
     2.4  
     2.5  /* The main trap handlers use these helper macros which include early bail. */
     2.6  #define DEBUGGER_trap_entry(_v, _r) \
     2.7 -    if ( debugger_trap_entry(_v, _r) ) return EXCRET_fault_fixed;
     2.8 +    if ( debugger_trap_entry(_v, _r) ) return;
     2.9  #define DEBUGGER_trap_fatal(_v, _r) \
    2.10 -    if ( debugger_trap_fatal(_v, _r) ) return EXCRET_fault_fixed;
    2.11 +    if ( debugger_trap_fatal(_v, _r) ) return;
    2.12  
    2.13  #if defined(CRASH_DEBUG)
    2.14  
     3.1 --- a/xen/include/asm-x86/processor.h	Mon Dec 10 11:41:40 2007 +0000
     3.2 +++ b/xen/include/asm-x86/processor.h	Mon Dec 10 11:49:12 2007 +0000
     3.3 @@ -112,14 +112,8 @@
     3.4  /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */
     3.5  #define TRAP_syscall         256
     3.6  
     3.7 -/*
     3.8 - * Non-fatal fault/trap handlers return an error code to the caller. If the
     3.9 - * code is non-zero, it means that either the exception was not due to a fault
    3.10 - * (i.e., it was a trap) or that the fault has been fixed up so the instruction
    3.11 - * replay ought to succeed.
    3.12 - */
    3.13 -#define EXCRET_not_a_fault 1 /* It was a trap. No instruction replay needed. */
    3.14 -#define EXCRET_fault_fixed 1 /* It was fault that we fixed: try a replay. */
    3.15 +/* Boolean return code: the reason for a fault has been fixed. */
    3.16 +#define EXCRET_fault_fixed 1
    3.17  
    3.18  /* 'trap_bounce' flags values */
    3.19  #define TBF_EXCEPTION          1