| ... | @@ -82,6 +82,26 @@ comptime { | ... | @@ -82,6 +82,26 @@ comptime { |
| 82 | @export("__aeabi_uldivmod", __aeabi_uldivmod, linkage); | 82 | @export("__aeabi_uldivmod", __aeabi_uldivmod, linkage); |
| 83 | @export("__aeabi_uidivmod", __aeabi_uidivmod, linkage); | 83 | @export("__aeabi_uidivmod", __aeabi_uidivmod, linkage); |
| 84 | @export("__aeabi_uidiv", __udivsi3, linkage); | 84 | @export("__aeabi_uidiv", __udivsi3, linkage); |
| | 85 | |
| | 86 | @export("__aeabi_memcpy", __aeabi_memcpy, linkage); |
| | 87 | @export("__aeabi_memcpy4", __aeabi_memcpy, linkage); |
| | 88 | @export("__aeabi_memcpy8", __aeabi_memcpy, linkage); |
| | 89 | |
| | 90 | @export("__aeabi_memmove", __aeabi_memmove, linkage); |
| | 91 | @export("__aeabi_memmove4", __aeabi_memmove, linkage); |
| | 92 | @export("__aeabi_memmove8", __aeabi_memmove, linkage); |
| | 93 | |
| | 94 | @export("__aeabi_memset", __aeabi_memset, linkage); |
| | 95 | @export("__aeabi_memset4", __aeabi_memset, linkage); |
| | 96 | @export("__aeabi_memset8", __aeabi_memset, linkage); |
| | 97 | |
| | 98 | @export("__aeabi_memclr", __aeabi_memclr, linkage); |
| | 99 | @export("__aeabi_memclr4", __aeabi_memclr, linkage); |
| | 100 | @export("__aeabi_memclr8", __aeabi_memclr, linkage); |
| | 101 | |
| | 102 | @export("__aeabi_memcmp", __aeabi_memcmp, linkage); |
| | 103 | @export("__aeabi_memcmp4", __aeabi_memcmp, linkage); |
| | 104 | @export("__aeabi_memcmp8", __aeabi_memcmp, linkage); |
| 85 | } | 105 | } |
| 86 | if (builtin.os == builtin.Os.windows) { | 106 | if (builtin.os == builtin.Os.windows) { |
| 87 | switch (builtin.arch) { | 107 | switch (builtin.arch) { |
| ... | @@ -187,6 +207,17 @@ const is_arm_arch = switch (builtin.arch) { | ... | @@ -187,6 +207,17 @@ const is_arm_arch = switch (builtin.arch) { |
| 187 | else => false, | 207 | else => false, |
| 188 | }; | 208 | }; |
| 189 | | 209 | |
| | 210 | const is_arm_32 = is_arm_arch and !is_arm_64; |
| | 211 | |
| | 212 | const use_thumb_1 = is_arm_32 and switch (builtin.arch.arm) { |
| | 213 | builtin.Arch.Arm32.v6, |
| | 214 | builtin.Arch.Arm32.v6m, |
| | 215 | builtin.Arch.Arm32.v6k, |
| | 216 | builtin.Arch.Arm32.v6t2, |
| | 217 | => true, |
| | 218 | else => false, |
| | 219 | }; |
| | 220 | |
| 190 | nakedcc fn __aeabi_uidivmod() void { | 221 | nakedcc fn __aeabi_uidivmod() void { |
| 191 | @setRuntimeSafety(false); | 222 | @setRuntimeSafety(false); |
| 192 | asm volatile ( | 223 | asm volatile ( |
| ... | @@ -203,6 +234,96 @@ nakedcc fn __aeabi_uidivmod() void { | ... | @@ -203,6 +234,96 @@ nakedcc fn __aeabi_uidivmod() void { |
| 203 | ); | 234 | ); |
| 204 | } | 235 | } |
| 205 | | 236 | |
| | 237 | nakedcc fn __aeabi_memcpy() noreturn { |
| | 238 | @setRuntimeSafety(false); |
| | 239 | if (use_thumb_1) { |
| | 240 | asm volatile ( |
| | 241 | \\ push {r7, lr} |
| | 242 | \\ bl memcpy |
| | 243 | \\ pop {r7, pc} |
| | 244 | ); |
| | 245 | } else { |
| | 246 | asm volatile ( |
| | 247 | \\ b memcpy |
| | 248 | ); |
| | 249 | } |
| | 250 | unreachable; |
| | 251 | } |
| | 252 | |
| | 253 | nakedcc fn __aeabi_memmove() noreturn { |
| | 254 | @setRuntimeSafety(false); |
| | 255 | if (use_thumb_1) { |
| | 256 | asm volatile ( |
| | 257 | \\ push {r7, lr} |
| | 258 | \\ bl memmove |
| | 259 | \\ pop {r7, pc} |
| | 260 | ); |
| | 261 | } else { |
| | 262 | asm volatile ( |
| | 263 | \\ b memmove |
| | 264 | ); |
| | 265 | } |
| | 266 | unreachable; |
| | 267 | } |
| | 268 | |
| | 269 | nakedcc fn __aeabi_memset() noreturn { |
| | 270 | @setRuntimeSafety(false); |
| | 271 | if (use_thumb_1) { |
| | 272 | asm volatile ( |
| | 273 | \\ mov r3, r1 |
| | 274 | \\ mov r1, r2 |
| | 275 | \\ mov r2, r3 |
| | 276 | \\ push {r7, lr} |
| | 277 | \\ b memset |
| | 278 | \\ pop {r7, pc} |
| | 279 | ); |
| | 280 | } else { |
| | 281 | asm volatile ( |
| | 282 | \\ mov r3, r1 |
| | 283 | \\ mov r1, r2 |
| | 284 | \\ mov r2, r3 |
| | 285 | \\ b memset |
| | 286 | ); |
| | 287 | } |
| | 288 | unreachable; |
| | 289 | } |
| | 290 | |
| | 291 | nakedcc fn __aeabi_memclr() noreturn { |
| | 292 | @setRuntimeSafety(false); |
| | 293 | if (use_thumb_1) { |
| | 294 | asm volatile ( |
| | 295 | \\ mov r2, r1 |
| | 296 | \\ movs r1, #0 |
| | 297 | \\ push {r7, lr} |
| | 298 | \\ bl memset |
| | 299 | \\ pop {r7, pc} |
| | 300 | ); |
| | 301 | } else { |
| | 302 | asm volatile ( |
| | 303 | \\ mov r2, r1 |
| | 304 | \\ movs r1, #0 |
| | 305 | \\ b memset |
| | 306 | ); |
| | 307 | } |
| | 308 | unreachable; |
| | 309 | } |
| | 310 | |
| | 311 | nakedcc fn __aeabi_memcmp() noreturn { |
| | 312 | @setRuntimeSafety(false); |
| | 313 | if (use_thumb_1) { |
| | 314 | asm volatile ( |
| | 315 | \\ push {r7, lr} |
| | 316 | \\ bl memcmp |
| | 317 | \\ pop {r7, pc} |
| | 318 | ); |
| | 319 | } else { |
| | 320 | asm volatile ( |
| | 321 | \\ b memcmp |
| | 322 | ); |
| | 323 | } |
| | 324 | unreachable; |
| | 325 | } |
| | 326 | |
| 206 | // _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments, | 327 | // _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments, |
| 207 | // then decrement %esp by %eax. Preserves all registers except %esp and flags. | 328 | // then decrement %esp by %eax. Preserves all registers except %esp and flags. |
| 208 | // This routine is windows specific | 329 | // This routine is windows specific |