2#ifndef ROSE_SgAsmLEFileHeader_H 
    3#define ROSE_SgAsmLEFileHeader_H 
    5#include <Cxx_GrammarDeclarations.h> 
    6#include <SgAsmGenericHeader.h> 
   27#include <Rose/BinaryAnalysis/Address.h> 
   28#include <Rose/BinaryAnalysis/ByteOrder.h> 
   30#ifdef ROSE_SgAsmLEFileHeader_IMPL 
   31#include <SgAsmDOSExtendedHeader.h> 
   32#include <SgAsmLEEntryTable.h> 
   33#include <SgAsmLENameTable.h> 
   34#include <SgAsmLEPageTable.h> 
   35#include <SgAsmLERelocTable.h> 
   36#include <SgAsmLESectionTable.h> 
   44#if !defined(DOCUMENTATION) 
   59#ifdef ROSE_ENABLE_BOOST_SERIALIZATION 
   61    friend class boost::serialization::access;
 
   67        s & BOOST_SERIALIZATION_NVP(p_e_byte_order);
 
   68        s & BOOST_SERIALIZATION_NVP(p_e_word_order);
 
   69        s & BOOST_SERIALIZATION_NVP(p_e_format_level);
 
   70        s & BOOST_SERIALIZATION_NVP(p_e_cpu_type);
 
   71        s & BOOST_SERIALIZATION_NVP(p_e_os_type);
 
   72        s & BOOST_SERIALIZATION_NVP(p_e_module_version);
 
   73        s & BOOST_SERIALIZATION_NVP(p_e_flags);
 
   74        s & BOOST_SERIALIZATION_NVP(p_e_eip_section);
 
   75        s & BOOST_SERIALIZATION_NVP(p_e_esp_section);
 
   76        s & BOOST_SERIALIZATION_NVP(p_e_last_page_size);
 
   77        s & BOOST_SERIALIZATION_NVP(p_e_page_offset_shift);
 
   78        s & BOOST_SERIALIZATION_NVP(p_e_fixup_sect_cksum);
 
   79        s & BOOST_SERIALIZATION_NVP(p_e_loader_sect_cksum);
 
   80        s & BOOST_SERIALIZATION_NVP(p_e_secttab_nentries);
 
   81        s & BOOST_SERIALIZATION_NVP(p_e_rsrctab_nentries);
 
   82        s & BOOST_SERIALIZATION_NVP(p_e_fmtdirtab_nentries);
 
   83        s & BOOST_SERIALIZATION_NVP(p_e_import_modtab_nentries);
 
   84        s & BOOST_SERIALIZATION_NVP(p_e_preload_npages);
 
   85        s & BOOST_SERIALIZATION_NVP(p_e_nonresnametab_size);
 
   86        s & BOOST_SERIALIZATION_NVP(p_e_nonresnametab_cksum);
 
   87        s & BOOST_SERIALIZATION_NVP(p_e_auto_ds_section);
 
   88        s & BOOST_SERIALIZATION_NVP(p_e_debug_info_size);
 
   89        s & BOOST_SERIALIZATION_NVP(p_e_num_instance_preload);
 
   90        s & BOOST_SERIALIZATION_NVP(p_e_num_instance_demand);
 
   91        s & BOOST_SERIALIZATION_NVP(p_e_heap_size);
 
   92        s & BOOST_SERIALIZATION_NVP(p_e_npages);
 
   93        s & BOOST_SERIALIZATION_NVP(p_e_eip);
 
   94        s & BOOST_SERIALIZATION_NVP(p_e_esp);
 
   95        s & BOOST_SERIALIZATION_NVP(p_e_page_size);
 
   96        s & BOOST_SERIALIZATION_NVP(p_e_fixup_sect_size);
 
   97        s & BOOST_SERIALIZATION_NVP(p_e_loader_sect_size);
 
   98        s & BOOST_SERIALIZATION_NVP(p_e_secttab_rfo);
 
   99        s & BOOST_SERIALIZATION_NVP(p_e_pagetab_rfo);
 
  100        s & BOOST_SERIALIZATION_NVP(p_e_iterpages_offset);
 
  101        s & BOOST_SERIALIZATION_NVP(p_e_rsrctab_rfo);
 
  102        s & BOOST_SERIALIZATION_NVP(p_e_resnametab_rfo);
 
  103        s & BOOST_SERIALIZATION_NVP(p_e_entrytab_rfo);
 
  104        s & BOOST_SERIALIZATION_NVP(p_e_fmtdirtab_rfo);
 
  105        s & BOOST_SERIALIZATION_NVP(p_e_fixup_pagetab_rfo);
 
  106        s & BOOST_SERIALIZATION_NVP(p_e_fixup_rectab_rfo);
 
  107        s & BOOST_SERIALIZATION_NVP(p_e_import_modtab_rfo);
 
  108        s & BOOST_SERIALIZATION_NVP(p_e_import_proctab_rfo);
 
  109        s & BOOST_SERIALIZATION_NVP(p_e_ppcksumtab_rfo);
 
  110        s & BOOST_SERIALIZATION_NVP(p_e_data_pages_offset);
 
  111        s & BOOST_SERIALIZATION_NVP(p_e_nonresnametab_offset);
 
  112        s & BOOST_SERIALIZATION_NVP(p_e_debug_info_rfo);
 
  113        s & BOOST_SERIALIZATION_NVP(p_dos2Header);
 
  114        s & BOOST_SERIALIZATION_NVP(p_sectionTable);
 
  115        s & BOOST_SERIALIZATION_NVP(p_pageTable);
 
  116        s & BOOST_SERIALIZATION_NVP(p_residentNameTable);
 
  117        s & BOOST_SERIALIZATION_NVP(p_nonresidentNameTable);
 
  118        s & BOOST_SERIALIZATION_NVP(p_entryTable);
 
  119        s & BOOST_SERIALIZATION_NVP(p_relocationTable);
 
  131    struct LEFileHeader_disk {
 
  132        unsigned char e_magic[2];           
 
  133        unsigned char e_byte_order;         
 
  134        unsigned char e_word_order;         
 
  135        uint32_t    e_format_level;         
 
  138        uint32_t    e_module_version;       
 
  141        uint32_t    e_eip_section;          
 
  143        uint32_t    e_esp_section;          
 
  145        uint32_t    e_page_size;            
 
  146        uint32_t    e_lps_or_shift;         
 
  147        uint32_t    e_fixup_sect_size;      
 
  148        uint32_t    e_fixup_sect_cksum;     
 
  149        uint32_t    e_loader_sect_size;     
 
  150        uint32_t    e_loader_sect_cksum;    
 
  151        uint32_t    e_secttab_rfo;          
 
  152        uint32_t    e_secttab_nentries;     
 
  153        uint32_t    e_pagetab_rfo;          
 
  154        uint32_t    e_iterpages_offset;     
 
  155        uint32_t    e_rsrctab_rfo;          
 
  156        uint32_t    e_rsrctab_nentries;     
 
  157        uint32_t    e_resnametab_rfo;       
 
  158        uint32_t    e_entrytab_rfo;         
 
  159        uint32_t    e_fmtdirtab_rfo;        
 
  160        uint32_t    e_fmtdirtab_nentries;   
 
  161        uint32_t    e_fixup_pagetab_rfo;    
 
  162        uint32_t    e_fixup_rectab_rfo;     
 
  163        uint32_t    e_import_modtab_rfo;    
 
  164        uint32_t    e_import_modtab_nentries;
 
  165        uint32_t    e_import_proctab_rfo;   
 
  166        uint32_t    e_ppcksumtab_rfo;       
 
  167        uint32_t    e_data_pages_offset;    
 
  168        uint32_t    e_preload_npages;       
 
  169        uint32_t    e_nonresnametab_offset; 
 
  170        uint32_t    e_nonresnametab_size;   
 
  171        uint32_t    e_nonresnametab_cksum;  
 
  172        uint32_t    e_auto_ds_section;      
 
  173        uint32_t    e_debug_info_rfo;       
 
  174        uint32_t    e_debug_info_size;      
 
  175        uint32_t    e_num_instance_preload; 
 
  176        uint32_t    e_num_instance_demand;  
 
  177        uint32_t    e_heap_size;            
 
  182          __attribute__((packed))
 
  191        HF_RESERVED         = 0xbffc5ccb,   
 
  192        HF_PROC_LIB_INIT    = 0x00000004,   
 
  193        HF_IFIXUPS_APPLIED  = 0x00000010,   
 
  194        HF_EFIXUPS_APPLIED  = 0x00000020,   
 
  195        HF_PM_WINDOW_NO     = 0x00000100,   
 
  196        HF_PM_WINDOW_OK     = 0x00000200,   
 
  197        HF_PM_WINDOW_USE    = 0x00000300,   
 
  198        HF_NOT_LOADABLE     = 0x00002000,   
 
  199        HF_PROC_LIB_TERM    = 0x40000000,   
 
  201        HF_MODTYPE_MASK     = 0x00038000,   
 
  202        HF_MODTYPE_PROG     = 0x00000000,   
 
  203        HF_MODTYPE_LIB      = 0x00008000,   
 
  204        HF_MODTYPE_PLIB     = 0x00018000,   
 
  205        HF_MODTYPE_PDEV     = 0x00020000,   
 
  206        HF_MODTYPE_VDEV     = 0x00028000    
 
  214    unsigned const& get_e_byte_order() 
const;
 
  215    void set_e_byte_order(
unsigned const&);
 
  218    unsigned const& get_e_word_order() 
const;
 
  219    void set_e_word_order(
unsigned const&);
 
  222    unsigned const& get_e_format_level() 
const;
 
  223    void set_e_format_level(
unsigned const&);
 
  226    unsigned const& get_e_cpu_type() 
const;
 
  227    void set_e_cpu_type(
unsigned const&);
 
  230    unsigned const& get_e_os_type() 
const;
 
  231    void set_e_os_type(
unsigned const&);
 
  234    unsigned const& get_e_module_version() 
const;
 
  235    void set_e_module_version(
unsigned const&);
 
  238    unsigned const& get_e_flags() 
const;
 
  239    void set_e_flags(
unsigned const&);
 
  242    unsigned const& get_e_eip_section() 
const;
 
  243    void set_e_eip_section(
unsigned const&);
 
  246    unsigned const& get_e_esp_section() 
const;
 
  247    void set_e_esp_section(
unsigned const&);
 
  250    unsigned const& get_e_last_page_size() 
const;
 
  251    void set_e_last_page_size(
unsigned const&);
 
  254    unsigned const& get_e_page_offset_shift() 
const;
 
  255    void set_e_page_offset_shift(
unsigned const&);
 
  258    unsigned const& get_e_fixup_sect_cksum() 
const;
 
  259    void set_e_fixup_sect_cksum(
unsigned const&);
 
  262    unsigned const& get_e_loader_sect_cksum() 
const;
 
  263    void set_e_loader_sect_cksum(
unsigned const&);
 
  266    unsigned const& get_e_secttab_nentries() 
const;
 
  267    void set_e_secttab_nentries(
unsigned const&);
 
  270    unsigned const& get_e_rsrctab_nentries() 
const;
 
  271    void set_e_rsrctab_nentries(
unsigned const&);
 
  274    unsigned const& get_e_fmtdirtab_nentries() 
const;
 
  275    void set_e_fmtdirtab_nentries(
unsigned const&);
 
  278    unsigned const& get_e_import_modtab_nentries() 
const;
 
  279    void set_e_import_modtab_nentries(
unsigned const&);
 
  282    unsigned const& get_e_preload_npages() 
const;
 
  283    void set_e_preload_npages(
unsigned const&);
 
  286    unsigned const& get_e_nonresnametab_size() 
const;
 
  287    void set_e_nonresnametab_size(
unsigned const&);
 
  290    unsigned const& get_e_nonresnametab_cksum() 
const;
 
  291    void set_e_nonresnametab_cksum(
unsigned const&);
 
  294    unsigned const& get_e_auto_ds_section() 
const;
 
  295    void set_e_auto_ds_section(
unsigned const&);
 
  298    unsigned const& get_e_debug_info_size() 
const;
 
  299    void set_e_debug_info_size(
unsigned const&);
 
  302    unsigned const& get_e_num_instance_preload() 
const;
 
  303    void set_e_num_instance_preload(
unsigned const&);
 
  306    unsigned const& get_e_num_instance_demand() 
const;
 
  307    void set_e_num_instance_demand(
unsigned const&);
 
  310    unsigned const& get_e_heap_size() 
const;
 
  311    void set_e_heap_size(
unsigned const&);
 
  429    virtual void unparse(std::ostream&) 
const override;
 
  430    virtual void dump(FILE*, 
const char *prefix, ssize_t idx) 
const override;
 
  449    SgAsmLEPageTable* get_page_table() const ROSE_DEPRECATED("use get_pageTable");
 
  450    void set_page_table(
SgAsmLEPageTable*) ROSE_DEPRECATED("use set_pageTable");
 
  451    SgAsmLENameTable* get_resname_table() const ROSE_DEPRECATED("use get_residentNameTable");
 
  452    void set_resname_table(
SgAsmLENameTable*) ROSE_DEPRECATED("use set_residentNameTable");
 
  453    SgAsmLENameTable* get_nonresname_table() const ROSE_DEPRECATED("use get_nonresidentNameTable");
 
  454    void set_nonresname_table(
SgAsmLENameTable*) ROSE_DEPRECATED("use set_nonresidentNameTable");
 
  455    SgAsmLEEntryTable* get_entry_table() const ROSE_DEPRECATED("use get_entryTable");
 
  457    SgAsmLERelocTable* get_reloc_table() const ROSE_DEPRECATED("use get_relocationTable");
 
  458    void set_reloc_table(
SgAsmLERelocTable*) ROSE_DEPRECATED("use set_relocationTable");
 
  459    const 
char *format_name() const override ROSE_DEPRECATED("use formatName");
 
  476    void initializeProperties();
 
  495          virtual std::
string class_name() const override;
 
  498          virtual VariantT variantT() const override; 
 
  503          enum { static_variant = V_SgAsmLEFileHeader };
 
  518          static const unsigned pool_size; 
 
  520          static std::vector<unsigned char *> pools; 
 
  525          static unsigned long initializeStorageClassArray(SgAsmLEFileHeaderStorageClass *); 
 
  528          static void clearMemoryPool(); 
 
  529          static void deleteMemoryPool(); 
 
  532          static void extendMemoryPoolForFileIO(); 
 
  537          static SgAsmLEFileHeader * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, 
unsigned long); 
 
  540          static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(
unsigned long); 
 
  542          static void resetValidFreepointers(); 
 
  544          static unsigned long getNumberOfLastValidPointer(); 
 
  547#if defined(INLINE_FUNCTIONS) 
  549          inline void *
operator new (
size_t size);
 
  552          void *
operator new (
size_t size);
 
  555          void operator delete (
void* pointer, 
size_t size);
 
  558          void operator delete (
void* pointer)
 
  604#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT 
  607          virtual RTIReturnType 
roseRTI() 
override;
 
  621          virtual const char* 
sage_class_name() const  override ROSE_DEPRECATED_FUNCTION;
 
  627          virtual int variant() const ROSE_DEPRECATED_FUNCTION;
 
  809          friend class SgAsmLEFileHeaderStorageClass;
 
  812          friend class AstSpecificDataManagingClass;
 
  815          friend class AstSpecificDataManagingClassStorageClass;
 
  847#define BUILD_ATERM_SUPPORT 0 
  848   #if BUILD_ATERM_SUPPORT 
  849   #ifdef ROSE_USE_ROSE_ATERM_SUPPORT 
  861          virtual ATerm generate_ATerm() 
override;
 
  864          virtual void generate_ATerm_Annotation(ATerm & term) 
override;
 
  942unsigned p_e_byte_order;
 
  946unsigned p_e_word_order;
 
  950unsigned p_e_format_level;
 
  954unsigned p_e_cpu_type;
 
  962unsigned p_e_module_version;
 
  970unsigned p_e_eip_section;
 
  974unsigned p_e_esp_section;
 
  978unsigned p_e_last_page_size;
 
  982unsigned p_e_page_offset_shift;
 
  986unsigned p_e_fixup_sect_cksum;
 
  990unsigned p_e_loader_sect_cksum;
 
  994unsigned p_e_secttab_nentries;
 
  998unsigned p_e_rsrctab_nentries;
 
 1002unsigned p_e_fmtdirtab_nentries;
 
 1006unsigned p_e_import_modtab_nentries;
 
 1010unsigned p_e_preload_npages;
 
 1014unsigned p_e_nonresnametab_size;
 
 1018unsigned p_e_nonresnametab_cksum;
 
 1022unsigned p_e_auto_ds_section;
 
 1026unsigned p_e_debug_info_size;
 
 1030unsigned p_e_num_instance_preload;
 
 1034unsigned p_e_num_instance_demand;
 
 1038unsigned p_e_heap_size;
 
Class holding static data and functions supporting File I/O.
 
Attribute containing a regex expression as a string.
 
Base class for binary files.
 
virtual SgAsmGenericSection * parse()
Parse contents of the section.
 
Supporting class from copy mechanism within ROSE.
 
This class represents the base class for all IR nodes within Sage III.
 
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
 
virtual size_t get_numberOfTraversalSuccessors() const
return number of children in the traversal successor list
 
virtual std::vector< std::string > get_traversalSuccessorNamesContainer() const
container of names of variables or container indices used used in the traversal to access AST success...
 
virtual void debugSerializationEnd(const char *className)
Called by generated serializers.
 
static std::string getNodeIdString(SgNode *sgnode)
compute the NodeId for a particular SgNode*.
 
virtual bool isInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
 
int variant() const
Older version function returns enum value "NODE".
 
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler *)
FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
 
virtual size_t get_childIndex(SgNode *child) const
index-based access to traversal successors by child node
 
virtual std::vector< SgNode * > get_traversalSuccessorContainer() const
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
 
virtual long getChildIndex(SgNode *childNode) const
FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR no...
 
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
 
virtual SgNode * get_traversalSuccessorByIndex(size_t idx) const
index-based access to traversal successors by index number
 
static void visitRepresentativeNode(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for type-based traversal.
 
virtual void checkDataMemberPointersIfInMemoryPool()
FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the he...
 
static size_t numberOfNodes()
Returns the total number of IR nodes of this type.
 
virtual void accept(ROSE_VisitorPattern &visitor)
support for the classic visitor pattern done in GoF
 
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
 
void executeVisitorMemberFunction(ROSE_VisitorPattern &visitor)
FOR INTERNAL USE Support for visitor pattern.
 
static SgNode * getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx)
Find a node by its variant type, pool index, and item index.
 
static size_t memoryUsage()
Returns the size in bytes of the total memory allocated for all IR nodes of this type.
 
static void traverseMemoryPoolNodes(ROSE_VisitTraversal &visit)
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
 
virtual const char * sage_class_name() const
generates string representing the class name: (e.g. for SgNode returns "SgNode").
 
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers() const
FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools
 
static SgNode * getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx)
FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
 
SgNode * addRegExpAttribute(std::string s, AstRegExAttribute *a)
Support for AST matching using regular expression.
 
std::uint64_t Address
Address.
 
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
 
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.