arm.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 by the Free Pascal development team.
  5. Processor dependent implementation for the system unit for
  6. ARM
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$asmmode gas}
  14. {****************************************************************************
  15. stack frame related stuff
  16. ****************************************************************************}
  17. {$define FPC_SYSTEM_HAS_GET_FRAME}
  18. function get_frame:pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  19. asm
  20. mov r0,fp
  21. end ['R0'];
  22. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  23. function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  24. asm
  25. (*!!!!!!
  26. movl framebp,%eax
  27. orl %eax,%eax
  28. jz .Lg_a_null
  29. movl 4(%eax),%eax
  30. .Lg_a_null:
  31. *)
  32. end ['R0'];
  33. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  34. function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  35. asm
  36. (*!!!!!
  37. movl framebp,%eax
  38. orl %eax,%eax
  39. jz .Lgnf_null
  40. movl (%eax),%eax
  41. .Lgnf_null:
  42. *)
  43. end ['R0'];
  44. {$define FPC_SYSTEM_HAS_SPTR}
  45. Function Sptr : pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  46. asm
  47. mov r0,sp
  48. end ['R0'];
  49. {
  50. {$define FPC_SYSTEM_HAS_FILLCHAR}
  51. Procedure FillChar(var x;count:longint;value:byte);assembler;
  52. * void *memset (dstpp, c, len) */
  53. asm
  54. mov a4, a1
  55. cmp a2, $8 // at least 8 bytes to do?
  56. blt .Fillchar2
  57. orr a3, a3, a3, lsl $8
  58. orr a3, a3, a3, lsl $16
  59. .Fillchar0:
  60. tst a4, $3 // aligned yet?
  61. strneb a3, [a4], $1
  62. subne a2, a2, $1
  63. bne .Fillchar0
  64. mov ip, a3
  65. .Fillchar1:
  66. cmp a2, $8 // 8 bytes still to do?
  67. blt .Fillchar2
  68. stmia a4!, {a3, ip}
  69. sub a2, a2, $8
  70. cmp a2, $8 // 8 bytes still to do?
  71. blt .Fillchar2
  72. stmia a4!, {a3, ip}
  73. sub a2, a2, $8
  74. cmp a2, $8 // 8 bytes still to do?
  75. blt .Fillchar2
  76. stmia a4!, {a3, ip}
  77. sub a2, a2, $8
  78. cmp a2, $8 // 8 bytes still to do?
  79. stmgeia a4!, {a3, ip}
  80. subge a2, a2, $8
  81. bge .Fillchar1
  82. .Fillchar2:
  83. movs a2, a2 // anything left?
  84. RETINSTR(moveq,pc,lr) // nope
  85. rsb a2, a2, $7
  86. add pc, pc, a2, lsl $2
  87. mov r0, r0
  88. strb a3, [a4], $1
  89. strb a3, [a4], $1
  90. strb a3, [a4], $1
  91. strb a3, [a4], $1
  92. strb a3, [a4], $1
  93. strb a3, [a4], $1
  94. strb a3, [a4], $1
  95. RETINSTR(mov,pc,lr)
  96. end;
  97. }
  98. {
  99. $Log$
  100. Revision 1.3 2003-11-21 00:40:06 florian
  101. * some arm issues fixed
  102. Revision 1.2 2003/09/03 14:09:37 florian
  103. * arm fixes to the common rtl code
  104. * some generic math code fixed
  105. * ...
  106. Revision 1.1 2003/08/21 16:41:54 florian
  107. * empty dummy files
  108. + [long|set]jmp implemented
  109. }