• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
      • Axe
      • 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-text-section-bytes
          • Fill-text-segment-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
          • Take-till-zero
          • Charlist->bytes
          • Merge-bytes
          • Bytes->charlist
          • String->bytes
          • Bytes->string
      • Math
      • Testing-utilities
    • Mach-o-reader

    Populate-mach-o

    Initialize the MACH-O stobj with contents of MACH-O binary filename

    Signature
    (populate-mach-o filename mach-o state) 
      → 
    (mv alst new-mach-o state)
    Arguments
    filename — Guard (stringp filename).
    Returns
    new-mach-o — Type (good-mach-o-p new-mach-o), given (good-mach-o-p mach-o).

    Definitions and Theorems

    Function: populate-mach-o

    (defun populate-mach-o (filename mach-o state)
      (declare (xargs :stobjs (mach-o state)))
      (declare (xargs :guard (stringp filename)))
      (let ((__function__ 'populate-mach-o))
        (declare (ignorable __function__))
        (b* (((mv contents state)
              (acl2::read-file-bytes filename state))
             ((unless (byte-listp contents))
              (prog2$ (raise "Error reading file ~s0!" filename)
                      (mv nil mach-o state))))
          (populate-mach-o-contents contents mach-o state))))

    Theorem: good-mach-o-p-of-populate-mach-o.new-mach-o

    (defthm good-mach-o-p-of-populate-mach-o.new-mach-o
      (implies (good-mach-o-p mach-o)
               (b* (((mv ?alst ?new-mach-o acl2::?state)
                     (populate-mach-o filename mach-o state)))
                 (good-mach-o-p new-mach-o)))
      :rule-classes :rewrite)