Commit 3a5ad14e authored by Frode Vatvedt Fjeld's avatar Frode Vatvedt Fjeld

*** empty log message ***

parents
# CVS default ignores begin
tags
TAGS
.make.state
.nse_depinfo
*~
#*
.#*
,*
_$*
*$
*.old
*.bak
*.BAK
*.orig
*.rej
.del-*
*.a
*.olb
*.o
*.obj
*.so
*.exe
*.Z
*.elc
*.ln
core
# CVS default ignores end
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 2001-2002,
;;;; Department of Computer Science, University of Tromsø, Norway.
;;;;
;;;; For distribution policy, see the accompanying file COPYING.
;;;;
;;;; Filename: alignment.lisp
;;;; Description:
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Wed Apr 10 12:47:08 2002
;;;;
;;;; $Id: alignment.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86")
(defclass alignment ()
((type
:initarg :type
:reader alignment-type)))
(defmethod create-alignment ((alignment alignment) pc)
(ecase (first (alignment-type alignment))
(:code
;; For optimal performance across the Intel Architecture family, it is recommended that:
;; · Loop entry labels should be 16-byte aligned when less than eight bytes away from a
;; 16-byte boundary.
;; · Labels that follow a conditional branch should not be aligned.
;; · Labels that follow an unconditional branch or function call should be 16-byte aligned
;; when less than eight bytes away from a 16-byte boundary.
(ecase (second (alignment-type alignment))
(:loop
(when (< 8 (mod pc 16))
(nthcdr (mod pc 16) '#.(make-list 16 :initial-element #c(#x90 1))))
)))))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 2000,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: ia-x86-assemble.lisp
;;;; Description:
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Thu May 25 14:30:57 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: assemble.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86")
(defun read-operand (operand-spec)
)
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Copyright (C) 2003, Frode Vatvedt Fjeld <frodef@acm.org>
;;
;; Filename: ia-x86-test.lisp
;; Description: Regression tests for the assembler
;; Author: Nikodemus Siivola
;; Created at: Wed Oct 20 23:13:46 1999
;;
;; $Id: ia-x86-test.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defpackage :ia-x86-test
(:use :cl :ia-x86 :rt))
(in-package :ia-x86-test)
(deftest asm.1
(asm :movl :eax :ebx)
#C(#x89C3 #x2))
(defvar *proglist-1* '((:movl 10 :eax) loop
(:decl :eax)
(:je 'exit)
(:jmp 'loop) exit))
(deftest read-proglist.1
;; KLUDGE: it's just simpler to compare the printed version here...
(equal (with-output-to-string (s)
(prin1 (read-proglist *proglist-1*) s))
"(#<asm MOVL #xA => %EAX> LOOP #<asm DECL %EAX> #<asm JE 'EXIT> #<asm JMP 'LOOP>
EXIT)")
t)
(deftest proglist-encode.1
(multiple-value-bind (a b)
(proglist-encode :octet-list :32-bit 0 (read-proglist *proglist-1*))
(and (equal a '(#xB8 #xA #x0 #x0 #x0 #x48 #x74 #x2 #xEB #xFB))
(equal b '((EXIT . #xA) (LOOP . #x5)))))
t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Copyright (C) 2003, Frode Vatvedt Fjeld <frodef@acm.org>
;;
;; Filename: ia-x86.asd
;; Description: ASDF defsystem for los assembler
;; Author: Nikodemus Siivola
;; Created at: Wed Oct 20 23:13:46 1999
;;
;; $Id: ia-x86.asd,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defpackage "IA-X86-SYSTEM"
(:use :cl :asdf))
(in-package "IA-X86-SYSTEM")
(defsystem :ia-x86
:serial t ; FIXME: proper dependencies would be nice...
:components
((:file "packages")
;; (:file "utilities")
;; (:file "asm")
(:file "ia-x86")
(:file "symtab")
(:file "prefixes")
(:file "registers")
(:file "operands")
(:file "inline-data")
(:file "alignment")
(:file "read")
(:file "codec")
(:file "proglist")
(:file "def-instr")))
(defmethod perform :after ((o load-op) (c (eql (find-system :ia-x86))))
(when (y-or-n-p "Initialize instruction tables? It may take a while, ~
espcially on memory starved boxes.")
(operate 'load-op :ia-x86-instr)))
(defclass conf-file (cl-source-file) ())
(defmethod perform ((o compile-op) (c conf-file))
nil)
(defmethod output-files ((o compile-op) (c conf-file))
(list (component-pathname c)))
(defsystem :ia-x86-instr
:components
((:conf-file "instr-mov")
(:conf-file "instr-add")
(:conf-file "instr-sub")
(:conf-file "instr-cmp")
(:conf-file "instr-push-pop")
(:conf-file "instr-mul-div")
(:conf-file "instr-branch")
(:conf-file "instr-and-or")
(:conf-file "instr-bit")
(:conf-file "instr-shift")
(:conf-file "instr-string")
(:conf-file "instr-misc")
(:conf-file "instr-fpu")
(:conf-file "instr-mmx")
(:conf-file "instr-simd")))
(defsystem :ia-x86-test
:depends-on (:ia-x86 :rt)
:components ((:file "ia-x86-test")))
(defmethod perform ((o test-op) (c (eql (find-system :ia-x86))))
(operate 'load-op :ia-x86-test)
(operate 'test-op :ia-x86-test))
(defmethod perform ((o test-op) (c (eql (find-system :ia-x86-test))))
(or (funcall (intern "DO-TESTS" :rt))
(error "test-op failed")))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 200120001999, 2002,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: ia-x86.lisp
;;;; Description:
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Fri Dec 17 18:01:26 1999
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: ia-x86.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86")
;;; ----------------------------------------------------------------
;;; Instruction Definition
;;; ----------------------------------------------------------------
(defclass instruction ()
((operands
:type list
:initform '()
:initarg operands
:accessor instruction-operands)
(prefixes
:type list
:initarg prefixes
:initform '()
:accessor instruction-prefixes)
(user-size
:initarg user-size
:reader instruction-user-size)
(original-datum
:initarg datum
:accessor instruction-original-datum)))
(defmethod print-object ((obj instruction) stream)
(cond
(*print-readably*
(format stream "(~@[~A ~]~A~{ ~A~})"
(instruction-prefixes obj)
(type-of obj)
(instruction-operands obj))
obj)
(t (print-unreadable-object (obj stream)
(format stream "asm ~@[~A ~]~A~{ ~A~}"
(instruction-prefixes obj)
(type-of obj)
(instruction-operands obj))))))
;;; ----------------------------------------------------------------
;;; Symbolic break-down of encoded instructions
;;; ----------------------------------------------------------------
(defstruct instr-symbolic
mod reg r/m
scale index base
displacement
immediate
opcode)
(defmethod print-object ((obj instr-symbolic) stream)
(if *print-pretty*
(progn
(princ "#IS(" stream)
(dolist (slot '(mod reg r/m scale index base displacement immediate opcode))
(when (slot-boundp obj slot)
(format stream "(~A: ~A)" slot (slot-value obj slot))))
(princ ")" stream)
obj)
(call-next-method obj stream)))
;;; ----------------------------------------------------------------
;;; stupid "decoder sets"..
;;; ----------------------------------------------------------------
(defmacro make-decoder-set (&rest decoder-spec)
(let ((keys (mapcar #'first decoder-spec))
(vals (mapcar #'second decoder-spec)))
(list 'quote
(mapcar #'cons keys vals))))
(defmacro make-encoder-set (&rest decoder-spec)
(let ((keys (mapcar #'first decoder-spec))
(vals (mapcar #'second decoder-spec)))
(list 'quote
(mapcar #'cons vals keys))))
(defun decode-set (decoder-set index &key (errorp t))
;; (declare (type list decoder))
(let ((r (cdr (assoc index decoder-set
:test #'equal))))
(when (and (not r) errorp)
(error "failed to look up ~A:~A in the set ~A"
(type-of index)
index
(mapcar #'(lambda (cons)
(format nil "(~A:~A . ~A)"
(type-of (car cons))
(car cons)
(cdr cons)))
decoder-set)))
r))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 2000,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: ia-x86-inline-data.lisp
;;;; Description: Objects that represents inline data in assembly listings.
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Mon Aug 21 10:35:46 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: inline-data.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86")
(defclass inline-data () ())
(defun bitsize-to-sizeof (bitsize)
(unless (and (>= bitsize 0)
(zerop (mod bitsize 8)))
(error "Illegal bitsize ~A, must be positive multiple of 8." bitsize))
(truncate bitsize 8))
(defclass inline-data-format (inline-data)
((format :reader inline-data-format-format
:initarg format)
(sizeof :reader inline-data-format-sizeof
:initarg sizeof)
(args :reader inline-data-format-args
:initarg args)))
(defun make-inline-data-format (bitsize format args)
"Make an inlined, formatted, null-terminated string."
(check-type format string)
(make-instance 'inline-data-format
'format format
'sizeof (and bitsize (bitsize-to-sizeof bitsize))
'args args))
(defmethod inline-data-encode ((data inline-data-format) env)
(with-slots (format sizeof args) data
(let ((string (apply #'format nil format (inline-data-resolve-arglist args env))))
(when (and sizeof (plusp sizeof)
(>= (length string) (expt 2 (* 8 sizeof))))
(error "String doesn't fit in ~D-byte: ~S" (* 8 sizeof) format))
(nconc
;; if we have a positive sizeof, insert byte with string-length.
(if (and sizeof (plusp sizeof))
(list (complex (length string) sizeof))
nil)
;; insert the string
(map 'list #'(lambda (c) (complex (char-code c) 1)) string)
;; if sizeof is zero, null-terminate the string.
(and sizeof (zerop sizeof) (list #c(0 1)))))))
(defmethod inline-data-guess-sizeof ((data inline-data-format) env)
(with-slots (format sizeof args) data
(+ (or (and sizeof (zerop sizeof) 1) 0)
(length (apply #'format nil format (inline-data-resolve-arglist-with-zeros args env))))))
(defmethod print-object ((obj inline-data-format) stream)
(cond
(*print-pretty*
(format stream
"#<asm string ~S>"
(inline-data-format-format obj))
obj)
(t (call-next-method obj stream))))
;;;; Inline data generated assembly-time by functions.
(defclass inline-data-fun (inline-data)
((fun :reader inline-data-fun-fun
:initarg fun)
(args :reader inline-data-fun-args
:initarg args)))
(defun make-inline-fun (expr)
(destructuring-bind ((fun &rest args)) expr
(make-instance 'inline-data-fun
'fun fun
'args args)))
(defmethod inline-data-guess-sizeof ((data inline-data-fun) env)
(loop for cbyte in (apply (inline-data-fun-fun data)
(inline-data-resolve-arglist-with-zeros (inline-data-fun-args data) env))
summing (imagpart cbyte)))
(defmethod inline-data-encode ((data inline-data-fun) env)
(mapcar #'(lambda (cbyte)
(complex (change-endian (realpart cbyte) (imagpart cbyte))
(imagpart cbyte)))
(apply (inline-data-fun-fun data)
(inline-data-resolve-arglist (inline-data-fun-args data) env))))
;;;; Inline bytes (of various sizes)
(defclass inline-bytes (inline-data)
((values :reader inline-bytes-values
:initarg values)
(sizeof :reader inline-bytes-sizeof
:initarg sizeof)))
(defmethod inline-data-guess-sizeof ((data inline-bytes) env)
(declare (ignore env))
(* (length (inline-bytes-values data))
(inline-bytes-sizeof data)))
(defmethod inline-data-encode ((data inline-bytes) env)
(mapcar #'(lambda (value)
(complex (change-endian value (inline-bytes-sizeof data))
(inline-bytes-sizeof data)))
(inline-data-resolve-arglist (inline-bytes-values data) env)))
(defun make-inline-bytes (sizeof args)
(unless (and (plusp sizeof)
(zerop (mod sizeof 8)))
(error "Illegal byte-size ~A, must be positive multiple of 8." sizeof))
(make-instance 'inline-bytes
'values args
'sizeof (truncate sizeof 8)))
;;; Inline aligment
(defclass inline-alignment (inline-data)
((align :reader inline-alignment-align
:initarg align)
(fill-octet :reader inline-alignment-fill-octet
:initarg fill-octet)))
(defun make-inline-alignment (align &optional (fill-octet 0))
(check-type fill-octet (unsigned-byte 8))
(make-instance 'inline-alignment
'align align
'fill-octet fill-octet))
(defmethod inline-data-encode ((data inline-alignment) env)
(loop for i from 0
while (not (zerop (mod (+ i (assemble-env-current-pc env))
(inline-alignment-align data))))
collect (complex (inline-alignment-fill-octet data) 1)))
;;;; label resolver functions
(defun inline-data-label-reference-p (expr)
"Determine if EXPR is a label refenence (i.e. a quoted symbol)."
(and (listp expr)
(= 2 (length expr))
(eq 'quote (first expr))
(symbolp (second expr))))
(defun inline-data-resolve-arglist (arglist env)
(let* (unresolveds
(arglist (mapcar #'(lambda (arg)
(if (inline-data-label-reference-p arg)
(or (symtab-try-lookup-label (assemble-env-symtab env) (second arg))
(pushnew (second arg) unresolveds))
arg))
arglist)))
(if (not (null unresolveds))
(error 'unresolved-labels 'labels unresolveds)
arglist)))
(defun inline-data-resolve-arglist-with-zeros (arglist env)
(mapcar #'(lambda (arg)
(if (inline-data-label-reference-p arg)
(or (symtab-try-lookup-label (assemble-env-symtab env) (second arg))
0)
arg))
arglist))
(defun read-inline-data (expr)
(destructuring-bind (marker type &rest args)
expr
(assert (string= '% marker))
(cond
((string= 'format type) (make-inline-data-format (first args) (second args) (nthcdr 2 args)))
((string= 'fun type) (make-inline-fun args))
((string= 'bytes type) (make-inline-bytes (first args) (rest args)))
((string= 'align type) (apply #'make-inline-alignment args))
(t (error "Unknown inline data item: ~A" expr)))))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 20012000, 2003,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: instr-add.lisp
;;;; Description: Addition-related instructions.
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Sat Jan 29 20:20:18 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: instr-add.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86-INSTR")
;;; ----------------------------------------------------------------
;;; ADD [IISR page 11-22]
;;; ----------------------------------------------------------------
(def-instr add (instruction))
(def-instr addb (add)
(:plain #x04 (0 1) (imm8 al))
(:digit (#x80 0) 1 (imm8 r/m8))
(:r #x00 (r8 r/m8))
(:r #x02 (r/m8 r8)))
(def-instr addw (add)
(:plain #x05 (0 2) (imm16 ax) :operand-mode :16-bit)
(:digit (#x81 0) 2 (imm16 r/m16) :operand-mode :16-bit)
(:digit (#x83 0) 1 (imm8 r/m16) :operand-mode :16-bit) ; sign-extend
(:r #x01 (r16 r/m16) :operand-mode :16-bit)
(:r #x03 (r/m16 r16) :operand-mode :16-bit))
(def-instr addl (add)
(:plain #x05 (0 4) (simm32 eax) :operand-mode :32-bit)
(:digit (#x81 0) 4 (simm32 r/m32) :operand-mode :32-bit)
(:digit (#x83 0) 1 (simm8 r/m32) :operand-mode :32-bit)
(:r #x01 (r32 r/m32) :operand-mode :32-bit)
(:r #x03 (r/m32 r32) :operand-mode :32-bit))
;;; ----------------------------------------------------------------
;;; ADC - add with carry [IISR page 11-20]
;;; ----------------------------------------------------------------
(def-instr adc (instruction))
(def-instr adcb (adc)
(:plain #x14 (0 1) (imm8 al))
(:digit (#x80 2) 1 (imm8 r/m8))
(:r #x10 (r8 r/m8))
(:r #x12 (r/m8 r8)))
(def-instr adcw (adc)
(:plain #x15 (0 2) (imm16 ax) :operand-mode :16-bit)
(:digit (#x81 2) 2 (imm16 r/m16) :operand-mode :16-bit)
(:digit (#x83 2) 1 (imm8 r/m16) :operand-mode :16-bit) ; sign-extend
(:r #x11 (r16 r/m16) :operand-mode :16-bit)
(:r #x13 (r/m16 r16) :operand-mode :16-bit))
(def-instr adcl (adc)
(:plain #x15 (0 4) (simm32 eax) :operand-mode :32-bit)
(:digit (#x81 2) 4 (simm32 r/m32) :operand-mode :32-bit)
(:digit (#x83 2) 1 (simm8 r/m32) :operand-mode :32-bit)
(:r #x11 (r32 r/m32) :operand-mode :32-bit)
(:r #x13 (r/m32 r32) :operand-mode :32-bit))
;;; ----------------------------------------------------------------
;;; INC [IISR page 11-211]
;;; ----------------------------------------------------------------
(def-instr inc (instruction))
(def-instr incb (inc)
(:digit (#xfe 0) 0 (r/m8)))
(def-instr incw (inc)
(:+ #x40 0 (+r16) :operand-mode :16-bit)
(:digit (#xff 0) 0 (r/m16) :operand-mode :16-bit))
(def-instr incl (inc)
(:+ #x40 0 (+r32) :operand-mode :32-bit)
(:digit (#xff 0) 0 (r/m32) :operand-mode :32-bit))
;;; Exchange and add
(def-instr xadd (add))
(def-instr xaddb (xadd) (:r #x0fc0 (r8 r/m8)))
(def-instr xaddw (xadd) (:r #x0fc1 (r16 r/m16) :operand-mode :16-bit))
(def-instr xaddl (xadd) (:r #x0fc1 (r32 r/m32) :operand-mode :32-bit))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 20012000,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: ia-x86-instr-and-or.lisp
;;;; Description: Bitwise boolean operations.
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Tue Feb 1 17:39:09 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: instr-and-or.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86-INSTR")
;;; ----------------------------------------------------------------
;;; AND [IISR page 11-64]
;;; ----------------------------------------------------------------
(def-instr and (instruction))
(def-instr andb (and)
(:plain #x24 (0 1) (imm8 al))
(:digit (#x80 4) 1 (imm8 r/m8))
(:r #x20 (r8 r/m8))
(:r #x22 (r/m8 r8)))
(def-instr andw (and)
(:plain #x25 (0 2) (imm16 ax) :operand-mode :16-bit)
(:digit (#x81 4) 2 (imm16 r/m16) :operand-mode :16-bit)
(:digit (#x83 4) 1 (simm8 r/m16) :operand-mode :16-bit)
(:r #x21 (r16 r/m16) :operand-mode :16-bit)
(:r #x23 (r/m16 r16) :operand-mode :16-bit))
(def-instr andl (and)
(:plain #x25 (0 4) (imm32 eax) :operand-mode :32-bit)
(:digit (#x81 4) 4 (imm32 r/m32) :operand-mode :32-bit)
(:digit (#x83 4) 1 (simm8 r/m32) :operand-mode :32-bit)
(:r #x21 (r32 r/m32) :operand-mode :32-bit)
(:r #x23 (r/m32 r32) :operand-mode :32-bit))
;;; ----------------------------------------------------------------
;;; OR [IISR page 11-301]
;;; ----------------------------------------------------------------
(def-instr or (instruction))
(def-instr orb (or)
(:plain #x0c (0 1) (imm8 al))
(:digit (#x80 1) 1 (imm8 r/m8))
(:r #x08 (r8 r/m8))
(:r #x0a (r/m8 r8)))
(def-instr orw (or)
(:plain #x0d (0 2) (imm16 ax) :operand-mode :16-bit)
(:digit (#x81 1) 2 (imm16 r/m16) :operand-mode :16-bit)
(:digit (#x83 1) 1 (simm8 r/m16) :operand-mode :16-bit)
(:r #x09 (r16 r/m16) :operand-mode :16-bit)
(:r #x0b (r/m16 r16) :operand-mode :16-bit))
(def-instr orl (or)
(:plain #x0d (0 4) (imm32 eax) :operand-mode :32-bit)
(:digit (#x81 1) 4 (imm32 r/m32) :operand-mode :32-bit)
(:digit (#x83 1) 1 (simm8 r/m32) :operand-mode :32-bit)
(:r #x09 (r32 r/m32) :operand-mode :32-bit)
(:r #x0b (r/m32 r32) :operand-mode :32-bit))
;;; ----------------------------------------------------------------
;;; XOR [IISR page 11-392]
;;; ----------------------------------------------------------------
(def-instr xor (instruction))
(def-instr xorb (xor)
(:plain #x34 (0 1) (imm8 al))
(:digit (#x80 6) 1 (imm8 r/m8))
(:r #x30 (r8 r/m8))
(:r #x32 (r/m8 r8)))
(def-instr xorw (xor)
(:plain #x35 (0 2) (imm16 ax) :operand-mode :16-bit)
(:digit (#x81 6) 2 (imm16 r/m16) :operand-mode :16-bit)
(:digit (#x83 6) 1 (simm8 r/m16) :operand-mode :16-bit)
(:r #x31 (r16 r/m16) :operand-mode :16-bit)
(:r #x33 (r/m16 r16) :operand-mode :16-bit))
(def-instr xorl (xor)
(:plain #x35 (0 4) (imm32 eax) :operand-mode :32-bit)
(:digit (#x81 6) 4 (imm32 r/m32) :operand-mode :32-bit)
(:digit (#x83 6) 1 (simm8 r/m32) :operand-mode :32-bit)
(:r #x31 (r32 r/m32) :operand-mode :32-bit)
(:r #x33 (r/m32 r32) :operand-mode :32-bit))
;;; ----------------------------------------------------------------
;;; NOT [IISR page 11-299]
;;; ----------------------------------------------------------------
(def-instr not (instruction))
(def-instr notb (not) (:digit (#xf6 2) 0 (r/m8)))
(def-instr notw (not) (:digit (#xf7 2) 0 (r/m16) :operand-mode :16-bit))
(def-instr notl (not) (:digit (#xf7 2) 0 (r/m32) :operand-mode :32-bit))
;;;;------------------------------------------------------------------
;;;;
;;;; Copyright (C) 2000,
;;;; Department of Computer Science, University of Troms, Norway
;;;;
;;;; Filename: ia-x86-instr-bit.lisp
;;;; Description: Bit operations.
;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
;;;; Created at: Tue Feb 1 20:03:30 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
;;;; $Id: instr-bit.lisp,v 1.1.1.1 2004/01/12 14:19:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
(in-package "IA-X86-INSTR")
;;; ----------------------------------------------------------------
;;; Bit instructions
;;; ----------------------------------------------------------------
(def-instr bsf (instruction)) ; bit scan forward