typinfo.inc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Jonas Maebe,
  5. member of the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { This unit provides the same Functionality as the TypInfo Unit }
  13. { of Delphi }
  14. { ---------------------------------------------------------------------
  15. This include contains cpu-specific Low-level calling of methods.
  16. ---------------------------------------------------------------------}
  17. {$ASMMODE ATT}
  18. Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt): Int64; assembler;
  19. { input: }
  20. { r3: s }
  21. { r4: address }
  22. { r5: index }
  23. { r6: ivalue }
  24. { output: }
  25. { r3-r4: result }
  26. asm
  27. { save current return address }
  28. mflr r30
  29. mtctr r4
  30. { always pass ivalue as second parameter, it doesn't matter if it }
  31. { isn't used }
  32. mr r4,r6
  33. bctrl
  34. { restore return address }
  35. mtlr r30
  36. end;
  37. Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IValue : Longint) : Integer;assembler;
  38. { input: }
  39. { r3: s }
  40. { r4: address }
  41. { r5: index }
  42. { r6: ivalue }
  43. { output: }
  44. { r3: result }
  45. asm
  46. { save current return address }
  47. mflr r30
  48. mtctr r4
  49. { always pass ivalue as second parameter, it doesn't matter if it }
  50. { isn't used }
  51. mr r4,r6
  52. bctrl
  53. { restore return address }
  54. mtlr r30
  55. end;
  56. Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint) : Extended;assembler;
  57. { input: }
  58. { r3: s }
  59. { r4: address }
  60. { r5: index }
  61. { r6: ivalue }
  62. { output: }
  63. { fr1: result }
  64. asm
  65. { save current return address }
  66. mflr r30
  67. mtctr r4
  68. { always pass ivalue as second parameter, it doesn't matter if it }
  69. { isn't used }
  70. mr r4,r6
  71. bctrl
  72. { restore return address }
  73. mtlr r30
  74. end;
  75. Function CallExtendedProc(s : Pointer;Address : Pointer;Value : Extended; INdex,IVAlue : Longint) : Integer;assembler;
  76. { input: }
  77. { r3: s }
  78. { r4: address }
  79. { fr3: value }
  80. { r7: index }
  81. { r8: ivalue }
  82. { output: }
  83. { r3: result }
  84. asm
  85. { save current return address }
  86. mflr r30
  87. cmpli r7,0
  88. mtctr r4
  89. beq LNoIndex
  90. fmr fr2,fr3
  91. LNoIndex:
  92. { always pass ivalue as second parameter, it doesn't matter if it }
  93. { isn't used }
  94. mr r4,r8
  95. bctrl
  96. { restore return address }
  97. mtlr r30
  98. end;
  99. Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint) : Boolean;assembler;
  100. { input: }
  101. { r3: s }
  102. { r4: address }
  103. { r5: index }
  104. { r6: ivalue }
  105. { output: }
  106. { r3: result }
  107. asm
  108. { save current return address }
  109. mflr r30
  110. mtctr r4
  111. { always pass ivalue as second parameter, it doesn't matter if it }
  112. { isn't used }
  113. mr r4,r6
  114. bctrl
  115. { restore return address }
  116. mtlr r30
  117. end;
  118. Function CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint)
  119. : Shortstring; assembler;
  120. { input: }
  121. { r3: address of shortstring result (temp) }
  122. { r4: s }
  123. { r5: address }
  124. { r6: index }
  125. { r7: ivalue }
  126. { output: }
  127. { r3: result }
  128. asm
  129. { save current return address }
  130. mflr r30
  131. mtctr r5
  132. { always pass ivalue as second parameter, it doesn't matter if it }
  133. { isn't used }
  134. mr r5,r7
  135. bctrl
  136. { restore return address }
  137. mtlr r30
  138. end;
  139. Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortString; INdex,IVAlue : Longint);assembler;
  140. { input: }
  141. { r3: s }
  142. { r4: address }
  143. { r5: value (address of shortstring) }
  144. { r6: index }
  145. { r7: ivalue }
  146. { output: }
  147. { none }
  148. asm
  149. { save current return address }
  150. mflr r30
  151. mtctr r4
  152. { always pass ivalue as second parameter, it doesn't matter if it }
  153. { isn't used }
  154. mr r4,r6
  155. bctrl
  156. { restore return address }
  157. mtlr r30
  158. end;
  159. {
  160. $Log$
  161. Revision 1.1 2001-10-28 14:08:37 jonas
  162. + initial implementation, still needs changes for self pointer register
  163. Revision 1.3 2001/10/20 17:25:22 peter
  164. }