| author | |
| committer | |
| log | ef4ce7def1d4868d1d54832fba473f84938e40be |
| tree | 5f1dc8cd8b212fae19da6ba830354a721e03207a |
| parent | 2a155d75ac575c9a99918569249aecdf251e94d9 |
| signature |
PowerPC assembly is wonderful because you can't tell at a glance whether an
operand is an immediate integer or a register number. In this case, mtlr takes a
register number, but we haven't zeroed r0, and it's not a hardwired zero
register as on other architectures.
Fix this by copying from r31 which we've just zeroed.3 files changed, 4 insertions(+), 4 deletions(-)
lib/std/os/linux/powerpc.zig+1-1| ... | @@ -247,7 +247,7 @@ pub fn clone() callconv(.naked) u32 { | ... | @@ -247,7 +247,7 @@ pub fn clone() callconv(.naked) u32 { |
| 247 | ); | 247 | ); |
| 248 | asm volatile ( | 248 | asm volatile ( |
| 249 | \\ li 31, 0 | 249 | \\ li 31, 0 |
| 250 | \\ mtlr 0 | 250 | \\ mtlr 31 |
| 251 | \\ | 251 | \\ |
| 252 | \\ #call funcptr: move arg (d) into r3 | 252 | \\ #call funcptr: move arg (d) into r3 |
| 253 | \\ mr 3, 30 | 253 | \\ mr 3, 30 |
lib/std/os/linux/powerpc64.zig+1-1| ... | @@ -232,7 +232,7 @@ pub fn clone() callconv(.naked) u64 { | ... | @@ -232,7 +232,7 @@ pub fn clone() callconv(.naked) u64 { |
| 232 | ); | 232 | ); |
| 233 | asm volatile ( | 233 | asm volatile ( |
| 234 | \\ li 31, 0 | 234 | \\ li 31, 0 |
| 235 | \\ mtlr 0 | 235 | \\ mtlr 31 |
| 236 | \\ | 236 | \\ |
| 237 | \\ # call fn(arg) | 237 | \\ # call fn(arg) |
| 238 | \\ ld 3, 16(1) | 238 | \\ ld 3, 16(1) |
lib/std/start.zig+2-2| ... | @@ -438,7 +438,7 @@ fn _start() callconv(.naked) noreturn { | ... | @@ -438,7 +438,7 @@ fn _start() callconv(.naked) noreturn { |
| 438 | \\ stwu 1, -16(1) | 438 | \\ stwu 1, -16(1) |
| 439 | \\ stw 0, 0(1) | 439 | \\ stw 0, 0(1) |
| 440 | \\ li 31, 0 | 440 | \\ li 31, 0 |
| 441 | \\ mtlr 0 | 441 | \\ mtlr 31 |
| 442 | \\ b %[posixCallMainAndExit] | 442 | \\ b %[posixCallMainAndExit] |
| 443 | , | 443 | , |
| 444 | .powerpc64, .powerpc64le => | 444 | .powerpc64, .powerpc64le => |
| ... | @@ -451,7 +451,7 @@ fn _start() callconv(.naked) noreturn { | ... | @@ -451,7 +451,7 @@ fn _start() callconv(.naked) noreturn { |
| 451 | \\ li 0, 0 | 451 | \\ li 0, 0 |
| 452 | \\ stdu 0, -32(1) | 452 | \\ stdu 0, -32(1) |
| 453 | \\ li 31, 0 | 453 | \\ li 31, 0 |
| 454 | \\ mtlr 0 | 454 | \\ mtlr 31 |
| 455 | \\ b %[posixCallMainAndExit] | 455 | \\ b %[posixCallMainAndExit] |
| 456 | \\ nop | 456 | \\ nop |
| 457 | , | 457 | , |