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

Commits:

2 changed files:

Changes:

  • src/compiler/x86/insts.lisp
    ... ... @@ -1778,8 +1778,8 @@
    1778 1778
     (disassem:define-instruction-format
    
    1779 1779
         (bit-test-reg/mem 24
    
    1780 1780
     		      :default-printer '(:name :tab reg/mem ", " reg))
    
    1781
    -  (prefix	:field (byte 8 0)	:value #b0001111)
    
    1782
    -  (op		:field (byte 3 11))
    
    1781
    +  (prefix	:field (byte 8 0) :value #b0001111)
    
    1782
    +  (op		:field (byte 8 8))
    
    1783 1783
       ;;(test		:fields (list (byte 2 14) (byte 3 8)))
    
    1784 1784
       (reg/mem	:fields (list (byte 2 22) (byte 3 16))
    
    1785 1785
     		:type 'reg/mem)
    
    ... ... @@ -1788,22 +1788,22 @@
    1788 1788
       (imm))
    
    1789 1789
     
    
    1790 1790
     (define-instruction bt (segment src index)
    
    1791
    -  (:printer bit-test-reg/mem ((op #b100)))
    
    1791
    +  (:printer bit-test-reg/mem ((op #b10100011)))
    
    1792 1792
       (:emitter
    
    1793 1793
        (emit-bit-test-and-mumble segment src index #b100)))
    
    1794 1794
     
    
    1795 1795
     (define-instruction btc (segment src index)
    
    1796
    -  (:printer bit-test-reg/mem ((op #b111)))
    
    1796
    +  (:printer bit-test-reg/mem ((op #b10111011)))
    
    1797 1797
       (:emitter
    
    1798 1798
        (emit-bit-test-and-mumble segment src index #b111)))
    
    1799 1799
     
    
    1800 1800
     (define-instruction btr (segment src index)
    
    1801
    -  (:printer bit-test-reg/mem ((op #b110)))
    
    1801
    +  (:printer bit-test-reg/mem ((op #b10110011)))
    
    1802 1802
       (:emitter
    
    1803 1803
        (emit-bit-test-and-mumble segment src index #b110)))
    
    1804 1804
     
    
    1805 1805
     (define-instruction bts (segment src index)
    
    1806
    -  (:printer bit-test-reg/mem ((op #b101)))
    
    1806
    +  (:printer bit-test-reg/mem ((op #b10101011)))
    
    1807 1807
       (:emitter
    
    1808 1808
        (emit-bit-test-and-mumble segment src index #b101)))
    
    1809 1809
     
    
    ... ... @@ -2062,11 +2062,11 @@
    2062 2062
      (code :field (byte 8 8)))
    
    2063 2063
     
    
    2064 2064
     
    
    2065
    -(disassem:define-instruction-format (break 24 :default-printer '(:name :tab code))
    
    2066
    -  (op :fields (list (byte 8 0) (byte 8 8)) :value '(#xb00001111 #b00001011))
    
    2065
    +(disassem:define-instruction-format (ud1 24 :default-printer '(:name :tab code))
    
    2066
    +  (op :fields (list (byte 8 0) (byte 8 8)) :value '(#xb00001111 #b10111001))
    
    2067 2067
       (code :field (byte 8 16)))
    
    2068 2068
     
    
    2069
    -(define-emitter emit-break-inst 24
    
    2069
    +(define-emitter emit-ud1-inst 24
    
    2070 2070
       (byte 8 0) (byte 8 8) (byte 8 16))
    
    2071 2071
     
    
    2072 2072
     (defun snarf-error-junk (sap offset &optional length-only)
    
    ... ... @@ -2102,7 +2102,7 @@
    2102 2102
     (defun break-control (chunk inst stream dstate)
    
    2103 2103
       (declare (ignore inst))
    
    2104 2104
       (flet ((nt (x) (if stream (disassem:note x dstate))))
    
    2105
    -    (case (break-code chunk dstate)
    
    2105
    +    (case (ud1-code chunk dstate)
    
    2106 2106
           (#.vm:error-trap
    
    2107 2107
            (nt "Error trap")
    
    2108 2108
            (disassem:handle-break-args #'snarf-error-junk stream dstate))
    
    ... ... @@ -2122,11 +2122,11 @@
    2122 2122
     ;; This is really the int3 instruction.
    
    2123 2123
     (define-instruction break (segment code)
    
    2124 2124
       (:declare (type (unsigned-byte 8) code))
    
    2125
    -  (:printer break ((op '(#b00001111 #b00001011)))
    
    2125
    +  (:printer ud1 ((op '(#b00001111 #b10111001)))
    
    2126 2126
     	    '(:name :tab code)
    
    2127 2127
     	    :control #'break-control)
    
    2128 2128
       (:emitter
    
    2129
    -   (emit-break-inst segment #b00001111 #b00001011 code)))
    
    2129
    +   (emit-ud1-inst segment #b00001111 #b10111001 code)))
    
    2130 2130
     
    
    2131 2131
     #+nil
    
    2132 2132
     (define-instruction ud2 (segment)
    

  • src/lisp/x86-arch.c
    ... ... @@ -361,14 +361,14 @@ sigill_handler(HANDLER_ARGS)
    361 361
                 (stderr, "pc %x\n",  *(unsigned short *)SC_PC(context)));
    
    362 362
     
    
    363 363
         /*
    
    364
    -     * Make sure the trapping instruction is UD2.  Abort if not.
    
    364
    +     * Make sure the trapping instruction is UD1.  Abort if not.
    
    365 365
          *
    
    366 366
          * TODO: aborting is probably not the best idea.  Could get here
    
    367 367
          * from other illegal instructions in, say, C code?  Maybe we
    
    368 368
          * should call interrupt_handle_now, as we do below for an unknown
    
    369 369
          * trap code?
    
    370 370
          */
    
    371
    -    if (*(unsigned short *) SC_PC(context) == 0x0b0f) {
    
    371
    +    if (*(unsigned short *) SC_PC(context) == 0xb90f) {
    
    372 372
             trap = *(((char *)SC_PC(context)) + 2);
    
    373 373
         } else {
    
    374 374
             abort();