Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/x86-arch.c
    ... ... @@ -29,7 +29,13 @@
    29 29
      * included here.
    
    30 30
      */
    
    31 31
     static const unsigned char ud1[] = {0x0f, 0xb9};
    
    32
    -      
    
    32
    +
    
    33
    +/*
    
    34
    + * Extract the error trap code from the UD1 instruction.  BYTE must be
    
    35
    + * the 3rd byte of the UD1 instruction that represents the mod r/m
    
    36
    + * byte.
    
    37
    + */
    
    38
    +#define UD1_CODE(modrm) ((modrm) & 0x3f)
    
    33 39
     
    
    34 40
     /*
    
    35 41
      * Set to positive value to enabled debug prints related to the sigill
    
    ... ... @@ -161,7 +167,8 @@ arch_skip_instruction(os_context_t * context)
    161 167
          */
    
    162 168
         pc += sizeof(ud1);
    
    163 169
     
    
    164
    -    code = *pc++;
    
    170
    +    code = UD1_CODE(*pc++);
    
    171
    +
    
    165 172
         SC_PC(context) = (unsigned long) pc;
    
    166 173
     
    
    167 174
         switch (code) {
    
    ... ... @@ -187,7 +194,7 @@ arch_skip_instruction(os_context_t * context)
    187 194
     	  break;
    
    188 195
     
    
    189 196
           default:
    
    190
    -	  fprintf(stderr, "[arch_skip_inst invalid code %d\n]\n", code);
    
    197
    +	  fprintf(stderr, "[arch_skip_inst invalid code 0x%x\n]\n", code);
    
    191 198
     	  break;
    
    192 199
         }
    
    193 200
     
    
    ... ... @@ -387,7 +394,7 @@ sigill_handler(HANDLER_ARGS)
    387 394
            * number is placed in the low 6-bits of the 3rd byte of the
    
    388 395
            * instruction.
    
    389 396
            */
    
    390
    -      trap = *(((char *)SC_PC(context)) + 2) & 0x3f;
    
    397
    +      trap = UD1_CODE(*(((char *)SC_PC(context)) + sizeof(ud1)));
    
    391 398
     
    
    392 399
           DPRINTF(debug_handlers, (stderr, "code = %x\n", trap));
    
    393 400