| author | |
| committer | |
| log | 5c4b14b6828b6de047a00e342de354cb69367f72 |
| tree | a9bd9b3825bd49ba51b13c069c1ed10b0b51b773 |
| parent | 98d4ee649dfb06d224ea6a57e63dda2557ed0229 |
| parent | 1235bc67e20730dbf8741f56a15ac21989d72833 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/3685112 files changed, 28 insertions(+), 48 deletions(-)
lib/std/os/linux/hexagon.zig-1| ... | ... | @@ -136,7 +136,6 @@ pub fn clone() callconv(.naked) u32 { |
| 136 | 136 | \\ callr r11 |
| 137 | 137 | \\ |
| 138 | 138 | \\ r6 = #93 // SYS_exit |
| 139 | \\ r0 = #0 | |
| 140 | 139 | \\ trap0(#1) |
| 141 | 140 | ); |
| 142 | 141 | } |
lib/std/os/linux/microblaze.zig+3-2| ... | ... | @@ -130,11 +130,11 @@ pub fn clone() callconv(.naked) u32 { |
| 130 | 130 | \\ brki r14, 0x8 |
| 131 | 131 | \\ beqi r3, 1f |
| 132 | 132 | \\ |
| 133 | \\ // parent | |
| 133 | \\ # parent | |
| 134 | 134 | \\ rtsd r15, 8 |
| 135 | 135 | \\ nop |
| 136 | 136 | \\ |
| 137 | \\ // child | |
| 137 | \\ # child | |
| 138 | 138 | \\1: |
| 139 | 139 | \\ ori r15, r0, 0 |
| 140 | 140 | \\ ori r19, r0, 0 |
| ... | ... | @@ -144,6 +144,7 @@ pub fn clone() callconv(.naked) u32 { |
| 144 | 144 | \\ brald r15, r3 |
| 145 | 145 | \\ nop |
| 146 | 146 | \\ |
| 147 | \\ ori r5, r3, 0 | |
| 147 | 148 | \\ ori r12, r0, 1 # SYS_exit |
| 148 | 149 | \\ brki r14, 0x8 |
| 149 | 150 | ); |
lib/std/os/linux/mips.zig+1| ... | ... | @@ -190,6 +190,7 @@ pub fn syscall_pipe( |
| 190 | 190 | \\1: |
| 191 | 191 | \\ sw $v0, 0($a0) |
| 192 | 192 | \\ sw $v1, 4($a0) |
| 193 | \\ move $v0, $zero | |
| 193 | 194 | \\2: |
| 194 | 195 | : [ret] "={$2}" (-> u32), |
| 195 | 196 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
lib/std/os/linux/mips64.zig+1| ... | ... | @@ -148,6 +148,7 @@ pub fn syscall_pipe( |
| 148 | 148 | \\1: |
| 149 | 149 | \\ sw $v0, 0($a0) |
| 150 | 150 | \\ sw $v1, 4($a0) |
| 151 | \\ move $v0, $zero | |
| 151 | 152 | \\2: |
| 152 | 153 | : [ret] "={$2}" (-> u64), |
| 153 | 154 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
lib/std/os/linux/mipsn32.zig+1| ... | ... | @@ -148,6 +148,7 @@ pub fn syscall_pipe( |
| 148 | 148 | \\1: |
| 149 | 149 | \\ sw $v0, 0($a0) |
| 150 | 150 | \\ sw $v1, 4($a0) |
| 151 | \\ move $v0, $zero | |
| 151 | 152 | \\2: |
| 152 | 153 | : [ret] "={$2}" (-> u32), |
| 153 | 154 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
lib/std/os/linux/or1k.zig+5-5| ... | ... | @@ -120,8 +120,8 @@ pub fn clone() callconv(.naked) u32 { |
| 120 | 120 | // __clone(func, stack, flags, arg, ptid, tls, ctid) |
| 121 | 121 | // r3, r4, r5, r6, r7, r8, +0 |
| 122 | 122 | // |
| 123 | // syscall(SYS_clone, flags, stack, ptid, tls, ctid) | |
| 124 | // r11 r3, r4, r5, r6, r7 | |
| 123 | // syscall(SYS_clone, flags, stack, ptid, ctid, tls) | |
| 124 | // r11 r3, r4, r5, r6, r7 | |
| 125 | 125 | asm volatile ( |
| 126 | 126 | \\ # Save function pointer and argument pointer on new thread stack |
| 127 | 127 | \\ l.addi r13, r0, -4 |
| ... | ... | @@ -134,8 +134,8 @@ pub fn clone() callconv(.naked) u32 { |
| 134 | 134 | \\ l.ori r11, r0, 220 # SYS_clone |
| 135 | 135 | \\ l.ori r3, r5, 0 |
| 136 | 136 | \\ l.ori r5, r7, 0 |
| 137 | \\ l.ori r6, r8, 0 | |
| 138 | \\ l.lwz r7, 0(r1) | |
| 137 | \\ l.lwz r6, 0(r1) | |
| 138 | \\ l.ori r7, r8, 0 | |
| 139 | 139 | \\ l.sys 1 |
| 140 | 140 | \\ l.sfeqi r11, 0 |
| 141 | 141 | \\ l.bf 1f |
| ... | ... | @@ -145,7 +145,7 @@ pub fn clone() callconv(.naked) u32 { |
| 145 | 145 | \\1: |
| 146 | 146 | ); |
| 147 | 147 | if (builtin.unwind_tables != .none or !builtin.strip_debug_info) asm volatile ( |
| 148 | \\ .cfi_undefined r9 | |
| 148 | \\ .cfi_undefined 9 | |
| 149 | 149 | ); |
| 150 | 150 | asm volatile ( |
| 151 | 151 | \\ l.ori r2, r0, 0 |
lib/std/os/linux/sh.zig+3-2| ... | ... | @@ -179,11 +179,11 @@ pub fn clone() callconv(.naked) u32 { |
| 179 | 179 | \\ cmp/eq #0, r0 |
| 180 | 180 | \\ bt 1f |
| 181 | 181 | \\ |
| 182 | \\ // parent | |
| 182 | \\ ! parent | |
| 183 | 183 | \\ rts |
| 184 | 184 | \\ nop |
| 185 | 185 | \\ |
| 186 | \\ // child | |
| 186 | \\ ! child | |
| 187 | 187 | \\1: |
| 188 | 188 | ); |
| 189 | 189 | if (builtin.unwind_tables != .none or !builtin.strip_debug_info) asm volatile ( |
| ... | ... | @@ -199,6 +199,7 @@ pub fn clone() callconv(.naked) u32 { |
| 199 | 199 | \\ nop |
| 200 | 200 | \\ |
| 201 | 201 | \\ mov #1, r3 ! SYS_exit |
| 202 | \\ mov r0, r4 | |
| 202 | 203 | \\ trapa #31 |
| 203 | 204 | \\ or r0, r0 |
| 204 | 205 | \\ or r0, r0 |
lib/std/os/linux/xtensa.zig+2| ... | ... | @@ -151,6 +151,8 @@ pub fn clone() callconv(.naked) u32 { |
| 151 | 151 | \\ |
| 152 | 152 | \\ mov a2, a10 |
| 153 | 153 | \\ callx0 a9 |
| 154 | \\ | |
| 155 | \\ mov a6, a2 | |
| 154 | 156 | ) else asm volatile ( |
| 155 | 157 | \\ beqz a2, 1f |
| 156 | 158 | \\ // parent |
lib/std/os/windows.zig+6-8| ... | ... | @@ -3645,14 +3645,12 @@ pub fn teb() *TEB { |
| 3645 | 3645 | } |
| 3646 | 3646 | |
| 3647 | 3647 | pub fn peb() *PEB { |
| 3648 | if (builtin.zig_backend == .stage2_c) switch (native_arch) { | |
| 3649 | .x86, .x86_64 => return @ptrCast(@alignCast(struct { | |
| 3650 | /// This is a workaround for the C backend until zig has the ability to put | |
| 3651 | /// C code in inline assembly. | |
| 3652 | extern fn zig_windows_peb() callconv(.c) *anyopaque; | |
| 3653 | }.zig_windows_peb())), | |
| 3654 | else => {}, | |
| 3655 | } else switch (native_arch) { | |
| 3648 | if (builtin.zig_backend == .stage2_c) return @ptrCast(@alignCast(struct { | |
| 3649 | /// This is a workaround for the C backend until zig has the ability to put | |
| 3650 | /// C code in inline assembly. | |
| 3651 | extern fn zig_windows_peb() callconv(.c) *anyopaque; | |
| 3652 | }.zig_windows_peb())); | |
| 3653 | switch (native_arch) { | |
| 3656 | 3654 | .aarch64 => { |
| 3657 | 3655 | comptime assert(@offsetOf(TEB, "ProcessEnvironmentBlock") == 0x60); |
| 3658 | 3656 | return asm ( |
lib/std/start.zig+1-1| ... | ... | @@ -189,7 +189,7 @@ fn _start() callconv(.naked) noreturn { |
| 189 | 189 | .m88k => ".cfi_undefined %%r1", |
| 190 | 190 | .microblaze, .microblazeel => "", // No CFI support. |
| 191 | 191 | .mips, .mipsel, .mips64, .mips64el => ".cfi_undefined $ra", |
| 192 | .or1k => ".cfi_undefined r9", | |
| 192 | .or1k => ".cfi_undefined 9", | |
| 193 | 193 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => ".cfi_undefined lr", |
| 194 | 194 | .riscv32, .riscv32be, .riscv64, .riscv64be => if (builtin.zig_backend == .stage2_riscv64) |
| 195 | 195 | "" |
lib/std/zig/system/loongarch.zig+4-16| ... | ... | @@ -94,21 +94,9 @@ pub fn detectNativeCpuAndFeatures( |
| 94 | 94 | return cpu; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | /// This is a workaround for the C backend until zig has the ability to put | |
| 98 | /// C code in inline assembly. | |
| 99 | extern fn zig_loongarch_cpucfg(word: u32, result: *u32) callconv(.c) void; | |
| 100 | ||
| 101 | 97 | fn cpucfg(word: u32) u32 { |
| 102 | var result: u32 = undefined; | |
| 103 | ||
| 104 | if (builtin.zig_backend == .stage2_c) { | |
| 105 | zig_loongarch_cpucfg(word, &result); | |
| 106 | } else { | |
| 107 | asm ("cpucfg %[result], %[word]" | |
| 108 | : [result] "=r" (result), | |
| 109 | : [word] "r" (word), | |
| 110 | ); | |
| 111 | } | |
| 112 | ||
| 113 | return result; | |
| 98 | return asm ("cpucfg %[result], %[word]" | |
| 99 | : [result] "=r" (-> u32), | |
| 100 | : [word] "r" (word), | |
| 101 | ); | |
| 114 | 102 | } |
lib/zig.h+1-13| ... | ... | @@ -6750,19 +6750,7 @@ static inline void* zig_e_zig_windows_peb(void) { |
| 6750 | 6750 | |
| 6751 | 6751 | #endif |
| 6752 | 6752 | |
| 6753 | #if defined(zig_loongarch) | |
| 6754 | ||
| 6755 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) zig_mangled(zig_e_zig_loongarch_cpucfg, "zig_loongarch_cpucfg"); | |
| 6756 | ||
| 6757 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) { | |
| 6758 | #if defined(zig_gnuc_asm) | |
| 6759 | __asm__("cpucfg %[result], %[word]" : [result] "=r" (*result) : [word] "r" (word)); | |
| 6760 | #else | |
| 6761 | *result = 0; | |
| 6762 | #endif | |
| 6763 | } | |
| 6764 | ||
| 6765 | #elif defined(zig_x86) && !defined(zig_x86_16) | |
| 6753 | #if defined(zig_x86) && !defined(zig_x86_16) | |
| 6766 | 6754 | |
| 6767 | 6755 | static inline void zig_e_zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) zig_mangled(zig_e_zig_x86_cpuid, "zig_x86_cpuid"); |
| 6768 | 6756 | static inline uint32_t zig_e_zig_x86_get_xcr0(void) zig_mangled(zig_e_zig_x86_get_xcr0, "zig_x86_get_xcr0"); |