• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
        • Program-execution
          • Dynamic-instrumentation
            • Printing-x86-components
              • !log-file-name
            • Initialize-x86-state
            • Binary-file-load-fn
            • Read-channel-into-memory
            • Setting-up-page-tables
            • Read-channel-into-byte-list
            • Init-zero-page
            • Linux-load
            • Read-file-into-memory
            • Read-file-into-byte-list
            • Init-sys-view
            • Load-elf-sections
            • Chars-to-c-str
            • String-to-c-str
            • Pack-u64
            • Pack-u32
            • Concrete-simulation-examples
            • Gdt-entry
          • Sdm-instruction-set-summary
          • Tlb
          • Running-linux
          • Introduction
          • Asmtest
          • X86isa-build-instructions
          • Publications
          • Contributors
          • Machine
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Svl
        • Rtl
      • 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)))