FoxBinaryCode.SymU 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. MODULE FoxBinaryCode;
  2. IMPORT Basic := FoxBasic, Sections := FoxSections, Streams, ObjectFile, BitSets;
  3. CONST
  4. Absolute* = ObjectFile.Absolute;
  5. Relative* = ObjectFile.Relative;
  6. Byte = 8;
  7. TYPE
  8. Code* = BitSets.BitSet;
  9. Unit* = ObjectFile.Unit;
  10. Bits* = ObjectFile.Bits;
  11. FixupPatterns* = ObjectFile.FixupPatterns;
  12. Alias* = OBJECT
  13. VAR
  14. nextAlias-: Alias;
  15. identifier-: ObjectFile.Identifier;
  16. offset-: LONGINT;
  17. PROCEDURE ^ & InitAlias*(identifier: ObjectFile.Identifier; offset: LONGINT);
  18. PROCEDURE ^ Dump*(w: Streams.Writer);
  19. END Alias;
  20. AliasList* = OBJECT
  21. VAR
  22. firstAlias-, lastAlias-: Alias;
  23. aliases-: LONGINT;
  24. PROCEDURE ^ & InitAliasList*;
  25. PROCEDURE ^ AddAlias*(alias: Alias);
  26. PROCEDURE ^ Dump*(w: Streams.Writer);
  27. END AliasList;
  28. Fixup* = OBJECT
  29. VAR
  30. nextFixup-: Fixup;
  31. mode-: INTEGER;
  32. displacement-: Unit;
  33. scale-: ObjectFile.Bits;
  34. patterns-: SIZE;
  35. pattern-: FixupPatterns;
  36. offset-: Unit;
  37. symbol-: ObjectFile.Identifier;
  38. symbolOffset-: LONGINT;
  39. resolved*: Sections.Section;
  40. PROCEDURE ^ & InitFixup*(mode: INTEGER; fixupOffset: Unit; symbol: ObjectFile.Identifier; symbolOffset: LONGINT; displacement: Unit; scale: LONGINT; fixupPattern: ObjectFile.FixupPatterns);
  41. PROCEDURE ^ SetFixupOffset*(offset: Unit);
  42. PROCEDURE ^ SetSymbol*(symbol: Sections.SectionName; fp: ObjectFile.Fingerprint; symbolOffset: LONGINT; displacement: Unit);
  43. PROCEDURE ^ Dump*(w: Streams.Writer);
  44. END Fixup;
  45. FixupList* = OBJECT
  46. VAR
  47. firstFixup-, lastFixup-: Fixup;
  48. fixups-: LONGINT;
  49. PROCEDURE ^ & InitFixupList*;
  50. PROCEDURE ^ AddFixup*(fixup: Fixup);
  51. PROCEDURE ^ Dump*(w: Streams.Writer);
  52. END FixupList;
  53. LabelList* = POINTER TO RECORD
  54. offset-: LONGINT;
  55. position-: Basic.Position;
  56. prev-: LabelList;
  57. END;
  58. Section* = OBJECT
  59. VAR
  60. os*: ObjectFile.Section;
  61. labels-: LabelList;
  62. fixupList-: FixupList;
  63. aliasList-: AliasList;
  64. finally-: Unit;
  65. comments-: Sections.CommentWriter;
  66. bigEndian-: BOOLEAN;
  67. pc-: Unit;
  68. PROCEDURE ^ GetPC(): Unit;
  69. PROCEDURE ^ & InitBinarySection*(type: SHORTINT; unit: Bits; CONST name: Basic.SegmentedName; dump: BOOLEAN; bigEndian: BOOLEAN);
  70. PROCEDURE ^ Reset*;
  71. PROCEDURE ^ AddLabel*(position: Basic.Position);
  72. PROCEDURE ^ SetPC*(pc: Unit);
  73. PROCEDURE ^ Align*(alignment: Unit);
  74. PROCEDURE ^ SetFinally*(atPC: Unit);
  75. PROCEDURE ^ SetAlignment*(fixed: BOOLEAN; alignat: LONGINT);
  76. PROCEDURE ^ CheckSize(size: LONGINT);
  77. PROCEDURE ^ CopyBits*(src: BitSets.BitSet; srcPos, len: Bits);
  78. PROCEDURE ^ PutBits*(d: HUGEINT; size: Bits);
  79. PROCEDURE ^ PutBitsAt*(at: Unit; d: HUGEINT; size: Bits);
  80. PROCEDURE ^ PutByte*(b: WORD);
  81. PROCEDURE ^ PutWord*(w: WORD);
  82. PROCEDURE ^ PutDWord*(d: WORD);
  83. PROCEDURE ^ PutQWord*(q: HUGEINT);
  84. PROCEDURE ^ PutReal*(f: REAL);
  85. PROCEDURE ^ PutLongreal*(f: LONGREAL);
  86. PROCEDURE ^ PutByteAt*(at: Unit; d: WORD);
  87. PROCEDURE ^ PutWordAt*(at: Unit; d: WORD);
  88. PROCEDURE ^ PutDWordAt*(at: Unit; d: WORD);
  89. PROCEDURE ^ PutQWordAt*(at: Unit; d: HUGEINT);
  90. PROCEDURE ^ PutBytes*(data: HUGEINT; bytes: SHORTINT);
  91. PROCEDURE ^ GetByte*(pc: Unit): CHAR;
  92. PROCEDURE ^ GetWord*(pc: Unit): WORD;
  93. PROCEDURE ^ GetDWord*(pc: Unit): WORD;
  94. PROCEDURE ^ GetQWord*(pc: Unit): HUGEINT;
  95. PROCEDURE ^ GetReal*(pc: Unit): REAL;
  96. PROCEDURE ^ GetLongreal*(pc: Unit): LONGREAL;
  97. PROCEDURE ^ GetBits*(pc: Unit; size: Bits): WORD;
  98. PROCEDURE ^ ApplyFixup*(fixup: Fixup): BOOLEAN;
  99. PROCEDURE ^ DumpCode*(w: Streams.Writer; from, to: Unit);
  100. PROCEDURE ^ Dump*(w: Streams.Writer);
  101. END Section;
  102. PROCEDURE ^ ConvertReal*(value: REAL): LONGINT;
  103. PROCEDURE ^ ConvertLongreal*(value: LONGREAL): HUGEINT;
  104. PROCEDURE ^ ConvertToReal*(x: LONGINT): REAL;
  105. PROCEDURE ^ ConvertToLongreal*(x: HUGEINT): LONGREAL;
  106. PROCEDURE ^ NewFixup*(mode: INTEGER; fixupOffset: LONGINT; symbol: ObjectFile.Identifier; symbolOffset, displacement: LONGINT; scale: LONGINT; fixupPattern: ObjectFile.FixupPatterns): Fixup;
  107. PROCEDURE ^ NewBinarySection*(type: SHORTINT; unit: LONGINT; CONST name: Basic.SegmentedName; dump: BOOLEAN; bigEndian: BOOLEAN): Section;
  108. BEGIN
  109. END FoxBinaryCode.