| author | |
| committer | |
| log | 6d2c427635dfcdbe5867c5af5194cbe175b85003 |
| tree | 3fe8760fbdc9bfcdf206d47c4adfcff00b24059d |
| parent | 2fc37914da3ff32536394c58478a45844544beeb |
| signature |
With https://codeberg.org/ziglang/zig/issues/35571 accepted, the form used in
the stage2_c prongs is now the preferred form because it does not require the
compiler to emit machine code behind the programmer's back.10 files changed, 91 insertions(+), 197 deletions(-)
lib/std/os/linux/aarch64.zig+6-13| ... | ... | @@ -152,19 +152,12 @@ pub fn clone() callconv(.naked) u64 { |
| 152 | 152 | pub const restore = restore_rt; |
| 153 | 153 | |
| 154 | 154 | pub fn restore_rt() callconv(.naked) noreturn { |
| 155 | switch (builtin.zig_backend) { | |
| 156 | .stage2_c => asm volatile ( | |
| 157 | \\ mov w8, %[number] | |
| 158 | \\ svc #0 | |
| 159 | : | |
| 160 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 161 | ), | |
| 162 | else => asm volatile ( | |
| 163 | \\ svc #0 | |
| 164 | : | |
| 165 | : [number] "{x8}" (@backingInt(SYS.rt_sigreturn)), | |
| 166 | ), | |
| 167 | } | |
| 155 | asm volatile ( | |
| 156 | \\ mov w8, %[number] | |
| 157 | \\ svc #0 | |
| 158 | : | |
| 159 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 160 | ); | |
| 168 | 161 | } |
| 169 | 162 | |
| 170 | 163 | pub const VDSO = struct { |
lib/std/os/linux/arc.zig+6-13| ... | ... | @@ -153,19 +153,12 @@ pub fn clone() callconv(.naked) u32 { |
| 153 | 153 | pub const restore = restore_rt; |
| 154 | 154 | |
| 155 | 155 | pub fn restore_rt() callconv(.naked) noreturn { |
| 156 | switch (builtin.zig_backend) { | |
| 157 | .stage2_c => asm volatile ( | |
| 158 | \\ mov r8, %[number] | |
| 159 | \\ trap_s 0 | |
| 160 | : | |
| 161 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 162 | ), | |
| 163 | else => asm volatile ( | |
| 164 | \\ trap_s 0 | |
| 165 | : | |
| 166 | : [number] "{r8}" (@backingInt(SYS.rt_sigreturn)), | |
| 167 | ), | |
| 168 | } | |
| 156 | asm volatile ( | |
| 157 | \\ mov r8, %[number] | |
| 158 | \\ trap_s 0 | |
| 159 | : | |
| 160 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 161 | ); | |
| 169 | 162 | } |
| 170 | 163 | |
| 171 | 164 | pub const time_t = i64; |
lib/std/os/linux/arm.zig+12-26| ... | ... | @@ -146,35 +146,21 @@ pub fn clone() callconv(.naked) u32 { |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | pub fn restore() callconv(.naked) noreturn { |
| 149 | switch (builtin.zig_backend) { | |
| 150 | .stage2_c => asm volatile ( | |
| 151 | \\ mov r7, %[number] | |
| 152 | \\ svc #0 | |
| 153 | : | |
| 154 | : [number] "I" (@backingInt(SYS.sigreturn)), | |
| 155 | ), | |
| 156 | else => asm volatile ( | |
| 157 | \\ svc #0 | |
| 158 | : | |
| 159 | : [number] "{r7}" (@backingInt(SYS.sigreturn)), | |
| 160 | ), | |
| 161 | } | |
| 149 | asm volatile ( | |
| 150 | \\ mov r7, %[number] | |
| 151 | \\ svc #0 | |
| 152 | : | |
| 153 | : [number] "I" (@backingInt(SYS.sigreturn)), | |
| 154 | ); | |
| 162 | 155 | } |
| 163 | 156 | |
| 164 | 157 | pub fn restore_rt() callconv(.naked) noreturn { |
| 165 | switch (builtin.zig_backend) { | |
| 166 | .stage2_c => asm volatile ( | |
| 167 | \\ mov r7, %[number] | |
| 168 | \\ svc #0 | |
| 169 | : | |
| 170 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 171 | ), | |
| 172 | else => asm volatile ( | |
| 173 | \\ svc #0 | |
| 174 | : | |
| 175 | : [number] "{r7}" (@backingInt(SYS.rt_sigreturn)), | |
| 176 | ), | |
| 177 | } | |
| 158 | asm volatile ( | |
| 159 | \\ mov r7, %[number] | |
| 160 | \\ svc #0 | |
| 161 | : | |
| 162 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 163 | ); | |
| 178 | 164 | } |
| 179 | 165 | |
| 180 | 166 | pub const VDSO = struct { |
lib/std/os/linux/powerpc.zig+12-26| ... | ... | @@ -263,35 +263,21 @@ pub fn clone() callconv(.naked) u32 { |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | pub fn restore() callconv(.naked) noreturn { |
| 266 | switch (builtin.zig_backend) { | |
| 267 | .stage2_c => asm volatile ( | |
| 268 | \\ li 0, %[number] | |
| 269 | \\ sc | |
| 270 | : | |
| 271 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 272 | ), | |
| 273 | else => asm volatile ( | |
| 274 | \\ sc | |
| 275 | : | |
| 276 | : [number] "{r0}" (@backingInt(SYS.sigreturn)), | |
| 277 | ), | |
| 278 | } | |
| 266 | asm volatile ( | |
| 267 | \\ li 0, %[number] | |
| 268 | \\ sc | |
| 269 | : | |
| 270 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 271 | ); | |
| 279 | 272 | } |
| 280 | 273 | |
| 281 | 274 | pub fn restore_rt() callconv(.naked) noreturn { |
| 282 | switch (builtin.zig_backend) { | |
| 283 | .stage2_c => asm volatile ( | |
| 284 | \\ li 0, %[number] | |
| 285 | \\ sc | |
| 286 | : | |
| 287 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 288 | ), | |
| 289 | else => asm volatile ( | |
| 290 | \\ sc | |
| 291 | : | |
| 292 | : [number] "{r0}" (@backingInt(SYS.rt_sigreturn)), | |
| 293 | ), | |
| 294 | } | |
| 275 | asm volatile ( | |
| 276 | \\ li 0, %[number] | |
| 277 | \\ sc | |
| 278 | : | |
| 279 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 280 | ); | |
| 295 | 281 | } |
| 296 | 282 | |
| 297 | 283 | pub const VDSO = struct { |
lib/std/os/linux/powerpc64.zig+12-26| ... | ... | @@ -247,35 +247,21 @@ pub fn clone() callconv(.naked) u64 { |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | pub fn restore() callconv(.naked) noreturn { |
| 250 | switch (builtin.zig_backend) { | |
| 251 | .stage2_c => asm volatile ( | |
| 252 | \\ li 0, %[number] | |
| 253 | \\ sc | |
| 254 | : | |
| 255 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 256 | ), | |
| 257 | else => asm volatile ( | |
| 258 | \\ sc | |
| 259 | : | |
| 260 | : [number] "{r0}" (@backingInt(SYS.sigreturn)), | |
| 261 | ), | |
| 262 | } | |
| 250 | asm volatile ( | |
| 251 | \\ li 0, %[number] | |
| 252 | \\ sc | |
| 253 | : | |
| 254 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 255 | ); | |
| 263 | 256 | } |
| 264 | 257 | |
| 265 | 258 | pub fn restore_rt() callconv(.naked) noreturn { |
| 266 | switch (builtin.zig_backend) { | |
| 267 | .stage2_c => asm volatile ( | |
| 268 | \\ li 0, %[number] | |
| 269 | \\ sc | |
| 270 | : | |
| 271 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 272 | ), | |
| 273 | else => asm volatile ( | |
| 274 | \\ sc | |
| 275 | : | |
| 276 | : [number] "{r0}" (@backingInt(SYS.rt_sigreturn)), | |
| 277 | ), | |
| 278 | } | |
| 259 | asm volatile ( | |
| 260 | \\ li 0, %[number] | |
| 261 | \\ sc | |
| 262 | : | |
| 263 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 264 | ); | |
| 279 | 265 | } |
| 280 | 266 | |
| 281 | 267 | pub const VDSO = struct { |
lib/std/os/linux/s390x.zig+12-26| ... | ... | @@ -174,35 +174,21 @@ pub fn clone() callconv(.naked) u64 { |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | pub fn restore() callconv(.naked) noreturn { |
| 177 | switch (builtin.zig_backend) { | |
| 178 | .stage2_c => asm volatile ( | |
| 179 | \\lghi %%r1, %[number] | |
| 180 | \\svc 0 | |
| 181 | : | |
| 182 | : [number] "K" (@backingInt(SYS.sigreturn)), | |
| 183 | ), | |
| 184 | else => asm volatile ( | |
| 185 | \\svc 0 | |
| 186 | : | |
| 187 | : [number] "{r1}" (@backingInt(SYS.sigreturn)), | |
| 188 | ), | |
| 189 | } | |
| 177 | asm volatile ( | |
| 178 | \\lghi %%r1, %[number] | |
| 179 | \\svc 0 | |
| 180 | : | |
| 181 | : [number] "K" (@backingInt(SYS.sigreturn)), | |
| 182 | ); | |
| 190 | 183 | } |
| 191 | 184 | |
| 192 | 185 | pub fn restore_rt() callconv(.naked) noreturn { |
| 193 | switch (builtin.zig_backend) { | |
| 194 | .stage2_c => asm volatile ( | |
| 195 | \\lghi %%r1, %[number] | |
| 196 | \\svc 0 | |
| 197 | : | |
| 198 | : [number] "K" (@backingInt(SYS.rt_sigreturn)), | |
| 199 | ), | |
| 200 | else => asm volatile ( | |
| 201 | \\svc 0 | |
| 202 | : | |
| 203 | : [number] "{r1}" (@backingInt(SYS.rt_sigreturn)), | |
| 204 | ), | |
| 205 | } | |
| 186 | asm volatile ( | |
| 187 | \\lghi %%r1, %[number] | |
| 188 | \\svc 0 | |
| 189 | : | |
| 190 | : [number] "K" (@backingInt(SYS.rt_sigreturn)), | |
| 191 | ); | |
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | pub const time_t = i64; |
lib/std/os/linux/x32.zig+6-13| ... | ... | @@ -160,19 +160,12 @@ pub fn clone() callconv(.naked) u32 { |
| 160 | 160 | pub const restore = restore_rt; |
| 161 | 161 | |
| 162 | 162 | pub fn restore_rt() callconv(.naked) noreturn { |
| 163 | switch (builtin.zig_backend) { | |
| 164 | .stage2_c => asm volatile ( | |
| 165 | \\ movl %[number], %%eax | |
| 166 | \\ syscall | |
| 167 | : | |
| 168 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 169 | ), | |
| 170 | else => asm volatile ( | |
| 171 | \\ syscall | |
| 172 | : | |
| 173 | : [number] "{rax}" (@backingInt(SYS.rt_sigreturn)), | |
| 174 | ), | |
| 175 | } | |
| 163 | asm volatile ( | |
| 164 | \\ movl %[number], %%eax | |
| 165 | \\ syscall | |
| 166 | : | |
| 167 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 168 | ); | |
| 176 | 169 | } |
| 177 | 170 | |
| 178 | 171 | pub const time_t = i64; |
lib/std/os/linux/x86.zig+13-28| ... | ... | @@ -186,37 +186,22 @@ pub fn clone() callconv(.naked) u32 { |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | pub fn restore() callconv(.naked) noreturn { |
| 189 | switch (builtin.zig_backend) { | |
| 190 | .stage2_c => asm volatile ( | |
| 191 | \\ addl $4, %%esp | |
| 192 | \\ movl %[number], %%eax | |
| 193 | \\ int $0x80 | |
| 194 | : | |
| 195 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 196 | ), | |
| 197 | else => asm volatile ( | |
| 198 | \\ addl $4, %%esp | |
| 199 | \\ int $0x80 | |
| 200 | : | |
| 201 | : [number] "{eax}" (@backingInt(SYS.sigreturn)), | |
| 202 | ), | |
| 203 | } | |
| 189 | asm volatile ( | |
| 190 | \\ addl $4, %%esp | |
| 191 | \\ movl %[number], %%eax | |
| 192 | \\ int $0x80 | |
| 193 | : | |
| 194 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 195 | ); | |
| 204 | 196 | } |
| 205 | 197 | |
| 206 | 198 | pub fn restore_rt() callconv(.naked) noreturn { |
| 207 | switch (builtin.zig_backend) { | |
| 208 | .stage2_c => asm volatile ( | |
| 209 | \\ movl %[number], %%eax | |
| 210 | \\ int $0x80 | |
| 211 | : | |
| 212 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 213 | ), | |
| 214 | else => asm volatile ( | |
| 215 | \\ int $0x80 | |
| 216 | : | |
| 217 | : [number] "{eax}" (@backingInt(SYS.rt_sigreturn)), | |
| 218 | ), | |
| 219 | } | |
| 199 | asm volatile ( | |
| 200 | \\ movl %[number], %%eax | |
| 201 | \\ int $0x80 | |
| 202 | : | |
| 203 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 204 | ); | |
| 220 | 205 | } |
| 221 | 206 | |
| 222 | 207 | pub const VDSO = struct { |
lib/std/os/linux/x86_64.zig+6-13| ... | ... | @@ -146,19 +146,12 @@ pub fn clone() callconv(.naked) u64 { |
| 146 | 146 | pub const restore = restore_rt; |
| 147 | 147 | |
| 148 | 148 | pub fn restore_rt() callconv(.naked) noreturn { |
| 149 | switch (builtin.zig_backend) { | |
| 150 | .stage2_c => asm volatile ( | |
| 151 | \\ movl %[number], %%eax | |
| 152 | \\ syscall | |
| 153 | : | |
| 154 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 155 | ), | |
| 156 | else => asm volatile ( | |
| 157 | \\ syscall | |
| 158 | : | |
| 159 | : [number] "{rax}" (@backingInt(SYS.rt_sigreturn)), | |
| 160 | ), | |
| 161 | } | |
| 149 | asm volatile ( | |
| 150 | \\ movl %[number], %%eax | |
| 151 | \\ syscall | |
| 152 | : | |
| 153 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 154 | ); | |
| 162 | 155 | } |
| 163 | 156 | |
| 164 | 157 | pub const time_t = i64; |
lib/std/os/linux/xtensa.zig+6-13| ... | ... | @@ -173,19 +173,12 @@ pub fn clone() callconv(.naked) u32 { |
| 173 | 173 | pub const restore = restore_rt; |
| 174 | 174 | |
| 175 | 175 | pub fn restore_rt() callconv(.naked) noreturn { |
| 176 | switch (builtin.zig_backend) { | |
| 177 | .stage2_c => asm volatile ( | |
| 178 | \\ movi a2, %[number] | |
| 179 | \\ syscall | |
| 180 | : | |
| 181 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 182 | ), | |
| 183 | else => asm volatile ( | |
| 184 | \\ syscall | |
| 185 | : | |
| 186 | : [number] "{a2}" (@backingInt(SYS.rt_sigreturn)), | |
| 187 | ), | |
| 188 | } | |
| 176 | asm volatile ( | |
| 177 | \\ movi a2, %[number] | |
| 178 | \\ syscall | |
| 179 | : | |
| 180 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 181 | ); | |
| 189 | 182 | } |
| 190 | 183 | |
| 191 | 184 | pub const VDSO = void; |