• 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-text-segment-bytes

    Fill the sections of the __TEXT segment into mach-o stobj

    Signature
    (fill-text-segment-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-text-segment-bytes

    (defun fill-text-segment-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-text-segment-bytes))
                (declare (ignorable __function__))
                (b* (((mv flg mach-o state)
                      (fill-text-text-section-bytes
                           h-size
                           lc-size remaining-file mach-o state))
                     ((when flg) (mv flg mach-o state))
                     ((mv flg mach-o state)
                      (fill-text-cstring-section-bytes
                           h-size
                           lc-size remaining-file mach-o state))
                     ((when flg) (mv flg mach-o state))
                     ((mv flg mach-o state)
                      (fill-text-const-section-bytes
                           h-size
                           lc-size remaining-file mach-o state))
                     ((when flg) (mv flg mach-o state)))
                    (mv flg mach-o state))))

    Theorem: good-mach-o-p-of-fill-text-segment-bytes.new-mach-o

    (defthm
     good-mach-o-p-of-fill-text-segment-bytes.new-mach-o
     (implies
      (good-mach-o-p mach-o)
      (b*
       (((mv ?err ?new-mach-o ?new-state)
         (fill-text-segment-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-text-segment-bytes.new-state

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