/[cmucl]/src/code/pmax-disassem.lisp
ViewVC logotype

Diff of /src/code/pmax-disassem.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by ch, Tue Feb 6 02:22:56 1990 UTC revision 1.5 by ch, Sun Feb 11 19:24:50 1990 UTC
# Line 75  Line 75 
75    (unless (<= 0 register-number 31)    (unless (<= 0 register-number 31)
76      (error "Illegal register number!"))      (error "Illegal register number!"))
77    (let ((register-names (ecase register-name-style    (let ((register-names (ecase register-name-style
78                            (:c                            (:c *c-register-names*)
79                             *c-register-names*)                            (:lisp *lisp-register-names*)
80                            (:lisp                            (:raw *raw-register-names*))))
                            *lisp-register-names*)  
                           (:raw  
                            *raw-register-names*))))  
81      (svref register-names register-number)))      (svref register-names register-number)))
82    
83    
# Line 122  Line 119 
119    (let ((rs (ldb (byte 5 21) word))    (let ((rs (ldb (byte 5 21) word))
120          (rt (ldb (byte 5 16) word))          (rt (ldb (byte 5 16) word))
121          (immed (signed-ldb (byte 16 0) word)))          (immed (signed-ldb (byte 16 0) word)))
122      (format stream "~16,8T~A~8,8T~A, ~A, #x~X~%"      (cond ((and (zerop rs) (or (string= name "ADDI") (string= name "ADDIU")))
123              name (register-name rt) (register-name rs) immed)))             (format stream "~16,8TLOADI~8,8T~A, #x~X~%"
124                       (register-name rt) immed))
125              (t
126               (format stream "~16,8T~A~8,8T~A, ~A, #x~X~%"
127                       name (register-name rt) (register-name rs) immed)))))
128    
129  (def-mips-instruction-type (:ui-type)  (def-mips-instruction-type (:ui-type)
130    (let ((rs (ldb (byte 5 21) word))    (let ((rs (ldb (byte 5 21) word))
131          (rt (ldb (byte 5 16) word))          (rt (ldb (byte 5 16) word))
132          (immed (ldb (byte 16 0) word)))          (immed (ldb (byte 16 0) word)))
133      (format stream "~16,8T~A~8,8T~A, ~A, #x~X~%"      (cond ((and (zerop rs) (or (string= name "ORI") (string= name "XORI")))
134              name (register-name rt) (register-name rs) immed)))             (format stream "~16,8TLOADI~8,8T~A, #x~X~%"
135                       (register-name rt) immed))
136              (t
137               (format stream "~16,8T~A~8,8T~A, ~A, #x~X~%"
138                       name (register-name rt) (register-name rs) immed)))))
139    
140  (def-mips-instruction-type (:lui-type)  (def-mips-instruction-type (:lui-type)
141    (let ((rt (ldb (byte 5 16) word))    (let ((rt (ldb (byte 5 16) word))
# Line 161  Line 166 
166              (register-name rs) (branch-target offset))))              (register-name rs) (branch-target offset))))
167    
168  (def-mips-instruction-type (:branch2-type)  (def-mips-instruction-type (:branch2-type)
169    (let ((rs (ldb (byte 5 21) word))    (let* ((rs (ldb (byte 5 21) word))
170          (rt (ldb (byte 5 16) word))           (rt (ldb (byte 5 16) word))
171          (offset (signed-ldb (byte 16 0) word)))           (offset (signed-ldb (byte 16 0) word))
172      (format stream "~16,8T~A~8,8T~A, ~A, ~D~%" name           (target (branch-target offset)))
173              (register-name rs) (register-name rt) (branch-target offset))))      (cond ((and (zerop rs) (zerop rt) (string= name "BEQ"))
174               (format stream "~16,8TB~8,8T~D~%" target))
175              (t
176               (format stream "~16,8T~A~8,8T~A, ~A, ~D~%" name
177                       (register-name rs) (register-name rt) target)))))
178    
179  (def-mips-instruction-type (:r3-type)  (def-mips-instruction-type (:r3-type)
180    (let ((rs (ldb (byte 5 21) word))    (let ((rs (ldb (byte 5 21) word))
# Line 174  Line 183 
183      (cond ((zerop rd)      (cond ((zerop rd)
184             ;; Hack for NOP             ;; Hack for NOP
185             (format stream "~16,8TNOP~%"))             (format stream "~16,8TNOP~%"))
186            ((and (zerop rt) (string= name "OR"))            ((and (zerop rt) (or (string= name "OR") (string= name "ANDU")))
187             ;; Hack for MOVE             ;; Hack for MOVE
188             (format stream "~16,8TMOVE~8,8T~A, ~A~%"             (format stream "~16,8TMOVE~8,8T~A, ~A~%"
189                     (register-name rd) (register-name rs)))                     (register-name rd) (register-name rs)))
# Line 413  Line 422 
422  ;;;; Disassemble-Instruction  ;;;; Disassemble-Instruction
423    
424  (defun disassemble-instruction (word &optional (stream t))  (defun disassemble-instruction (word &optional (stream t))
425    (let ((instr (mips-instruction word)))    (let* ((instr (mips-instruction word)))
426      (unless instr      (unless instr
427        (format stream "UNKNOWN INSTR (#x~X)~%" word)        (format stream "UNKNOWN INSTR (#x~X)~%" word)
428        (return-from disassemble-instruction (values nil nil)))        (return-from disassemble-instruction (values nil nil)))
# Line 442  Line 451 
451        (format stream "~6D:" *current-instruction-number*))        (format stream "~6D:" *current-instruction-number*))
452      (multiple-value-bind      (multiple-value-bind
453          (name type)          (name type)
454          (disassemble-instruction (+ (ash (aref code-vector i) 24)          (disassemble-instruction (logior (aref code-vector i)
455                                      (ash (aref code-vector (+ i 1)) 16)                                           (ash (aref code-vector (+ i 1)) 8)
456                                      (ash (aref code-vector (+ i 2)) 8)                                           (ash (aref code-vector (+ i 2)) 16)
457                                      (aref code-vector (+ i 3)))                                           (ash (aref code-vector (+ i 3)) 24))
458                                   stream)                                   stream)
459        (declare (ignore name))        (declare (ignore name))
460        (cond ((member type delay-slot-instruction-types :test #'eq)        (cond ((member type delay-slot-instruction-types :test #'eq)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.5