Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/x86-arch.c
    ... ... @@ -213,17 +213,21 @@ arch_set_pseudo_atomic_interrupted(os_context_t * context)
    213 213
     
    
    214 214
     
    
    215 215
     
    
    216
    +/*
    
    217
    + * Installs a breakpoint (INT3) at |pc|.  We return the byte that was
    
    218
    + * replaced by the int3 instruction.
    
    219
    + */
    
    216 220
     unsigned long
    
    217 221
     arch_install_breakpoint(void *pc)
    
    218 222
     {
    
    219 223
         unsigned char* ptr = (unsigned char *) pc;
    
    220
    -    unsigned long result = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
    
    224
    +    unsigned long result = *ptr;
    
    221 225
     
    
    222 226
         DPRINTF(debug_handlers,
    
    223 227
                 (stderr, "arch_install_breakpoint at %p, old code = 0x%lx\n",
    
    224 228
                  pc, result));
    
    225 229
     
    
    226
    -    *(char *) pc = BREAKPOINT_INST;	/* x86 INT3       */
    
    230
    +    *ptr = BREAKPOINT_INST;	/* x86 INT3       */
    
    227 231
         return result;
    
    228 232
     }
    
    229 233
     
    
    ... ... @@ -235,14 +239,9 @@ arch_remove_breakpoint(void *pc, unsigned long orig_inst)
    235 239
                  pc, orig_inst));
    
    236 240
         unsigned char *ptr = (unsigned char *) pc;
    
    237 241
         /*
    
    238
    -     * Just restore all the bytes from orig_inst.  Should we just
    
    239
    -     * re-install just the one byte that was taken by the int3
    
    240
    -     * instruction?
    
    242
    +     * Just restore the byte from orig_inst.
    
    241 243
          */
    
    242 244
         ptr[0] = orig_inst & 0xff;
    
    243
    -    ptr[1] = (orig_inst >> 8) & 0xff;
    
    244
    -    ptr[2] = (orig_inst >> 16) & 0xff;
    
    245
    -    ptr[3] = (orig_inst >> 24) & 0xff;
    
    246 245
     }
    
    247 246
     
    
    248 247