arm.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. {****************************************************************************
  14. stack frame related stuff
  15. ****************************************************************************}
  16. {$define FPC_SYSTEM_HAS_GET_FRAME}
  17. function get_frame:pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  18. asm
  19. mov r0,fp
  20. end ['R0'];
  21. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  22. function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  23. asm
  24. (*!!!!!!
  25. movl framebp,%eax
  26. orl %eax,%eax
  27. jz .Lg_a_null
  28. movl 4(%eax),%eax
  29. .Lg_a_null:
  30. *)
  31. end ['R0'];
  32. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  33. function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  34. asm
  35. (*!!!!!
  36. movl framebp,%eax
  37. orl %eax,%eax
  38. jz .Lgnf_null
  39. movl (%eax),%eax
  40. .Lgnf_null:
  41. *)
  42. end ['R0'];
  43. {$define FPC_SYSTEM_HAS_SPTR}
  44. Function Sptr : Longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
  45. asm
  46. mov r0,sp
  47. end ['R0'];
  48. {
  49. {$define FPC_SYSTEM_HAS_FILLCHAR}
  50. Procedure FillChar(var x;count:longint;value:byte);assembler;
  51. * void *memset (dstpp, c, len) */
  52. asm
  53. mov a4, a1
  54. cmp a2, $8 // at least 8 bytes to do?
  55. blt .Fillchar2
  56. orr a3, a3, a3, lsl $8
  57. orr a3, a3, a3, lsl $16
  58. .Fillchar0:
  59. tst a4, $3 // aligned yet?
  60. strneb a3, [a4], $1
  61. subne a2, a2, $1
  62. bne .Fillchar0
  63. mov ip, a3
  64. .Fillchar1:
  65. cmp a2, $8 // 8 bytes still to do?
  66. blt .Fillchar2
  67. stmia a4!, {a3, ip}
  68. sub a2, a2, $8
  69. cmp a2, $8 // 8 bytes still to do?
  70. blt .Fillchar2
  71. stmia a4!, {a3, ip}
  72. sub a2, a2, $8
  73. cmp a2, $8 // 8 bytes still to do?
  74. blt .Fillchar2
  75. stmia a4!, {a3, ip}
  76. sub a2, a2, $8
  77. cmp a2, $8 // 8 bytes still to do?
  78. stmgeia a4!, {a3, ip}
  79. subge a2, a2, $8
  80. bge .Fillchar1
  81. .Fillchar2:
  82. movs a2, a2 // anything left?
  83. RETINSTR(moveq,pc,lr) // nope
  84. rsb a2, a2, $7
  85. add pc, pc, a2, lsl $2
  86. mov r0, r0
  87. strb a3, [a4], $1
  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. RETINSTR(mov,pc,lr)
  95. end;
  96. }
  97. {
  98. $Log$
  99. Revision 1.2 2003-09-03 14:09:37 florian
  100. * arm fixes to the common rtl code
  101. * some generic math code fixed
  102. * ...
  103. Revision 1.1 2003/08/21 16:41:54 florian
  104. * empty dummy files
  105. + [long|set]jmp implemented
  106. }