| author | |
| committer | |
| log | 3b947932abbb9f14710c64e3afa6fa88947d1ed1 |
| tree | f226bf066c77916ce2a0fda299bfefd227f33343 |
| parent | 3822af14071ec2ffe03427079c343549f0143d9b |
| signature |
And fill in some delay slots where we can't avoid them.6 files changed, 53 insertions(+), 40 deletions(-)
lib/std/Thread.zig+32-32| ... | ... | @@ -1166,29 +1166,29 @@ const LinuxThreadImpl = struct { |
| 1166 | 1166 | posix.sigprocmask(std.posix.SIG.BLOCK, &std.os.linux.sigfillset(), null); |
| 1167 | 1167 | switch (target.cpu.arch) { |
| 1168 | 1168 | .x86 => asm volatile ( |
| 1169 | \\ movl $91, %%eax # SYS_munmap | |
| 1170 | \\ int $128 | |
| 1171 | \\ movl $1, %%eax # SYS_exit | |
| 1172 | \\ movl $0, %%ebx | |
| 1173 | \\ int $128 | |
| 1169 | \\ movl $91, %%eax # SYS_munmap | |
| 1170 | \\ int $128 | |
| 1171 | \\ movl $1, %%eax # SYS_exit | |
| 1172 | \\ movl $0, %%ebx | |
| 1173 | \\ int $128 | |
| 1174 | 1174 | : |
| 1175 | 1175 | : [ptr] "{ebx}" (@intFromPtr(self.mapped.ptr)), |
| 1176 | 1176 | [len] "{ecx}" (self.mapped.len), |
| 1177 | 1177 | ), |
| 1178 | 1178 | .x86_64 => asm volatile (switch (target.abi) { |
| 1179 | 1179 | .gnux32, .muslx32, .x32 => |
| 1180 | \\ movl $0x4000000b, %%eax # SYS_munmap | |
| 1181 | \\ syscall | |
| 1182 | \\ movl $0x4000003c, %%eax # SYS_exit | |
| 1183 | \\ xor %%rdi, %%rdi | |
| 1184 | \\ syscall | |
| 1180 | \\ movl $0x4000000b, %%eax # SYS_munmap | |
| 1181 | \\ syscall | |
| 1182 | \\ movl $0x4000003c, %%eax # SYS_exit | |
| 1183 | \\ xor %%rdi, %%rdi | |
| 1184 | \\ syscall | |
| 1185 | 1185 | , |
| 1186 | 1186 | else => |
| 1187 | \\ movl $11, %%eax # SYS_munmap | |
| 1188 | \\ syscall | |
| 1189 | \\ movl $60, %%eax # SYS_exit | |
| 1190 | \\ xor %%rdi, %%rdi | |
| 1191 | \\ syscall | |
| 1187 | \\ movl $11, %%eax # SYS_munmap | |
| 1188 | \\ syscall | |
| 1189 | \\ movl $60, %%eax # SYS_exit | |
| 1190 | \\ xor %%rdi, %%rdi | |
| 1191 | \\ syscall | |
| 1192 | 1192 | , |
| 1193 | 1193 | } |
| 1194 | 1194 | : |
| ... | ... | @@ -1196,21 +1196,21 @@ const LinuxThreadImpl = struct { |
| 1196 | 1196 | [len] "{rsi}" (self.mapped.len), |
| 1197 | 1197 | ), |
| 1198 | 1198 | .arm, .armeb, .thumb, .thumbeb => asm volatile ( |
| 1199 | \\ mov r7, #91 // SYS_munmap | |
| 1200 | \\ svc 0 | |
| 1201 | \\ mov r7, #1 // SYS_exit | |
| 1202 | \\ mov r0, #0 | |
| 1203 | \\ svc 0 | |
| 1199 | \\ mov r7, #91 // SYS_munmap | |
| 1200 | \\ svc 0 | |
| 1201 | \\ mov r7, #1 // SYS_exit | |
| 1202 | \\ mov r0, #0 | |
| 1203 | \\ svc 0 | |
| 1204 | 1204 | : |
| 1205 | 1205 | : [ptr] "{r0}" (@intFromPtr(self.mapped.ptr)), |
| 1206 | 1206 | [len] "{r1}" (self.mapped.len), |
| 1207 | 1207 | ), |
| 1208 | 1208 | .aarch64, .aarch64_be => asm volatile ( |
| 1209 | \\ mov x8, #215 // SYS_munmap | |
| 1210 | \\ svc 0 | |
| 1211 | \\ mov x8, #93 // SYS_exit | |
| 1212 | \\ mov x0, #0 | |
| 1213 | \\ svc 0 | |
| 1209 | \\ mov x8, #215 // SYS_munmap | |
| 1210 | \\ svc 0 | |
| 1211 | \\ mov x8, #93 // SYS_exit | |
| 1212 | \\ mov x0, #0 | |
| 1213 | \\ svc 0 | |
| 1214 | 1214 | : |
| 1215 | 1215 | : [ptr] "{x0}" (@intFromPtr(self.mapped.ptr)), |
| 1216 | 1216 | [len] "{x1}" (self.mapped.len), |
| ... | ... | @@ -1236,21 +1236,21 @@ const LinuxThreadImpl = struct { |
| 1236 | 1236 | [len] "{r1}" (self.mapped.len), |
| 1237 | 1237 | ), |
| 1238 | 1238 | .hexagon => asm volatile ( |
| 1239 | \\ r6 = #215 // SYS_munmap | |
| 1240 | \\ trap0(#1) | |
| 1241 | \\ r6 = #93 // SYS_exit | |
| 1242 | \\ r0 = #0 | |
| 1243 | \\ trap0(#1) | |
| 1239 | \\ r6 = #215 // SYS_munmap | |
| 1240 | \\ trap0(#1) | |
| 1241 | \\ r6 = #93 // SYS_exit | |
| 1242 | \\ r0 = #0 | |
| 1243 | \\ trap0(#1) | |
| 1244 | 1244 | : |
| 1245 | 1245 | : [ptr] "{r0}" (@intFromPtr(self.mapped.ptr)), |
| 1246 | 1246 | [len] "{r1}" (self.mapped.len), |
| 1247 | 1247 | ), |
| 1248 | 1248 | .hppa => asm volatile ( |
| 1249 | \\ ldi 91, %%r20 /* SYS_munmap */ | |
| 1250 | 1249 | \\ ble 0x100(%%sr2, %%r0) |
| 1251 | \\ ldi 1, %%r20 /* SYS_exit */ | |
| 1250 | \\ ldi 91, %%r20 /* SYS_munmap */ | |
| 1252 | 1251 | \\ ldi 0, %%r26 |
| 1253 | 1252 | \\ ble 0x100(%%sr2, %%r0) |
| 1253 | \\ ldi 1, %%r20 /* SYS_exit */ | |
| 1254 | 1254 | : |
| 1255 | 1255 | : [ptr] "{r26}" (@intFromPtr(self.mapped.ptr)), |
| 1256 | 1256 | [len] "{r25}" (self.mapped.len), |
lib/std/debug/cpu_context.zig+5| ... | ... | @@ -1039,6 +1039,7 @@ const Mips = extern struct { |
| 1039 | 1039 | \\ sd $fp, 240($t0) |
| 1040 | 1040 | \\ sd $ra, 248($t0) |
| 1041 | 1041 | \\ bal 1f |
| 1042 | \\ nop | |
| 1042 | 1043 | \\1: |
| 1043 | 1044 | \\ sd $ra, 256($t0) |
| 1044 | 1045 | \\ .set pop |
| ... | ... | @@ -1080,6 +1081,7 @@ const Mips = extern struct { |
| 1080 | 1081 | \\ sw $fp, 120($t4) |
| 1081 | 1082 | \\ sw $ra, 124($t4) |
| 1082 | 1083 | \\ bal 1f |
| 1084 | \\ nop | |
| 1083 | 1085 | \\1: |
| 1084 | 1086 | \\ sw $ra, 128($t4) |
| 1085 | 1087 | \\ .set pop |
| ... | ... | @@ -1164,6 +1166,7 @@ const Or1k = extern struct { |
| 1164 | 1166 | \\ l.sw 120(r15), r30 |
| 1165 | 1167 | \\ l.sw 124(r15), r31 |
| 1166 | 1168 | \\ l.jal 1f |
| 1169 | \\ l.nop | |
| 1167 | 1170 | \\1: |
| 1168 | 1171 | \\ l.sw 128(r15), r9 |
| 1169 | 1172 | : |
| ... | ... | @@ -1558,6 +1561,7 @@ const Sparc = extern struct { |
| 1558 | 1561 | \\ stx %i6, [%l0 + 240] |
| 1559 | 1562 | \\ stx %i7, [%l0 + 248] |
| 1560 | 1563 | \\ call 1f |
| 1564 | \\ nop | |
| 1561 | 1565 | \\1: |
| 1562 | 1566 | \\ stx %o7, [%l0 + 256] |
| 1563 | 1567 | else |
| ... | ... | @@ -1578,6 +1582,7 @@ const Sparc = extern struct { |
| 1578 | 1582 | \\ std %i4, [%l0 + 112] |
| 1579 | 1583 | \\ std %i6, [%l0 + 120] |
| 1580 | 1584 | \\ call 1f |
| 1585 | \\ nop | |
| 1581 | 1586 | \\1: |
| 1582 | 1587 | \\ st %o7, [%l0 + 128] |
| 1583 | 1588 | : |
lib/std/os/linux/or1k.zig+3| ... | ... | @@ -138,7 +138,9 @@ pub fn clone() callconv(.naked) u32 { |
| 138 | 138 | \\ l.sys 1 |
| 139 | 139 | \\ l.sfeqi r11, 0 |
| 140 | 140 | \\ l.bf 1f |
| 141 | \\ l.nop | |
| 141 | 142 | \\ l.jr r9 |
| 143 | \\ l.nop | |
| 142 | 144 | \\1: |
| 143 | 145 | ); |
| 144 | 146 | if (builtin.unwind_tables != .none or !builtin.strip_debug_info) asm volatile ( |
| ... | ... | @@ -151,6 +153,7 @@ pub fn clone() callconv(.naked) u32 { |
| 151 | 153 | \\ l.lwz r11, 0(r1) |
| 152 | 154 | \\ l.lwz r3, 4(r1) |
| 153 | 155 | \\ l.jalr r11 |
| 156 | \\ l.nop | |
| 154 | 157 | \\ |
| 155 | 158 | \\ l.ori r3, r11, 0 |
| 156 | 159 | \\ l.ori r11, r0, 93 # SYS_exit |
lib/std/os/linux/tls.zig+1| ... | ... | @@ -295,6 +295,7 @@ pub fn setThreadPointer(addr: usize) void { |
| 295 | 295 | .hppa => { |
| 296 | 296 | asm volatile ( |
| 297 | 297 | \\ ble 0xe0(%%sr2, %%r0) |
| 298 | \\ nop | |
| 298 | 299 | : |
| 299 | 300 | : [addr] "={r26}" (addr), |
| 300 | 301 | : .{ .r29 = true }); |
lib/std/pie.zig+2| ... | ... | @@ -190,6 +190,7 @@ inline fn getDynamicSymbol() [*]const elf.Dyn { |
| 190 | 190 | \\ .weak _DYNAMIC |
| 191 | 191 | \\ .hidden _DYNAMIC |
| 192 | 192 | \\ l.jal 1f |
| 193 | \\ l.nop | |
| 193 | 194 | \\ .word _DYNAMIC - . |
| 194 | 195 | \\1: |
| 195 | 196 | \\ l.lwz %[ret], 0(r9) |
| ... | ... | @@ -245,6 +246,7 @@ inline fn getDynamicSymbol() [*]const elf.Dyn { |
| 245 | 246 | \\ mov.l 1f, %[ret] |
| 246 | 247 | \\ add r0, %[ret] |
| 247 | 248 | \\ bra 2f |
| 249 | \\ nop | |
| 248 | 250 | \\1: |
| 249 | 251 | \\ .balign 4 |
| 250 | 252 | \\ .long DYNAMIC - . |
lib/std/start.zig+10-8| ... | ... | @@ -295,7 +295,7 @@ fn _start() callconv(.naked) noreturn { |
| 295 | 295 | \\ r29 = and(r29, #-8) |
| 296 | 296 | \\ memw(r29 + #-8) = r29 |
| 297 | 297 | \\ r29 = add(r29, #-8) |
| 298 | \\ call %[posixCallMainAndExit] | |
| 298 | \\ jump %[posixCallMainAndExit] | |
| 299 | 299 | , |
| 300 | 300 | .kvx => |
| 301 | 301 | \\ make $fp = 0 |
| ... | ... | @@ -327,7 +327,8 @@ fn _start() callconv(.naked) noreturn { |
| 327 | 327 | \\ l.ori r9, r0, 0 |
| 328 | 328 | \\ l.ori r3, r1, 0 |
| 329 | 329 | \\ l.andi r1, r1, -4 |
| 330 | \\ l.jal %[posixCallMainAndExit] | |
| 330 | \\ l.j %[posixCallMainAndExit] | |
| 331 | \\ l.nop | |
| 331 | 332 | , |
| 332 | 333 | .riscv32, .riscv32be, .riscv64, .riscv64be => |
| 333 | 334 | \\ li fp, 0 |
| ... | ... | @@ -356,7 +357,7 @@ fn _start() callconv(.naked) noreturn { |
| 356 | 357 | \\ or %%r1, %%r0, %%r0 |
| 357 | 358 | \\ or %%r2, %%r31, %%r0 |
| 358 | 359 | \\ clr %%r31, %%r31, 4<0> |
| 359 | \\ br.n %[posixCallMainAndExit] | |
| 360 | \\ br %[posixCallMainAndExit] | |
| 360 | 361 | , |
| 361 | 362 | .microblaze, .microblazeel => |
| 362 | 363 | // r1 = SP, r15 = LR, r19 = FP, r20 = GP |
| ... | ... | @@ -366,7 +367,7 @@ fn _start() callconv(.naked) noreturn { |
| 366 | 367 | \\ addi r20, r20, _GLOBAL_OFFSET_TABLE_ + 8 |
| 367 | 368 | \\ ori r5, r1, 0 |
| 368 | 369 | \\ andi r1, r1, -4 |
| 369 | \\ brlid r15, %[posixCallMainAndExit] | |
| 370 | \\ bri %[posixCallMainAndExit] | |
| 370 | 371 | , |
| 371 | 372 | .mips, .mipsel => |
| 372 | 373 | \\ move $fp, $zero |
| ... | ... | @@ -385,7 +386,7 @@ fn _start() callconv(.naked) noreturn { |
| 385 | 386 | \\ move $a0, $sp |
| 386 | 387 | \\ and $sp, -8 |
| 387 | 388 | \\ subu $sp, $sp, 16 |
| 388 | \\ jalr $t9 | |
| 389 | \\ jr $t9 | |
| 389 | 390 | , |
| 390 | 391 | .mips64, .mips64el => switch (builtin.abi) { |
| 391 | 392 | .gnuabin32, .muslabin32, .abin32 => |
| ... | ... | @@ -403,7 +404,7 @@ fn _start() callconv(.naked) noreturn { |
| 403 | 404 | \\ move $a0, $sp |
| 404 | 405 | \\ and $sp, -16 |
| 405 | 406 | \\ subu $sp, $sp, 16 |
| 406 | \\ jalr $t9 | |
| 407 | \\ jr $t9 | |
| 407 | 408 | , |
| 408 | 409 | else => |
| 409 | 410 | \\ move $fp, $zero |
| ... | ... | @@ -424,7 +425,7 @@ fn _start() callconv(.naked) noreturn { |
| 424 | 425 | \\ move $a0, $sp |
| 425 | 426 | \\ and $sp, -16 |
| 426 | 427 | \\ dsubu $sp, $sp, 16 |
| 427 | \\ jalr $t9 | |
| 428 | \\ jr $t9 | |
| 428 | 429 | , |
| 429 | 430 | }, |
| 430 | 431 | .powerpc, .powerpcle => |
| ... | ... | @@ -476,7 +477,8 @@ fn _start() callconv(.naked) noreturn { |
| 476 | 477 | \\ and r0, r15 |
| 477 | 478 | \\ mov.l 2f, r1 |
| 478 | 479 | \\1: |
| 479 | \\ bsrf r1 | |
| 480 | \\ braf r1 | |
| 481 | \\ nop | |
| 480 | 482 | \\2: |
| 481 | 483 | \\ .balign 4 |
| 482 | 484 | \\ .long %[posixCallMainAndExit]@PCREL - (1b + 4 - .) |