• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
        • Implemented-opcodes
        • To-do
        • Proof-utilities
        • Peripherals
        • Model-validation
          • Virtualization-for-validation
          • Dynamic-instrumentation
            • Printing-x86-components
              • !log-file-name
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Dynamic-instrumentation

    Printing-x86-components

    Functions to print some components of the x86 state, either to file (printing-x86-components) or to terminal (printing-x86-to-terminal)

    Definitions and Theorems

    Function: print-component

    (defun print-component (base num)
      (declare (xargs :guard (and (member-equal base '(10 16))
                                  (natp num))))
      (case base
        (10 (str::nat-to-dec-string num))
        (t (str::cat "#x" (str::nat-to-hex-string num)))))

    Function: printing-x86-to-string

    (defun printing-x86-to-string (base x86)
      (declare (xargs :stobjs (x86))
               (ignorable base x86))
      "")

    Function: printing-x86-components

    (defun printing-x86-components (base x86 state)
      (declare (xargs :stobjs (x86 state))
               (ignorable base x86 state))
      state)

    Function: printing-x86-to-terminal

    (defun printing-x86-to-terminal (base x86 state)
      (declare (xargs :stobjs (x86 state)))
      (b* ((str (printing-x86-to-string base x86))
           (state (fms str nil *standard-co* state nil)))
        (value :invisible)))

    Function: printing-flgs

    (defun printing-flgs (x86 state)
     (declare (xargs :stobjs (x86 state)))
     (b*
      ((cf (flgi :cf x86))
       (pf (flgi :pf x86))
       (af (flgi :af x86))
       (zf (flgi :zf x86))
       (sf (flgi :sf x86))
       (of (flgi :of x86))
       ((mv ?col state)
        (fmt!
         "(@@FLGS . ~%~
    ~tI((CF . ~s0)~%~
    ~tI (PF . ~s1)~%~
    ~tI (AF . ~s2)~%~
    ~tI (ZF . ~s3)~%~
    ~tI (SF . ~s4)~%~
    ~tI (OF . ~s5))~%~
    @@)~%~%"
         (list (cons #\0 cf)
               (cons #\1 pf)
               (cons #\2 af)
               (cons #\3 zf)
               (cons #\4 sf)
               (cons #\5 of)
               (cons #\I '8))
         *standard-co* state nil)))
      (value :invisible)))

    Function: printing-flg-val

    (defun printing-flg-val (eflags state)
     (declare (xargs :stobjs (state)))
     (b*
      ((cf (rflagsbits->cf eflags))
       (pf (rflagsbits->pf eflags))
       (af (rflagsbits->af eflags))
       (zf (rflagsbits->zf eflags))
       (sf (rflagsbits->sf eflags))
       (of (rflagsbits->of eflags))
       ((mv ?col state)
        (fmt!
         "(@@FLGS . ~%~
    ~tI((CF . ~s0)~%~
    ~tI (PF . ~s1)~%~
    ~tI (AF . ~s2)~%~
    ~tI (ZF . ~s3)~%~
    ~tI (SF . ~s4)~%~
    ~tI (OF . ~s5))~%~
    @@)~%~%"
         (list (cons #\0 cf)
               (cons #\1 pf)
               (cons #\2 af)
               (cons #\3 zf)
               (cons #\4 sf)
               (cons #\5 of)
               (cons #\I '8))
         *standard-co* state nil)))
      (value :invisible)))