Commit 2b758d6e authored by Frode Vatvedt Fjeld's avatar Frode Vatvedt Fjeld

Add disassembler for opcode-reg-imm.

parent a282ddac
......@@ -6,7 +6,7 @@
;;;; Author: Frode Vatvedt Fjeld <>
;;;; Distribution: See the accompanying file COPYING.
;;;; $Id: asm-x86.lisp,v 1.31 2008/02/25 23:33:43 ffjeld Exp $
;;;; $Id: asm-x86.lisp,v 1.32 2008/02/27 20:55:50 ffjeld Exp $
......@@ -217,7 +217,8 @@
((atom body)
((member (car body) '(reg-modrm modrm opcode imm-modrm imm opcode-reg pc-rel moffset sreg-modrm))
((member (car body) '(reg-modrm modrm opcode imm-modrm imm opcode-reg
opcode-reg-imm pc-rel moffset sreg-modrm))
(list body))
(t (mapcan #'find-forms body)))))
(let ((defun-name (intern (format nil "~A-~A" 'instruction-encoder operator))))
......@@ -899,6 +900,15 @@
:extra extra-operand))
(defun decode-opcode-reg-imm (code operator opcode operand-size address-size rex operand-ordering imm-type)
(declare (ignore address-size rex))
(values (list* operator
(order-operands operand-ordering
:reg (nth (ldb (byte 3 0) opcode)
(register-set-by-mode operand-size))
:imm (code-call (decode-integer code imm-type))))
(defun decode-reg-modrm-16 (code operand-size)
(let* ((modrm (pop-code code mod/rm))
(mod (ldb (byte 2 6) modrm))
......@@ -1259,8 +1269,18 @@
(t default-rex))))))))))
(defmacro opcode-reg-imm (opcode op-reg op-imm type)
(encode-opcode-reg-imm operator legacy-prefixes ,opcode ,op-reg ,op-imm ',type operator-mode default-rex)))
(encode-opcode-reg-imm operator legacy-prefixes ,opcode ,op-reg ,op-imm ',type operator-mode default-rex)))
(loop for reg from #b000 to #b111
do (define-disassembler (operator (logior ,opcode reg) operator-mode)
(operand-ordering operand-formals
:reg ',op-reg
:imm ',op-imm)
(defmacro far-pointer (opcode segment offset offset-type &rest extra)
`(when (and (immediate-p ,segment)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment