Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl
Commits:
-
cfb35624
by Raymond Toy at 2021-04-09T16:14:44-07:00
1 changed file:
Changes:
... | ... | @@ -2062,13 +2062,20 @@ |
2062 | 2062 |
(code :field (byte 8 8)))
|
2063 | 2063 |
|
2064 | 2064 |
|
2065 |
+;; The UD1 instruction. The mod bits of the mod r/m byte MUST be #b11
|
|
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 reg. Using just
|
|
2068 |
+;; reg/mem, the register sometimes printed out as a byte reg and I
|
|
2069 |
+;; (toy.raymond) don't know why.
|
|
2065 | 2070 |
(disassem:define-instruction-format
|
2066 | 2071 |
(ud1 24 :default-printer '(:name :tab reg ", " reg/mem))
|
2067 | 2072 |
(prefix :field (byte 8 0) :value #b00001111)
|
2068 | 2073 |
(op :field (byte 8 8) :value #b10111001)
|
2069 |
- (reg/mem :fields (list (byte 2 22) (byte 3 16))
|
|
2070 |
- :type 'reg/mem)
|
|
2071 |
- (reg :field (byte 3 19) :type 'word-reg))
|
|
2074 |
+ ;; The mod bits ensure that the reg/mem field is interpreted as a
|
|
2075 |
+ ;; register, not memory.
|
|
2076 |
+ (reg/mem :field (byte 3 16) :type 'word-reg)
|
|
2077 |
+ (reg :field (byte 3 19) :type 'word-reg)
|
|
2078 |
+ (mod :field (byte 2 22) :value #b11))
|
|
2072 | 2079 |
|
2073 | 2080 |
(defun snarf-error-junk (sap offset &optional length-only)
|
2074 | 2081 |
(let* ((length (system:sap-ref-8 sap offset))
|
... | ... | @@ -2125,7 +2132,7 @@ |
2125 | 2132 |
;; We just want the trap code in the third byte of the instruction.
|
2126 | 2133 |
(define-instruction ud1 (segment code)
|
2127 | 2134 |
(:declare (type (unsigned-byte 8) code))
|
2128 |
- (:printer ud1 ((op #b10111001))
|
|
2135 |
+ (:printer ud1 ((op #b10111001) (reg nil :type 'word-reg))
|
|
2129 | 2136 |
:default
|
2130 | 2137 |
:control #'ud1-control)
|
2131 | 2138 |
(:emitter
|