m68k-m68040.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. diff -Nur glibc-2.38.orig/sysdeps/m68k/m680x0/bits/flt-eval-method.h glibc-2.38/sysdeps/m68k/m680x0/bits/flt-eval-method.h
  2. --- glibc-2.38.orig/sysdeps/m68k/m680x0/bits/flt-eval-method.h 2023-07-31 19:54:16.000000000 +0200
  3. +++ glibc-2.38/sysdeps/m68k/m680x0/bits/flt-eval-method.h 1970-01-01 01:00:00.000000000 +0100
  4. @@ -1,25 +0,0 @@
  5. -/* Define __GLIBC_FLT_EVAL_METHOD. M68K version.
  6. - Copyright (C) 2016-2023 Free Software Foundation, Inc.
  7. - This file is part of the GNU C Library.
  8. -
  9. - The GNU C Library is free software; you can redistribute it and/or
  10. - modify it under the terms of the GNU Lesser General Public
  11. - License as published by the Free Software Foundation; either
  12. - version 2.1 of the License, or (at your option) any later version.
  13. -
  14. - The GNU C Library is distributed in the hope that it will be useful,
  15. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. - Lesser General Public License for more details.
  18. -
  19. - You should have received a copy of the GNU Lesser General Public
  20. - License along with the GNU C Library; if not, see
  21. - <https://www.gnu.org/licenses/>. */
  22. -
  23. -#ifndef _MATH_H
  24. -# error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead."
  25. -#endif
  26. -
  27. -/* The m68k FPUs evaluate all values in the 96-bit floating-point
  28. - format which is also available for the user as 'long double'. */
  29. -#define __GLIBC_FLT_EVAL_METHOD 2
  30. diff -Nur glibc-2.38.orig/sysdeps/m68k/m680x0/lshift.S glibc-2.38/sysdeps/m68k/m680x0/lshift.S
  31. --- glibc-2.38.orig/sysdeps/m68k/m680x0/lshift.S 2023-07-31 19:54:16.000000000 +0200
  32. +++ glibc-2.38/sysdeps/m68k/m680x0/lshift.S 1970-01-01 01:00:00.000000000 +0100
  33. @@ -1,168 +0,0 @@
  34. -/* mc68020 __mpn_lshift -- Shift left a low-level natural-number integer.
  35. -
  36. -Copyright (C) 1996-2023 Free Software Foundation, Inc.
  37. -
  38. -This file is part of the GNU MP Library.
  39. -
  40. -The GNU MP Library is free software; you can redistribute it and/or modify
  41. -it under the terms of the GNU Lesser General Public License as published by
  42. -the Free Software Foundation; either version 2.1 of the License, or (at your
  43. -option) any later version.
  44. -
  45. -The GNU MP Library is distributed in the hope that it will be useful, but
  46. -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  47. -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  48. -License for more details.
  49. -
  50. -You should have received a copy of the GNU Lesser General Public License
  51. -along with the GNU MP Library. If not, see <https://www.gnu.org/licenses/>. */
  52. -
  53. -/*
  54. - INPUT PARAMETERS
  55. - res_ptr (sp + 4)
  56. - s_ptr (sp + 8)
  57. - s_size (sp + 16)
  58. - cnt (sp + 12)
  59. -*/
  60. -
  61. -#include "sysdep.h"
  62. -#include "asm-syntax.h"
  63. -
  64. -#define res_ptr a1
  65. -#define s_ptr a0
  66. -#define s_size d6
  67. -#define cnt d4
  68. -
  69. - TEXT
  70. -ENTRY(__mpn_lshift)
  71. -
  72. -/* Save used registers on the stack. */
  73. - moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp)
  74. - cfi_adjust_cfa_offset (6*4)
  75. - cfi_rel_offset (R(d2), 0)
  76. - cfi_rel_offset (R(d3), 4)
  77. - cfi_rel_offset (R(d4), 8)
  78. - cfi_rel_offset (R(d5), 12)
  79. - cfi_rel_offset (R(d6), 16)
  80. - cfi_rel_offset (R(a2), 20)
  81. -
  82. -/* Copy the arguments to registers. */
  83. - movel MEM_DISP(sp,28),R(res_ptr)
  84. - movel MEM_DISP(sp,32),R(s_ptr)
  85. - movel MEM_DISP(sp,36),R(s_size)
  86. - movel MEM_DISP(sp,40),R(cnt)
  87. -
  88. - moveql #1,R(d5)
  89. - cmpl R(d5),R(cnt)
  90. - bne L(Lnormal)
  91. - cmpl R(s_ptr),R(res_ptr)
  92. - bls L(Lspecial) /* jump if s_ptr >= res_ptr */
  93. -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
  94. - lea MEM_INDX1(s_ptr,s_size,l,4),R(a2)
  95. -#else /* not mc68020 */
  96. - movel R(s_size),R(d0)
  97. - asll #2,R(d0)
  98. - lea MEM_INDX(s_ptr,d0,l),R(a2)
  99. -#endif
  100. - cmpl R(res_ptr),R(a2)
  101. - bls L(Lspecial) /* jump if res_ptr >= s_ptr + s_size */
  102. -
  103. -L(Lnormal:)
  104. - moveql #32,R(d5)
  105. - subl R(cnt),R(d5)
  106. -
  107. -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
  108. - lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr)
  109. - lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr)
  110. -#else /* not mc68000 */
  111. - movel R(s_size),R(d0)
  112. - asll #2,R(d0)
  113. - addl R(s_size),R(s_ptr)
  114. - addl R(s_size),R(res_ptr)
  115. -#endif
  116. - movel MEM_PREDEC(s_ptr),R(d2)
  117. - movel R(d2),R(d0)
  118. - lsrl R(d5),R(d0) /* compute carry limb */
  119. -
  120. - lsll R(cnt),R(d2)
  121. - movel R(d2),R(d1)
  122. - subql #1,R(s_size)
  123. - beq L(Lend)
  124. - lsrl #1,R(s_size)
  125. - bcs L(L1)
  126. - subql #1,R(s_size)
  127. -
  128. -L(Loop:)
  129. - movel MEM_PREDEC(s_ptr),R(d2)
  130. - movel R(d2),R(d3)
  131. - lsrl R(d5),R(d3)
  132. - orl R(d3),R(d1)
  133. - movel R(d1),MEM_PREDEC(res_ptr)
  134. - lsll R(cnt),R(d2)
  135. -L(L1:)
  136. - movel MEM_PREDEC(s_ptr),R(d1)
  137. - movel R(d1),R(d3)
  138. - lsrl R(d5),R(d3)
  139. - orl R(d3),R(d2)
  140. - movel R(d2),MEM_PREDEC(res_ptr)
  141. - lsll R(cnt),R(d1)
  142. -
  143. - dbf R(s_size),L(Loop)
  144. - subl #0x10000,R(s_size)
  145. - bcc L(Loop)
  146. -
  147. -L(Lend:)
  148. - movel R(d1),MEM_PREDEC(res_ptr) /* store least significant limb */
  149. -
  150. -/* Restore used registers from stack frame. */
  151. - moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
  152. - cfi_remember_state
  153. - cfi_adjust_cfa_offset (-6*4)
  154. - cfi_restore (R(d2))
  155. - cfi_restore (R(d3))
  156. - cfi_restore (R(d4))
  157. - cfi_restore (R(d5))
  158. - cfi_restore (R(d6))
  159. - cfi_restore (R(a2))
  160. - rts
  161. -
  162. -/* We loop from least significant end of the arrays, which is only
  163. - permissible if the source and destination don't overlap, since the
  164. - function is documented to work for overlapping source and destination. */
  165. -
  166. - cfi_restore_state
  167. -L(Lspecial:)
  168. - clrl R(d0) /* initialize carry */
  169. - eorw #1,R(s_size)
  170. - lsrl #1,R(s_size)
  171. - bcc L(LL1)
  172. - subql #1,R(s_size)
  173. -
  174. -L(LLoop:)
  175. - movel MEM_POSTINC(s_ptr),R(d2)
  176. - addxl R(d2),R(d2)
  177. - movel R(d2),MEM_POSTINC(res_ptr)
  178. -L(LL1:)
  179. - movel MEM_POSTINC(s_ptr),R(d2)
  180. - addxl R(d2),R(d2)
  181. - movel R(d2),MEM_POSTINC(res_ptr)
  182. -
  183. - dbf R(s_size),L(LLoop)
  184. - addxl R(d0),R(d0) /* save cy in lsb */
  185. - subl #0x10000,R(s_size)
  186. - bcs L(LLend)
  187. - lsrl #1,R(d0) /* restore cy */
  188. - bra L(LLoop)
  189. -
  190. -L(LLend:)
  191. -/* Restore used registers from stack frame. */
  192. - moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
  193. - cfi_adjust_cfa_offset (-6*4)
  194. - cfi_restore (R(d2))
  195. - cfi_restore (R(d3))
  196. - cfi_restore (R(d4))
  197. - cfi_restore (R(d5))
  198. - cfi_restore (R(d6))
  199. - cfi_restore (R(a2))
  200. - rts
  201. -END(__mpn_lshift)
  202. diff -Nur glibc-2.38.orig/sysdeps/m68k/m680x0/m68020/wordcopy.S glibc-2.38/sysdeps/m68k/m680x0/m68020/wordcopy.S
  203. --- glibc-2.38.orig/sysdeps/m68k/m680x0/m68020/wordcopy.S 2023-07-31 19:54:16.000000000 +0200
  204. +++ glibc-2.38/sysdeps/m68k/m680x0/m68020/wordcopy.S 1970-01-01 01:00:00.000000000 +0100
  205. @@ -1 +0,0 @@
  206. -/* Empty, not needed. */
  207. diff -Nur glibc-2.38.orig/sysdeps/m68k/wordcopy.c glibc-2.38/sysdeps/m68k/wordcopy.c
  208. --- glibc-2.38.orig/sysdeps/m68k/wordcopy.c 1970-01-01 01:00:00.000000000 +0100
  209. +++ glibc-2.38/sysdeps/m68k/wordcopy.c 2023-08-10 16:23:10.972526508 +0200
  210. @@ -0,0 +1,21 @@
  211. +/* Definitions for memory copy functions. Motorola 68020 version.
  212. + Copyright (C) 2023 Free Software Foundation, Inc.
  213. + This file is part of the GNU C Library.
  214. +
  215. + The GNU C Library is free software; you can redistribute it and/or
  216. + modify it under the terms of the GNU Lesser General Public
  217. + License as published by the Free Software Foundation; either
  218. + version 2.1 of the License, or (at your option) any later version.
  219. +
  220. + The GNU C Library is distributed in the hope that it will be useful,
  221. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  222. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  223. + Lesser General Public License for more details.
  224. +
  225. + You should have received a copy of the GNU Lesser General Public
  226. + License along with the GNU C Library. If not, see
  227. + <https://www.gnu.org/licenses/>. */
  228. +
  229. +#if !defined(__mc68020__) && !defined(mc68020)
  230. +#include <string/wordcopy.c>
  231. +#endif