ROSE 0.11.145.192
SgAsmNEFileHeader.h
1
2#ifndef ROSE_SgAsmNEFileHeader_H
3#define ROSE_SgAsmNEFileHeader_H
4#include <RoseFirst.h>
5#include <Cxx_GrammarDeclarations.h>
6#include <SgAsmGenericHeader.h>
7
8
9
10/* #line 1 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
11
12// WARNING -- GENERATED CODE -- DO NOT MODIFY THIS CODE -- WARNING!
13// This code is automatically generated for each
14// terminal and non-terminal within the defined
15// grammar. There is a simple way to change the
16// code to fix bugs etc. See the ROSE README file
17// for directions.
18
19// tps: (02/22/2010): Adding DLL export requirements
20#include "rosedll.h"
21
22// predeclarations for SgAsmNEFileHeader
23
24/* #line 25 "../../../src/frontend/SageIII//SgAsmNEFileHeader.h" */
25/* #line 6501 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
26
27#include <Rose/BinaryAnalysis/Address.h>
28
29#ifdef ROSE_SgAsmNEFileHeader_IMPL
30#include <SgAsmDOSExtendedHeader.h>
31#include <SgAsmNEEntryTable.h>
32#include <SgAsmNEModuleTable.h>
33#include <SgAsmNENameTable.h>
34#include <SgAsmNESectionTable.h>
35#endif
36
37
38/* #line 13 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $PREDECLARATIONS" */
39
40/* #line 14 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
41
42#if !defined(DOCUMENTATION)
43// Class Definition for SgAsmNEFileHeader
44class ROSE_DLL_API SgAsmNEFileHeader : public SgAsmGenericHeader
45 {
46 public:
47
48
49/* #line 50 "../../../src/frontend/SageIII//SgAsmNEFileHeader.h" */
50
51 virtual SgNode* copy ( SgCopyHelp& help) const override;
52// Start of memberFunctionString
53/* #line 6728 "/workspace/src/ROSETTA/src/binaryInstruction.C" */
54
55
56 //----------------------- Boost serialization for SgAsmNEFileHeader -----------------------
57#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
58private:
59 friend class boost::serialization::access;
60
61 template<class S>
62 void serialize(S &s, const unsigned /*version*/) {
63 debugSerializationBegin("SgAsmNEFileHeader");
64 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SgAsmGenericHeader);
65 s & BOOST_SERIALIZATION_NVP(p_e_linker_major);
66 s & BOOST_SERIALIZATION_NVP(p_e_linker_minor);
67 s & BOOST_SERIALIZATION_NVP(p_e_checksum);
68 s & BOOST_SERIALIZATION_NVP(p_e_flags1);
69 s & BOOST_SERIALIZATION_NVP(p_e_autodata_sn);
70 s & BOOST_SERIALIZATION_NVP(p_e_bss_size);
71 s & BOOST_SERIALIZATION_NVP(p_e_stack_size);
72 s & BOOST_SERIALIZATION_NVP(p_e_csip);
73 s & BOOST_SERIALIZATION_NVP(p_e_sssp);
74 s & BOOST_SERIALIZATION_NVP(p_e_nsections);
75 s & BOOST_SERIALIZATION_NVP(p_e_nmodrefs);
76 s & BOOST_SERIALIZATION_NVP(p_e_nnonresnames);
77 s & BOOST_SERIALIZATION_NVP(p_e_nmovable_entries);
78 s & BOOST_SERIALIZATION_NVP(p_e_sector_align);
79 s & BOOST_SERIALIZATION_NVP(p_e_nresources);
80 s & BOOST_SERIALIZATION_NVP(p_e_exetype);
81 s & BOOST_SERIALIZATION_NVP(p_e_flags2);
82 s & BOOST_SERIALIZATION_NVP(p_e_res1);
83 s & BOOST_SERIALIZATION_NVP(p_e_winvers);
84 s & BOOST_SERIALIZATION_NVP(p_e_entrytab_rfo);
85 s & BOOST_SERIALIZATION_NVP(p_e_entrytab_size);
86 s & BOOST_SERIALIZATION_NVP(p_e_sectab_rfo);
87 s & BOOST_SERIALIZATION_NVP(p_e_rsrctab_rfo);
88 s & BOOST_SERIALIZATION_NVP(p_e_resnametab_rfo);
89 s & BOOST_SERIALIZATION_NVP(p_e_modreftab_rfo);
90 s & BOOST_SERIALIZATION_NVP(p_e_importnametab_rfo);
91 s & BOOST_SERIALIZATION_NVP(p_e_nonresnametab_offset);
92 s & BOOST_SERIALIZATION_NVP(p_e_fastload_sector);
93 s & BOOST_SERIALIZATION_NVP(p_e_fastload_nsectors);
94 s & BOOST_SERIALIZATION_NVP(p_dos2Header);
95 s & BOOST_SERIALIZATION_NVP(p_sectionTable);
96 s & BOOST_SERIALIZATION_NVP(p_residentNameTable);
97 s & BOOST_SERIALIZATION_NVP(p_nonresidentNameTable);
98 s & BOOST_SERIALIZATION_NVP(p_moduleTable);
99 s & BOOST_SERIALIZATION_NVP(p_entryTable);
100 debugSerializationEnd("SgAsmNEFileHeader");
101 }
102#endif // ROSE_HAVE_BOOST_SERIALIZATION_LIB
104 // Local types
106public:
107#ifdef _MSC_VER
108# pragma pack (1)
109#endif
110 /* File format of an NE File Header. All fields are little endian.
111 *
112 * NOTES
113 *
114 * e_sssp: The value specified in SS is an index (1-origin) into the segment table. If SS addresses the automatic data segment
115 * and SP is zero then SP is set to the address obtained by adding the size of the automatic data segment to the size
116 * of the stack. */
117 struct NEFileHeader_disk {
118 unsigned char e_magic[2]; /* 0x00 magic number "NE" */
119 unsigned char e_linker_major; /* 0x02 linker major version number */
120 unsigned char e_linker_minor; /* 0x03 linker minor version number */
121 uint16_t e_entrytab_rfo; /* 0x04 entry table offset relative to start of header */
122 uint16_t e_entrytab_size; /* 0x06 size of entry table in bytes */
123 uint32_t e_checksum; /* 0x08 32-bit CRC of entire file (this word is taken a zero during the calculation) */
124 uint16_t e_flags1; /* 0x0c file-level bit flags (see HeaderFlags1) */
125 uint16_t e_autodata_sn; /* 0x0e auto data section number if (flags & 0x3)==0; else zero */
126 uint16_t e_bss_size; /* 0x10 num bytes added to data segment for BSS */
127 uint16_t e_stack_size; /* 0x12 num bytes added to data segment for stack (zero of SS!=DS registers) */
128 uint32_t e_csip; /* 0x14 section number:offset of CS:IP */
129 uint32_t e_sssp; /* 0x18 section number:offset of SS:SP (see note 1 above) */
130 uint16_t e_nsections; /* 0x1c number of entries in the section table */
131 uint16_t e_nmodrefs; /* 0x1e number of entries in the module reference table */
132 uint16_t e_nnonresnames; /* 0x20 number of entries in the non-resident name table */
133 uint16_t e_sectab_rfo; /* 0x22 offset of section table relative to start of header */
134 uint16_t e_rsrctab_rfo; /* 0x24 offset of resource table relative to start of header */
135 uint16_t e_resnametab_rfo; /* 0x26 offset of resident name table relative to start of header */
136 uint16_t e_modreftab_rfo; /* 0x28 offset of module reference table relative to start of header */
137 uint16_t e_importnametab_rfo; /* 0x2a offset of imported names table relative to start of header */
138 uint32_t e_nonresnametab_offset; /* 0x2c file offset of non-resident name table */
139 uint16_t e_nmovable_entries; /* 0x30 number of movable entries in Entry Table */
140 uint16_t e_sector_align; /* 0x32 sector alignment shift count (log2 of segment sector size) */
141 uint16_t e_nresources; /* 0x34 number of resource entries */
142 unsigned char e_exetype; /* 0x36 executable type (2==windows) */
143 unsigned char e_flags2; /* 0x37 additional flags (see HeaderFlags2) */
144 uint16_t e_fastload_sector; /* 0x38 sector offset to fast-load area (only for Windows) */
145 uint16_t e_fastload_nsectors; /* 0x3a size of fast-load area in sectors (only for Windows) */
146 uint16_t e_res1; /* 0x3c reserved */
147 uint16_t e_winvers; /* 0x3e expected version number for Windows (only for Windows) */
148 } /* 0x40 */
149// DQ (3/7/2013): Adding support to restrict visability to SWIG.
150#ifndef SWIG
151#ifndef _MSC_VER
152 __attribute__((packed))
153#endif
154#endif
155 ;
156#ifdef _MSC_VER
157# pragma pack ()
158#endif
159
160 /* Bit flags for the NE header 'e_flags' member.
161 *
162 * If HF_LIBRARY (bit 15) is set then the CS:IP registers point to an initialization procedure called with the value in the AX
163 * register equal to the module handle. The initialization procedure must execute a far return to the caller. The resulting
164 * value in AX is a status indicator (non-zero for success, zero for failure). */
165 enum HeaderFlags1 {
166 HF1_RESERVED = 0x57f4, /* Reserved bits */
167 HF1_NO_DATA = 0x0000, /* (flags&0x03==0) => an exe not containing a data segment */
168 HF1_SINGLE_DATA = 0x0001, /* Executable contains one data segment; set if file is a DLL */
169 HF1_MULTIPLE_DATA = 0x0002, /* Exe with multiple data segments; set if a windows application */
170 HF1_LOADER_SEGMENT = 0x0800, /* First segment contains code that loads the application */
171 HF1_FATAL_ERRORS = 0x2000, /* Errors detected at link time; module will not load */
172 HF1_LIBRARY = 0x8000 /* Module is a library */
173 };
174
175 /* Bit flags for the NE header 'e_flags2' member. */
176 enum HeaderFlags2 {
177 HF2_RESERVED = 0xf1, /* Reserved bits */
178 HF2_PROTECTED_MODE = 0x02, /* Windows 2.x application that runs in 3.x protected mode */
179 HF2_PFONTS = 0x04, /* Windows 2.x application that supports proportional fonts */
180 HF2_FASTLOAD = 0x08 /* Executable contains a fast-load area */
181 };
182
184 // Properties
186public:
187public:
188 unsigned const& get_e_linker_major() const;
189 void set_e_linker_major(unsigned const&);
190
191public:
192 unsigned const& get_e_linker_minor() const;
193 void set_e_linker_minor(unsigned const&);
194
195public:
196 unsigned const& get_e_checksum() const;
197 void set_e_checksum(unsigned const&);
198
199public:
200 unsigned const& get_e_flags1() const;
201 void set_e_flags1(unsigned const&);
202
203public:
204 unsigned const& get_e_autodata_sn() const;
205 void set_e_autodata_sn(unsigned const&);
206
207public:
208 unsigned const& get_e_bss_size() const;
209 void set_e_bss_size(unsigned const&);
210
211public:
212 unsigned const& get_e_stack_size() const;
213 void set_e_stack_size(unsigned const&);
214
215public:
216 unsigned const& get_e_csip() const;
217 void set_e_csip(unsigned const&);
218
219public:
220 unsigned const& get_e_sssp() const;
221 void set_e_sssp(unsigned const&);
222
223public:
224 unsigned const& get_e_nsections() const;
225 void set_e_nsections(unsigned const&);
226
227public:
228 unsigned const& get_e_nmodrefs() const;
229 void set_e_nmodrefs(unsigned const&);
230
231public:
232 unsigned const& get_e_nnonresnames() const;
233 void set_e_nnonresnames(unsigned const&);
234
235public:
236 unsigned const& get_e_nmovable_entries() const;
237 void set_e_nmovable_entries(unsigned const&);
238
239public:
240 unsigned const& get_e_sector_align() const;
241 void set_e_sector_align(unsigned const&);
242
243public:
244 unsigned const& get_e_nresources() const;
245 void set_e_nresources(unsigned const&);
246
247public:
248 unsigned const& get_e_exetype() const;
249 void set_e_exetype(unsigned const&);
250
251public:
252 unsigned const& get_e_flags2() const;
253 void set_e_flags2(unsigned const&);
254
255public:
256 unsigned const& get_e_res1() const;
257 void set_e_res1(unsigned const&);
258
259public:
260 unsigned const& get_e_winvers() const;
261 void set_e_winvers(unsigned const&);
262
263public:
264 rose_addr_t const& get_e_entrytab_rfo() const;
265 void set_e_entrytab_rfo(rose_addr_t const&);
266
267public:
268 rose_addr_t const& get_e_entrytab_size() const;
269 void set_e_entrytab_size(rose_addr_t const&);
270
271public:
272 rose_addr_t const& get_e_sectab_rfo() const;
273 void set_e_sectab_rfo(rose_addr_t const&);
274
275public:
276 rose_addr_t const& get_e_rsrctab_rfo() const;
277 void set_e_rsrctab_rfo(rose_addr_t const&);
278
279public:
280 rose_addr_t const& get_e_resnametab_rfo() const;
281 void set_e_resnametab_rfo(rose_addr_t const&);
282
283public:
284 rose_addr_t const& get_e_modreftab_rfo() const;
285 void set_e_modreftab_rfo(rose_addr_t const&);
286
287public:
288 rose_addr_t const& get_e_importnametab_rfo() const;
289 void set_e_importnametab_rfo(rose_addr_t const&);
290
291public:
292 rose_addr_t const& get_e_nonresnametab_offset() const;
293 void set_e_nonresnametab_offset(rose_addr_t const&);
294
295public:
296 rose_addr_t const& get_e_fastload_sector() const;
297 void set_e_fastload_sector(rose_addr_t const&);
298
299public:
300 rose_addr_t const& get_e_fastload_nsectors() const;
301 void set_e_fastload_nsectors(rose_addr_t const&);
302
303public:
304 SgAsmDOSExtendedHeader* const& get_dos2Header() const;
305 void set_dos2Header(SgAsmDOSExtendedHeader* const&);
306
307public:
308 SgAsmNESectionTable* const& get_sectionTable() const;
309 void set_sectionTable(SgAsmNESectionTable* const&);
310
311public:
312 SgAsmNENameTable* const& get_residentNameTable() const;
313 void set_residentNameTable(SgAsmNENameTable* const&);
314
315public:
316 SgAsmNENameTable* const& get_nonresidentNameTable() const;
317 void set_nonresidentNameTable(SgAsmNENameTable* const&);
318
319public:
320 SgAsmNEModuleTable* const& get_moduleTable() const;
321 void set_moduleTable(SgAsmNEModuleTable* const&);
322
323public:
324 SgAsmNEEntryTable* const& get_entryTable() const;
325 void set_entryTable(SgAsmNEEntryTable* const&);
327 // Functions
329public:
330 SgAsmNEFileHeader(SgAsmGenericFile *f, rose_addr_t offset);
331
332 static bool isNe (SgAsmGenericFile*);
334 virtual void unparse(std::ostream&) const override;
335 virtual const char *formatName() const override;
336 virtual void dump(FILE*, const char *prefix, ssize_t idx) const override;
337
338private:
339 void *encode(SgAsmNEFileHeader::NEFileHeader_disk*) const;
340
342 // Deprecated 2023-11
344public:
345 SgAsmDOSExtendedHeader* get_dos2_header() const ROSE_DEPRECATED("use get_dos2Header");
346 void set_dos2_header(SgAsmDOSExtendedHeader*) ROSE_DEPRECATED("use set_dos2Header");
347 SgAsmNESectionTable* get_section_table() const ROSE_DEPRECATED("use get_sectionTable");
348 void set_section_table(SgAsmNESectionTable*) ROSE_DEPRECATED("use set_sectionTable");
349 SgAsmNENameTable* get_resname_table() const ROSE_DEPRECATED("use get_residentNameTable");
350 void set_resname_table(SgAsmNENameTable*) ROSE_DEPRECATED("use set_residentNameTable");
351 SgAsmNENameTable* get_nonresname_table() const ROSE_DEPRECATED("use get_nonresidentNameTable");
352 void set_nonresname_table(SgAsmNENameTable*) ROSE_DEPRECATED("use set_nonresidentNameTable");
353 SgAsmNEModuleTable* get_module_table() const ROSE_DEPRECATED("use get_moduleTable");
354 void set_module_table(SgAsmNEModuleTable*) ROSE_DEPRECATED("use set_moduleTable");
355 SgAsmNEEntryTable* get_entry_table() const ROSE_DEPRECATED("use get_entryTable");
356 void set_entry_table(SgAsmNEEntryTable*) ROSE_DEPRECATED("use set_entryTable");
357 static bool is_NE (SgAsmGenericFile*) ROSE_DEPRECATED("use isNe");
358 virtual const char *format_name() const override ROSE_DEPRECATED("use formatName");
359public:
361 virtual ~SgAsmNEFileHeader();
362
363public:
366
367protected:
374 void initializeProperties();
375
376
377// End of memberFunctionString
378// Start of memberFunctionString
379/* #line 1 "/workspace/src/ROSETTA/Grammar/Common.code" */
380
381// *** COMMON CODE SECTION BEGINS HERE ***
382
383 public:
384
385 // DQ (3/25/3006): I put this back in because it had the logic for where the copy function required
386 // and not required which is required to match the other aspects of the copy mechanism code generation.
387 // Specifically it is a problem to declare the copy function everywhere because it is not implemented
388 // for the SgSymbol IR nodes. I'm not clear why it is not implemented for these IR nodes.
389 /* \brief Copies AST (whole subtree, depending on the SgCopyHelp class */
390 // virtual SgNode* copy ( const SgCopyHelp & help) const;
391
393 virtual std::string class_name() const override;
394
396 virtual VariantT variantT() const override; // MS: new variant used in tree traversal
397
399 // King84 (2010.08.16): Moved this to an enum to save space, since it's only used at compiler-time anyway.
400 // static const VariantT static_variant = V_SgAsmNEFileHeader;
401 enum { static_variant = V_SgAsmNEFileHeader };
402
403 /* the generated cast function */
405 ROSE_DLL_API friend SgAsmNEFileHeader* isSgAsmNEFileHeader( SgNode * s );
406
408 ROSE_DLL_API friend const SgAsmNEFileHeader* isSgAsmNEFileHeader( const SgNode * s );
409
410 // ******************************************
411 // * Memory Pool / New / Delete
412 // ******************************************
413
414 public:
416 static const unsigned pool_size; //
418 static std::vector<unsigned char *> pools; //
420 static SgAsmNEFileHeader * next_node; //
421
423 static unsigned long initializeStorageClassArray(SgAsmNEFileHeaderStorageClass *); //
424
426 static void clearMemoryPool(); //
427 static void deleteMemoryPool(); //
428
430 static void extendMemoryPoolForFileIO(); //
431
433 static SgAsmNEFileHeader * getPointerFromGlobalIndex(unsigned long); //
435 static SgAsmNEFileHeader * getPointerFromGlobalIndex(AstSpecificDataManagingClass *, unsigned long); //
436
438 static unsigned long getNumberOfValidNodesAndSetGlobalIndexInFreepointer(unsigned long); //
440 static void resetValidFreepointers(); //
442 static unsigned long getNumberOfLastValidPointer(); //
443
444
445#if defined(INLINE_FUNCTIONS)
447 inline void *operator new (size_t size);
448#else
450 void *operator new (size_t size);
451#endif
453 void operator delete (void* pointer, size_t size);
454
455 // DQ (4/5/2007): This is not the correct operator that we want, but appears to be required to compile ROSE with ROSE.
456 void operator delete (void* pointer)
457 {
458 // This is the generated delete operator...
459 SgAsmNEFileHeader::operator delete (pointer,sizeof(SgAsmNEFileHeader));
460 }
461
463 static size_t numberOfNodes();
464
466 static size_t memoryUsage();
467
468 // End of scope which started in IR nodes specific code
469 /* */
470
471 /* name Internal Functions
472 \brief Internal functions ... incomplete-documentation
473
474 These functions have been made public as part of the design, but they are suggested for internal use
475 or by particularly knowledgeable users for specialized tools or applications.
476
477 \internal We could not make these private because they are required by user for special purposes. And
478 it would be unwieldy to have many of the internal classes in ROSE be explicitly defined as friends.
479
480 */
481
482 // MS: 02/12/02 container of pointers to AST successor nodes used in the traversal
483 // overridden in every class by *generated* implementation
485 virtual std::vector<SgNode*> get_traversalSuccessorContainer() override;
486 // MS: 06/28/02 container of names of variables or container indices
487 // used used in the traversal to access AST successor nodes
488 // overridden in every class by *generated* implementation
491 virtual std::vector<std::string> get_traversalSuccessorNamesContainer() override;
492
493 // GB (09/25/2007): Functions for index-based access to traversal successors; these are hopefully a lot faster
494 // than all the vector copies. The implementation for these functions is generated for each class.
496 virtual size_t get_numberOfTraversalSuccessors() override;
498 virtual SgNode *get_traversalSuccessorByIndex(size_t idx) override;
500 virtual size_t get_childIndex(SgNode *child) override;
501
502#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
503 // MS: 08/16/2002 method for generating RTI information
505 virtual RTIReturnType roseRTI() override;
506#endif
507 /* */
508
509
510
511 /* name Deprecated Functions
512 \brief Deprecated functions ... incomplete-documentation
513
514 These functions have been deprecated from use.
515 */
516 /* */
517
519 virtual const char* sage_class_name() const override ROSE_DEPRECATED_FUNCTION;
520
521 // JJW (10/16/2008): Changed to a single function in Node.code, and put
522 // getVariant() in #if 0 block to prevent confusing Doxygen
523#if 0
525 virtual int variant() const ROSE_DEPRECATED_FUNCTION;
527 // virtual int getVariant() const ROSE_DEPRECATED_FUNCTION;
528#endif
529 /* */
530
531
532
533
534 public:
535 /* name Traversal Support Functions
536 \brief Traversal support functions ... incomplete-documentation
537
538 These functions have been made public as part of the design, but they are suggested for internal use
539 or by particularly knowledgable users for specialized tools or applications.
540 */
541 /* */
542
543 // DQ (11/26/2005): Support for visitor pattern mechanims
544 // (inferior to ROSE traversal mechanism, experimental).
548
549 /* DXN (08/09/2010): support for the classic visitor pattern done in GoF */
551 virtual void accept (ROSE_VisitorPattern & visitor) override;
552
553 // DQ (12/26/2005): Support for traversal based on the memory pool
556 static void traverseMemoryPoolNodes(ROSE_VisitTraversal & visit);
557
561
562 // DQ (2/9/2006): Added to support traversal over single representative of each IR node
563 // This traversal helps support internal tools that call static member functions.
564 // note: this function operates on the memory pools.
567 static void visitRepresentativeNode (ROSE_VisitTraversal & visit);
568 /* */
569
570 public:
571 /* NodeId support functions */
573 static SgNode* getNodeByNodeId(VariantT variantT, size_t poolIdx, size_t itemIdx);
576 static SgAsmNEFileHeader* getNodeByNodeIdInternal(size_t poolIdx, size_t itemIdx);
579 static std::string getNodeIdString(SgAsmNEFileHeader* sgnode);
580 static std::string getNodeIdStringInternal(SgAsmNEFileHeader* sgnode);
581
582 public:
583 /* name Memory Allocation Functions
584 \brief Memory allocations functions ... incomplete-documentation
585
586 These functions have been made public as part of the design, but they are suggested for internal use
587 or by particularly knowledgable users for specialized tools or applications.
588 */
589 /* */
590
601 virtual bool isInMemoryPool() override;
602
613 virtual void checkDataMemberPointersIfInMemoryPool() override;
614
615 // DQ (4/30/2006): Modified to be a const function.
630 virtual std::vector<std::pair<SgNode*,std::string> > returnDataMemberPointers() const override;
631
642
654 virtual long getChildIndex( SgNode* childNode ) const override;
655
656 // DQ (9/2/2015): Since this function is generated by ROSETTA, we can't define the
657 // comment here (changed to be a C style comment and not be a doxygen comment).
658 /* \brief Constructor for use by AST File I/O Mechanism
659
660 This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory
661 which obtained via fast binary file I/O from disk.
662 */
663 // SgAsmNEFileHeader( SgAsmNEFileHeaderStorageClass& source );
664
665
666
667
668
669 // JH (10/24/2005): methods added to support the ast file IO
670 private:
671
672 /* name AST Memory Allocation Support Functions
673 \brief Memory allocations support....
674
675 These functions handle the low leve support of the memory allocation scheme which permits IR nodes to be allocated
676 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
677 and support the AST File I/O Mechanism.
678 */
679 /* */
680
681 /* JH (10/24/2005): Two typedefs. The TestType notes the type every pointer is cast to before
682 we compare them. Since I had several problems with this, I decided to make a typdef to ensure
683 that I use the same type everywhere, if any changes are made. THe second one declares the type
684 (actually unsigned long) where teh pointer address gets converted to. On 64 bit platforms this
685 might got changed, but unfortunatly, the return types are still unsigned longs. There exists
686 a correspinding one in the AST_FILE_IO class!
687 */
688 // DQ (9/2/2015): This typedef is no longer used, we can't define the
689 // comment here (changed to be a C style comment and not be a doxygen comment).
690 /* \brief Typedef used for low level memory access.
691 */
692 // typedef unsigned char* TestType;
693
694 // DQ (9/2/2015): This typedef is no longer used, we can't define the
695 // comment here (changed to be a C style comment and not be a doxygen comment).
696 /* \brief Typedef used to hold memory addresses as values.
697 */
698 // typedef unsigned long AddressType;
699
700
701
702 // necessary, to have direct access to the p_freepointer and the private methods !
704 friend class AST_FILE_IO;
705
707 friend class SgAsmNEFileHeaderStorageClass;
708
710 friend class AstSpecificDataManagingClass;
711
713 friend class AstSpecificDataManagingClassStorageClass;
714 public:
716 SgAsmNEFileHeader( const SgAsmNEFileHeaderStorageClass& source );
717
718 // private: // JJW hack
719 /*
720 name AST Memory Allocation Support Variables
721 Memory allocations support variables
722
723 These variables handle the low level support of the memory allocation scheme which permits IR nodes to be allocated
724 in large contiguous blocks to reduce memory fragmentation, improve performance, support specialized access (AST traversals),
725 and support the AST File I/O Mechanism.
726 */
727 /* */
728
729 public:
730
731 // DQ (11/21/2009): Added function to add new Regular Expression attributes and return pointer
732 // to current node (so that it will work cleanly with build functions to specify patterns).
733 // virtual SgNode* addRegExpAttribute();
740
741#ifndef _MSC_VER
742// Rasmussen (04/17/2019): Support for ATerms has been deprecated as it is no longer needed
743// and likely never fully implemented nor tested. Files remain in the src tree but are no
744// longer built.
745#define BUILD_ATERM_SUPPORT 0
746 #if BUILD_ATERM_SUPPORT
747 #ifdef ROSE_USE_ROSE_ATERM_SUPPORT
748 // DQ (10/4/2014): Adding ATerm support to ROSE.
758 // Rasmussen (1/7/2019): Added override to kill warning messages of overridden virtual function
759 virtual ATerm generate_ATerm() override;
760
762 virtual void generate_ATerm_Annotation(ATerm & term) override;
763 #endif
764 #endif // BUILD_ATERM_SUPPORT
765#endif
766 // These can't be virtual functions since we don't yet know what IR node to build (until we have read the aterm).
767 // virtual generate_AST(ATerm & term);
768 // virtual void read_ATerm_Annotation(ATerm & term);
769
770// *** COMMON CODE SECTION ENDS HERE ***
771
772
773// End of memberFunctionString
774// Start of memberFunctionString
775/* #line 706 "/workspace/src/ROSETTA/Grammar/Node.code" */
776
777 // the generated cast function
778 // friend ROSE_DLL_API SgAsmNEFileHeader* isSgAsmNEFileHeader ( SgNode* s );
779
780 typedef SgAsmGenericHeader base_node_type;
781
782
783// End of memberFunctionString
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820 protected:
821// Start of memberFunctionString
822unsigned p_e_linker_major;
823
824// End of memberFunctionString
825// Start of memberFunctionString
826unsigned p_e_linker_minor;
827
828// End of memberFunctionString
829// Start of memberFunctionString
830unsigned p_e_checksum;
831
832// End of memberFunctionString
833// Start of memberFunctionString
834unsigned p_e_flags1;
835
836// End of memberFunctionString
837// Start of memberFunctionString
838unsigned p_e_autodata_sn;
839
840// End of memberFunctionString
841// Start of memberFunctionString
842unsigned p_e_bss_size;
843
844// End of memberFunctionString
845// Start of memberFunctionString
846unsigned p_e_stack_size;
847
848// End of memberFunctionString
849// Start of memberFunctionString
850unsigned p_e_csip;
851
852// End of memberFunctionString
853// Start of memberFunctionString
854unsigned p_e_sssp;
855
856// End of memberFunctionString
857// Start of memberFunctionString
858unsigned p_e_nsections;
859
860// End of memberFunctionString
861// Start of memberFunctionString
862unsigned p_e_nmodrefs;
863
864// End of memberFunctionString
865// Start of memberFunctionString
866unsigned p_e_nnonresnames;
867
868// End of memberFunctionString
869// Start of memberFunctionString
870unsigned p_e_nmovable_entries;
871
872// End of memberFunctionString
873// Start of memberFunctionString
874unsigned p_e_sector_align;
875
876// End of memberFunctionString
877// Start of memberFunctionString
878unsigned p_e_nresources;
879
880// End of memberFunctionString
881// Start of memberFunctionString
882unsigned p_e_exetype;
883
884// End of memberFunctionString
885// Start of memberFunctionString
886unsigned p_e_flags2;
887
888// End of memberFunctionString
889// Start of memberFunctionString
890unsigned p_e_res1;
891
892// End of memberFunctionString
893// Start of memberFunctionString
894unsigned p_e_winvers;
895
896// End of memberFunctionString
897// Start of memberFunctionString
898rose_addr_t p_e_entrytab_rfo;
899
900// End of memberFunctionString
901// Start of memberFunctionString
902rose_addr_t p_e_entrytab_size;
903
904// End of memberFunctionString
905// Start of memberFunctionString
906rose_addr_t p_e_sectab_rfo;
907
908// End of memberFunctionString
909// Start of memberFunctionString
910rose_addr_t p_e_rsrctab_rfo;
911
912// End of memberFunctionString
913// Start of memberFunctionString
914rose_addr_t p_e_resnametab_rfo;
915
916// End of memberFunctionString
917// Start of memberFunctionString
918rose_addr_t p_e_modreftab_rfo;
919
920// End of memberFunctionString
921// Start of memberFunctionString
922rose_addr_t p_e_importnametab_rfo;
923
924// End of memberFunctionString
925// Start of memberFunctionString
926rose_addr_t p_e_nonresnametab_offset;
927
928// End of memberFunctionString
929// Start of memberFunctionString
930rose_addr_t p_e_fastload_sector;
931
932// End of memberFunctionString
933// Start of memberFunctionString
934rose_addr_t p_e_fastload_nsectors;
935
936// End of memberFunctionString
937// Start of memberFunctionString
938SgAsmDOSExtendedHeader* p_dos2Header;
939
940// End of memberFunctionString
941// Start of memberFunctionString
942SgAsmNESectionTable* p_sectionTable;
943
944// End of memberFunctionString
945// Start of memberFunctionString
946SgAsmNENameTable* p_residentNameTable;
947
948// End of memberFunctionString
949// Start of memberFunctionString
950SgAsmNENameTable* p_nonresidentNameTable;
951
952// End of memberFunctionString
953// Start of memberFunctionString
954SgAsmNEModuleTable* p_moduleTable;
955
956// End of memberFunctionString
957// Start of memberFunctionString
958SgAsmNEEntryTable* p_entryTable;
959
960// End of memberFunctionString
961
963 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_linker_major>;
964 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_linker_minor>;
965 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_checksum>;
966 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_flags1>;
967 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_autodata_sn>;
968 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_bss_size>;
969 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_stack_size>;
970 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_csip>;
971 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_sssp>;
972 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_nsections>;
973 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_nmodrefs>;
974 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_nnonresnames>;
975 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_nmovable_entries>;
976 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_sector_align>;
977 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_nresources>;
978 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_exetype>;
979 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_flags2>;
980 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_res1>;
981 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, unsigned,&SgAsmNEFileHeader::p_e_winvers>;
982 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_entrytab_rfo>;
983 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_entrytab_size>;
984 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_sectab_rfo>;
985 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_rsrctab_rfo>;
986 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_resnametab_rfo>;
987 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_modreftab_rfo>;
988 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_importnametab_rfo>;
989 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_nonresnametab_offset>;
990 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_fastload_sector>;
991 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, rose_addr_t,&SgAsmNEFileHeader::p_e_fastload_nsectors>;
992 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmDOSExtendedHeader*,&SgAsmNEFileHeader::p_dos2Header>;
993 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmNESectionTable*,&SgAsmNEFileHeader::p_sectionTable>;
994 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmNENameTable*,&SgAsmNEFileHeader::p_residentNameTable>;
995 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmNENameTable*,&SgAsmNEFileHeader::p_nonresidentNameTable>;
996 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmNEModuleTable*,&SgAsmNEFileHeader::p_moduleTable>;
997 friend struct Rose::Traits::generated::describe_field_t<SgAsmNEFileHeader, SgAsmNEEntryTable*,&SgAsmNEFileHeader::p_entryTable>;
998
999/* #line 21 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1000
1001
1002 };
1003#endif
1004
1005// postdeclarations for SgAsmNEFileHeader
1006
1007/* #line 1008 "../../../src/frontend/SageIII//SgAsmNEFileHeader.h" */
1008
1009/* #line 27 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro after subst for $POSTDECLARATIONS" */
1010
1011/* #line 28 "/workspace/src/ROSETTA/Grammar/grammarClassDeclarationMacros.macro" */
1012
1013
1014/* #line 1015 "../../../src/frontend/SageIII//SgAsmNEFileHeader.h" */
1015
1016#endif // ROSE_SgAsmNEFileHeader_H
1017
Class holding static data and functions supporting File I/O.
Definition AST_FILE_IO.h:19
Attribute containing a regex expression as a string.
Represents the file header for DOS executables.
Base class for binary files.
Base class for container file headers.
virtual const char * formatName() const
Returns the name of the file format.
virtual void dump(FILE *, const char *prefix, ssize_t idx) const override
Print some debugging info.
virtual void unparse(std::ostream &) const override
Unparse headers and all they point to.
virtual SgAsmGenericSection * parse()
Parse contents of the section.
Supporting class from copy mechanism within ROSE.
Definition sageCopy.h:26
This class represents the base class for all IR nodes within Sage III.
virtual size_t get_numberOfTraversalSuccessors()
return number of children in the traversal successor list
virtual RTIReturnType roseRTI()
return C++ Runtime-Time-Information
virtual std::vector< std::string > get_traversalSuccessorNamesContainer()
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 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 size_t get_childIndex(SgNode *child)
index-based access to traversal successors by child node
virtual void debugSerializationBegin(const char *className)
Called by generated serializers.
virtual std::vector< SgNode * > get_traversalSuccessorContainer()
container of pointers to AST successor nodes used in the traversal overridden in every class by gener...
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
virtual SgNode * get_traversalSuccessorByIndex(size_t idx)
index-based access to traversal successors by index number
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.
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.
const char * HeaderFlags2(int64_t)
Convert SgAsmNEFileHeader::HeaderFlags2 enum constant to a string.
const char * HeaderFlags1(int64_t)
Convert SgAsmNEFileHeader::HeaderFlags1 enum constant to a string.