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

Commits:

2 changed files:

Changes:

  • src/compiler/x86/insts.lisp
    ... ... @@ -2064,9 +2064,13 @@
    2064 2064
     
    
    2065 2065
     ;; The UD1 instruction.  The mod bits of the mod r/m byte MUST be #b11
    
    2066 2066
     ;; so that the reg/mem field is actually a register.  This is a hack
    
    2067
    -;; to allow us to print out the reg/mem reg as a 32-bit reg.  Using
    
    2068
    -;; just reg/mem, the register sometimes printed out as a byte reg and
    
    2069
    -;; I (toy.raymond) don't know why.
    
    2067
    +;; to allow us to print out the reg/mem reg as a 32-bit reg.
    
    2068
    +;;
    
    2069
    +;; While the instruction looks like an ext-reg-reg/mem format with
    
    2070
    +;; fixed width value of 1, it isn't because we need to disassemble the
    
    2071
    +;; reg/mem field as a 32-bit reg. ext-reg-reg/mem needs a width prefix
    
    2072
    +;; byte to specify that, and we definitely don't want that.  Hence,
    
    2073
    +;; use a special instruction format for the UD1 instruction.
    
    2070 2074
     (disassem:define-instruction-format
    
    2071 2075
         (ud1 24 :default-printer '(:name :tab reg ", " reg/mem))
    
    2072 2076
       (prefix    :field (byte 8 0) :value #b00001111)
    

  • src/lisp/x86-arch.c
    ... ... @@ -220,13 +220,13 @@ arch_set_pseudo_atomic_interrupted(os_context_t * context)
    220 220
     unsigned long
    
    221 221
     arch_install_breakpoint(void *pc)
    
    222 222
     {
    
    223
    -    unsigned long result = (unsigned char *) pc;
    
    223
    +    unsigned long result = *(unsigned char *) pc;
    
    224
    +    *(unsigned char *) pc = BREAKPOINT_INST;
    
    224 225
     
    
    225 226
         DPRINTF(debug_handlers,
    
    226 227
                 (stderr, "arch_install_breakpoint at %p, old code = 0x%lx\n",
    
    227 228
                  pc, result));
    
    228 229
     
    
    229
    -    *(unsigned char *) pc = BREAKPOINT_INST;
    
    230 230
         return result;
    
    231 231
     }
    
    232 232