| ... | ... | @@ -21,7 +21,11 @@ comptime { |
| 21 | 21 | |
| 22 | 22 | @export("__unordtf2", @import("compiler_rt/comparetf2.zig").__unordtf2, linkage); |
| 23 | 23 | |
| 24 | @export("__addsf3", @import("compiler_rt/addXf3.zig").__addsf3, linkage); |
| 25 | @export("__adddf3", @import("compiler_rt/addXf3.zig").__adddf3, linkage); |
| 24 | 26 | @export("__addtf3", @import("compiler_rt/addXf3.zig").__addtf3, linkage); |
| 27 | @export("__subsf3", @import("compiler_rt/addXf3.zig").__subsf3, linkage); |
| 28 | @export("__subdf3", @import("compiler_rt/addXf3.zig").__subdf3, linkage); |
| 25 | 29 | @export("__subtf3", @import("compiler_rt/addXf3.zig").__subtf3, linkage); |
| 26 | 30 | |
| 27 | 31 | @export("__mulsf3", @import("compiler_rt/mulXf3.zig").__mulsf3, linkage); |
| ... | ... | @@ -78,10 +82,62 @@ comptime { |
| 78 | 82 | @export("__umoddi3", __umoddi3, linkage); |
| 79 | 83 | @export("__udivmodsi4", __udivmodsi4, linkage); |
| 80 | 84 | |
| 85 | @export("__negsf2", @import("compiler_rt/negXf2.zig").__negsf2, linkage); |
| 86 | @export("__negdf2", @import("compiler_rt/negXf2.zig").__negdf2, linkage); |
| 87 | |
| 81 | 88 | if (is_arm_arch and !is_arm_64) { |
| 82 | 89 | @export("__aeabi_uldivmod", __aeabi_uldivmod, linkage); |
| 83 | 90 | @export("__aeabi_uidivmod", __aeabi_uidivmod, linkage); |
| 84 | 91 | @export("__aeabi_uidiv", __udivsi3, linkage); |
| 92 | |
| 93 | @export("__aeabi_memcpy", __aeabi_memcpy, linkage); |
| 94 | @export("__aeabi_memcpy4", __aeabi_memcpy, linkage); |
| 95 | @export("__aeabi_memcpy8", __aeabi_memcpy, linkage); |
| 96 | |
| 97 | @export("__aeabi_memmove", __aeabi_memmove, linkage); |
| 98 | @export("__aeabi_memmove4", __aeabi_memmove, linkage); |
| 99 | @export("__aeabi_memmove8", __aeabi_memmove, linkage); |
| 100 | |
| 101 | @export("__aeabi_memset", __aeabi_memset, linkage); |
| 102 | @export("__aeabi_memset4", __aeabi_memset, linkage); |
| 103 | @export("__aeabi_memset8", __aeabi_memset, linkage); |
| 104 | |
| 105 | @export("__aeabi_memclr", __aeabi_memclr, linkage); |
| 106 | @export("__aeabi_memclr4", __aeabi_memclr, linkage); |
| 107 | @export("__aeabi_memclr8", __aeabi_memclr, linkage); |
| 108 | |
| 109 | @export("__aeabi_memcmp", __aeabi_memcmp, linkage); |
| 110 | @export("__aeabi_memcmp4", __aeabi_memcmp, linkage); |
| 111 | @export("__aeabi_memcmp8", __aeabi_memcmp, linkage); |
| 112 | |
| 113 | @export("__aeabi_fneg", @import("compiler_rt/negXf2.zig").__negsf2, linkage); |
| 114 | @export("__aeabi_dneg", @import("compiler_rt/negXf2.zig").__negdf2, linkage); |
| 115 | |
| 116 | @export("__aeabi_fmul", @import("compiler_rt/mulXf3.zig").__mulsf3, linkage); |
| 117 | @export("__aeabi_dmul", @import("compiler_rt/mulXf3.zig").__muldf3, linkage); |
| 118 | |
| 119 | @export("__aeabi_d2h", @import("compiler_rt/truncXfYf2.zig").__truncdfhf2, linkage); |
| 120 | |
| 121 | @export("__aeabi_f2ulz", @import("compiler_rt/fixunssfdi.zig").__fixunssfdi, linkage); |
| 122 | @export("__aeabi_d2ulz", @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi, linkage); |
| 123 | |
| 124 | @export("__aeabi_f2lz", @import("compiler_rt/fixsfdi.zig").__fixsfdi, linkage); |
| 125 | @export("__aeabi_d2lz", @import("compiler_rt/fixdfdi.zig").__fixdfdi, linkage); |
| 126 | |
| 127 | @export("__aeabi_d2uiz", @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi, linkage); |
| 128 | |
| 129 | @export("__aeabi_h2f", @import("compiler_rt/extendXfYf2.zig").__extendhfsf2, linkage); |
| 130 | @export("__aeabi_f2h", @import("compiler_rt/truncXfYf2.zig").__truncsfhf2, linkage); |
| 131 | |
| 132 | @export("__aeabi_fadd", @import("compiler_rt/addXf3.zig").__addsf3, linkage); |
| 133 | @export("__aeabi_dadd", @import("compiler_rt/addXf3.zig").__adddf3, linkage); |
| 134 | @export("__aeabi_fsub", @import("compiler_rt/addXf3.zig").__subsf3, linkage); |
| 135 | @export("__aeabi_dsub", @import("compiler_rt/addXf3.zig").__subdf3, linkage); |
| 136 | |
| 137 | @export("__aeabi_f2uiz", @import("compiler_rt/fixunssfsi.zig").__fixunssfsi, linkage); |
| 138 | |
| 139 | @export("__aeabi_f2iz", @import("compiler_rt/fixsfsi.zig").__fixsfsi, linkage); |
| 140 | @export("__aeabi_d2iz", @import("compiler_rt/fixdfsi.zig").__fixdfsi, linkage); |
| 85 | 141 | } |
| 86 | 142 | if (builtin.os == builtin.Os.windows) { |
| 87 | 143 | switch (builtin.arch) { |
| ... | ... | @@ -187,6 +243,17 @@ const is_arm_arch = switch (builtin.arch) { |
| 187 | 243 | else => false, |
| 188 | 244 | }; |
| 189 | 245 | |
| 246 | const is_arm_32 = is_arm_arch and !is_arm_64; |
| 247 | |
| 248 | const use_thumb_1 = is_arm_32 and switch (builtin.arch.arm) { |
| 249 | builtin.Arch.Arm32.v6, |
| 250 | builtin.Arch.Arm32.v6m, |
| 251 | builtin.Arch.Arm32.v6k, |
| 252 | builtin.Arch.Arm32.v6t2, |
| 253 | => true, |
| 254 | else => false, |
| 255 | }; |
| 256 | |
| 190 | 257 | nakedcc fn __aeabi_uidivmod() void { |
| 191 | 258 | @setRuntimeSafety(false); |
| 192 | 259 | asm volatile ( |
| ... | ... | @@ -203,6 +270,96 @@ nakedcc fn __aeabi_uidivmod() void { |
| 203 | 270 | ); |
| 204 | 271 | } |
| 205 | 272 | |
| 273 | nakedcc fn __aeabi_memcpy() noreturn { |
| 274 | @setRuntimeSafety(false); |
| 275 | if (use_thumb_1) { |
| 276 | asm volatile ( |
| 277 | \\ push {r7, lr} |
| 278 | \\ bl memcpy |
| 279 | \\ pop {r7, pc} |
| 280 | ); |
| 281 | } else { |
| 282 | asm volatile ( |
| 283 | \\ b memcpy |
| 284 | ); |
| 285 | } |
| 286 | unreachable; |
| 287 | } |
| 288 | |
| 289 | nakedcc fn __aeabi_memmove() noreturn { |
| 290 | @setRuntimeSafety(false); |
| 291 | if (use_thumb_1) { |
| 292 | asm volatile ( |
| 293 | \\ push {r7, lr} |
| 294 | \\ bl memmove |
| 295 | \\ pop {r7, pc} |
| 296 | ); |
| 297 | } else { |
| 298 | asm volatile ( |
| 299 | \\ b memmove |
| 300 | ); |
| 301 | } |
| 302 | unreachable; |
| 303 | } |
| 304 | |
| 305 | nakedcc fn __aeabi_memset() noreturn { |
| 306 | @setRuntimeSafety(false); |
| 307 | if (use_thumb_1) { |
| 308 | asm volatile ( |
| 309 | \\ mov r3, r1 |
| 310 | \\ mov r1, r2 |
| 311 | \\ mov r2, r3 |
| 312 | \\ push {r7, lr} |
| 313 | \\ b memset |
| 314 | \\ pop {r7, pc} |
| 315 | ); |
| 316 | } else { |
| 317 | asm volatile ( |
| 318 | \\ mov r3, r1 |
| 319 | \\ mov r1, r2 |
| 320 | \\ mov r2, r3 |
| 321 | \\ b memset |
| 322 | ); |
| 323 | } |
| 324 | unreachable; |
| 325 | } |
| 326 | |
| 327 | nakedcc fn __aeabi_memclr() noreturn { |
| 328 | @setRuntimeSafety(false); |
| 329 | if (use_thumb_1) { |
| 330 | asm volatile ( |
| 331 | \\ mov r2, r1 |
| 332 | \\ movs r1, #0 |
| 333 | \\ push {r7, lr} |
| 334 | \\ bl memset |
| 335 | \\ pop {r7, pc} |
| 336 | ); |
| 337 | } else { |
| 338 | asm volatile ( |
| 339 | \\ mov r2, r1 |
| 340 | \\ movs r1, #0 |
| 341 | \\ b memset |
| 342 | ); |
| 343 | } |
| 344 | unreachable; |
| 345 | } |
| 346 | |
| 347 | nakedcc fn __aeabi_memcmp() noreturn { |
| 348 | @setRuntimeSafety(false); |
| 349 | if (use_thumb_1) { |
| 350 | asm volatile ( |
| 351 | \\ push {r7, lr} |
| 352 | \\ bl memcmp |
| 353 | \\ pop {r7, pc} |
| 354 | ); |
| 355 | } else { |
| 356 | asm volatile ( |
| 357 | \\ b memcmp |
| 358 | ); |
| 359 | } |
| 360 | unreachable; |
| 361 | } |
| 362 | |
| 206 | 363 | // _chkstk (_alloca) routine - probe stack between %esp and (%esp-%eax) in 4k increments, |
| 207 | 364 | // then decrement %esp by %eax. Preserves all registers except %esp and flags. |
| 208 | 365 | // This routine is windows specific |