authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-06-04 00:29:58+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-06-04 00:54:35+02:00
logd1865477fb675a1bf60cbbe5c98bd12fb7cbbb8f
treecb0ecf4818a6f3a077a9e5bf0db29da9a11da17c
parentfe1ee47bd7798f63c6ce9af89b12429a95adaeca
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux.sparc64: format inline asm a bit

Also remove a redundant frame pointer zeroing in clone().

1 files changed, 26 insertions(+), 27 deletions(-)

lib/std/os/linux/sparc64.zig+26-27
......@@ -10,9 +10,9 @@ pub fn syscall0(
1010 return asm volatile (
1111 \\ t 0x6d
1212 \\ bcc,pt %%xcc, 1f
13 \\ nop
13 \\ nop
1414 \\ neg %%o0
15 \\ 1:
15 \\1:
1616 : [ret] "={o0}" (-> u64),
1717 : [number] "{g1}" (@intFromEnum(number)),
1818 : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true });
......@@ -25,9 +25,9 @@ pub fn syscall1(
2525 return asm volatile (
2626 \\ t 0x6d
2727 \\ bcc,pt %%xcc, 1f
28 \\ nop
28 \\ nop
2929 \\ neg %%o0
30 \\ 1:
30 \\1:
3131 : [ret] "={o0}" (-> u64),
3232 : [number] "{g1}" (@intFromEnum(number)),
3333 [arg1] "{o0}" (arg1),
......@@ -42,9 +42,9 @@ pub fn syscall2(
4242 return asm volatile (
4343 \\ t 0x6d
4444 \\ bcc,pt %%xcc, 1f
45 \\ nop
45 \\ nop
4646 \\ neg %%o0
47 \\ 1:
47 \\1:
4848 : [ret] "={o0}" (-> u64),
4949 : [number] "{g1}" (@intFromEnum(number)),
5050 [arg1] "{o0}" (arg1),
......@@ -61,9 +61,9 @@ pub fn syscall3(
6161 return asm volatile (
6262 \\ t 0x6d
6363 \\ bcc,pt %%xcc, 1f
64 \\ nop
64 \\ nop
6565 \\ neg %%o0
66 \\ 1:
66 \\1:
6767 : [ret] "={o0}" (-> u64),
6868 : [number] "{g1}" (@intFromEnum(number)),
6969 [arg1] "{o0}" (arg1),
......@@ -82,9 +82,9 @@ pub fn syscall4(
8282 return asm volatile (
8383 \\ t 0x6d
8484 \\ bcc,pt %%xcc, 1f
85 \\ nop
85 \\ nop
8686 \\ neg %%o0
87 \\ 1:
87 \\1:
8888 : [ret] "={o0}" (-> u64),
8989 : [number] "{g1}" (@intFromEnum(number)),
9090 [arg1] "{o0}" (arg1),
......@@ -105,9 +105,9 @@ pub fn syscall5(
105105 return asm volatile (
106106 \\ t 0x6d
107107 \\ bcc,pt %%xcc, 1f
108 \\ nop
108 \\ nop
109109 \\ neg %%o0
110 \\ 1:
110 \\1:
111111 : [ret] "={o0}" (-> u64),
112112 : [number] "{g1}" (@intFromEnum(number)),
113113 [arg1] "{o0}" (arg1),
......@@ -130,9 +130,9 @@ pub fn syscall6(
130130 return asm volatile (
131131 \\ t 0x6d
132132 \\ bcc,pt %%xcc, 1f
133 \\ nop
133 \\ nop
134134 \\ neg %%o0
135 \\ 1:
135 \\1:
136136 : [ret] "={o0}" (-> u64),
137137 : [number] "{g1}" (@intFromEnum(number)),
138138 [arg1] "{o0}" (arg1),
......@@ -151,10 +151,10 @@ pub fn syscall_pipe(
151151 \\ mov %[arg], %%g3
152152 \\ t 0x6d
153153 \\ bcc,pt %%xcc, 1f
154 \\ nop
154 \\ nop
155155 \\ # Return the error code
156156 \\ ba 2f
157 \\ neg %%o0
157 \\ neg %%o0
158158 \\1:
159159 \\ st %%o0, [%%g3+0]
160160 \\ st %%o1, [%%g3+4]
......@@ -175,14 +175,14 @@ pub fn syscall_fork() u64 {
175175 return asm volatile (
176176 \\ t 0x6d
177177 \\ bcc,pt %%xcc, 1f
178 \\ nop
178 \\ nop
179179 \\ ba 2f
180 \\ neg %%o0
181 \\ 1:
180 \\ neg %%o0
181 \\1:
182182 \\ # Clear the child's %%o0
183183 \\ dec %%o1
184184 \\ and %%o1, %%o0, %%o0
185 \\ 2:
185 \\2:
186186 : [ret] "={o0}" (-> u64),
187187 : [number] "{g1}" (@intFromEnum(SYS.fork)),
188188 : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true });
......@@ -209,20 +209,20 @@ pub fn clone() callconv(.naked) u64 {
209209 \\ ldx [%%fp + 0x8af], %%o4
210210 \\ t 0x6d
211211 \\ bcs,pn %%xcc, 1f
212 \\ nop
212 \\ nop
213213 \\ # The child pid is returned in o0 while o1 tells if this
214 \\ # process is # the child (=1) or the parent (=0).
214 \\ # process is the child (=1) or the parent (=0).
215215 \\ brnz %%o1, 2f
216 \\ nop
216 \\ nop
217217 \\ # Parent process, return the child pid
218218 \\ mov %%o0, %%i0
219219 \\ ret
220 \\ restore
220 \\ restore
221221 \\1:
222222 \\ # The syscall failed
223223 \\ sub %%g0, %%o0, %%i0
224224 \\ ret
225 \\ restore
225 \\ restore
226226 \\2:
227227 \\ # Child process
228228 );
......@@ -234,9 +234,8 @@ pub fn clone() callconv(.naked) u64 {
234234 \\ mov %%g0, %%i7
235235 \\
236236 \\ # call func(arg)
237 \\ mov %%g0, %%fp
238237 \\ call %%g2
239 \\ mov %%g3, %%o0
238 \\ mov %%g3, %%o0
240239 \\ # Exit
241240 \\ mov 1, %%g1 // SYS_exit
242241 \\ t 0x6d