• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
      • Execloader
        • Elf-reader
        • Mach-o-reader
          • Read-load_commands
          • Read-section_data_sz_structures
          • Mach-o-section-header
          • Mach-o-header
          • Populate-mach-o-contents
          • Good-mach-o-p
          • Fill-data-segment-bytes
          • Fill-text-segment-bytes
          • Fill-text-text-section-bytes
          • Fill-text-cstring-section-bytes
          • Fill-text-const-section-bytes
          • Fill-data-dyld-section-bytes
          • Fill-data-data-section-bytes
          • Fill-data-const-section-bytes
            • Fill-data-common-section-bytes
            • Fill-data-bss-section-bytes
            • Read-mach_header
            • Populate-mach-o
            • Mach-o-section-headers
          • Merge-first-split-bytes
          • Split-bytes
          • Charlist->bytes
          • Take-till-zero
          • Merge-bytes
          • Bytes->charlist
          • Bytes->string
          • String->bytes
        • Axe
      • Testing-utilities
      • Math
    • Mach-o-reader

    Fill-data-const-section-bytes

    Signature
    (fill-data-const-section-bytes h-size 
                                   lc-size remaining-file mach-o state) 
     
      → 
    (mv err new-mach-o new-state)
    Arguments
    remaining-file — Guard (byte-listp remaining-file).
    Returns
    new-mach-o — Type (good-mach-o-p new-mach-o), given (good-mach-o-p mach-o).
    new-state — Type (state-p new-state), given (state-p state).

    Definitions and Theorems

    Function: fill-data-const-section-bytes

    (defun
     fill-data-const-section-bytes
     (h-size lc-size remaining-file mach-o state)
     (declare (xargs :stobjs (mach-o state)))
     (declare (type (unsigned-byte 64) h-size)
              (type (unsigned-byte 64) lc-size))
     (declare (xargs :guard (byte-listp remaining-file)))
     (let
      ((__function__ 'fill-data-const-section-bytes))
      (declare (ignorable __function__))
      (b*
       ((size (@data-const-section-size mach-o))
        (offset (@data-const-section-offset mach-o))
        (section (if (equal size 0)
                     nil
                     (if (not (natp (- offset (+ h-size lc-size))))
                         t
                         (take size
                               (nthcdr (- offset (+ h-size lc-size))
                                       remaining-file)))))
        ((when (not (byte-listp section)))
         (cw
          "EOF encountered unexpectedly. DATA::const section could not be read.~%")
         (mv t mach-o state))
        (mach-o (!data-const-section-bytes section mach-o)))
       (mv nil mach-o state))))

    Theorem: good-mach-o-p-of-fill-data-const-section-bytes.new-mach-o

    (defthm good-mach-o-p-of-fill-data-const-section-bytes.new-mach-o
            (implies (good-mach-o-p mach-o)
                     (b* (((mv ?err ?new-mach-o ?new-state)
                           (fill-data-const-section-bytes
                                h-size
                                lc-size remaining-file mach-o state)))
                         (good-mach-o-p new-mach-o)))
            :rule-classes :rewrite)

    Theorem: state-p-of-fill-data-const-section-bytes.new-state

    (defthm state-p-of-fill-data-const-section-bytes.new-state
            (implies (state-p state)
                     (b* (((mv ?err ?new-mach-o ?new-state)
                           (fill-data-const-section-bytes
                                h-size
                                lc-size remaining-file mach-o state)))
                         (state-p new-state)))
            :rule-classes :rewrite)