[Git][cmucl/cmucl][issue-97-define-ud2-inst] Update the int instruction to disassemble int3

Raymond Toy gitlab at common-lisp.net
Wed Apr 14 05:35:06 UTC 2021



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


Commits:
ae94d97a by Raymond Toy at 2021-04-13T22:34:46-07:00
Update the int instruction to disassemble int3

The int instruction would accept a code of 3 but would produce an int3
instruction.  However, the disassembly of this wasn't working since
the printer expected the opcode to be #b11001101 which didn't match
what was generated.  Hence, add a new printer to print int3 as "int
3".

Tested this by setting a breakpoint and disassembling the function to
see that the breakpoint is printed as "int 3" instead ".byte #xcc".

(Should we really make a separate int3 instruction?)

- - - - -


1 changed file:

- src/compiler/x86/insts.lisp


Changes:

=====================================
src/compiler/x86/insts.lisp
=====================================
@@ -2154,9 +2154,17 @@
 			  (ldb (byte 3 3) code)
 			  (ldb (byte 3 0) code))))
 
+;; Handles both int and int3.  To get int3 you have to say (inst int
+;; 3).  But int3 should not be used in Lisp code.  This is mainly so
+;; that int3 gets disassembled correctly if a breakpoint has been set
+;; in Lisp code.  (But in general the disassembly will be messed up
+;; because the following byte will in general be the second byte of
+;; some instruction, and not the first byte of an instruction.)
 (define-instruction int (segment number)
   (:declare (type (unsigned-byte 8) number))
   (:printer byte-imm ((op #b11001101)))
+  (:printer byte ((op #b11001100))
+	    `(:name :tab 3))
   (:emitter
    (etypecase number
      ((member 3)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ae94d97a06968206d030fe9f8676cf21ab8624a9

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ae94d97a06968206d030fe9f8676cf21ab8624a9
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20210414/4c7f6130/attachment.html>


More information about the cmucl-cvs mailing list