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(...@@ -10,9 +10,9 @@ pub fn syscall0(
10 return asm volatile (10 return asm volatile (
11 \\ t 0x6d11 \\ t 0x6d
12 \\ bcc,pt %%xcc, 1f12 \\ bcc,pt %%xcc, 1f
13 \\ nop13 \\ nop
14 \\ neg %%o014 \\ neg %%o0
15 \\ 1:15 \\1:
16 : [ret] "={o0}" (-> u64),16 : [ret] "={o0}" (-> u64),
17 : [number] "{g1}" (@intFromEnum(number)),17 : [number] "{g1}" (@intFromEnum(number)),
18 : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true });18 : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true });
...@@ -25,9 +25,9 @@ pub fn syscall1(...@@ -25,9 +25,9 @@ pub fn syscall1(
25 return asm volatile (25 return asm volatile (
26 \\ t 0x6d26 \\ t 0x6d
27 \\ bcc,pt %%xcc, 1f27 \\ bcc,pt %%xcc, 1f
28 \\ nop28 \\ nop
29 \\ neg %%o029 \\ neg %%o0
30 \\ 1:30 \\1:
31 : [ret] "={o0}" (-> u64),31 : [ret] "={o0}" (-> u64),
32 : [number] "{g1}" (@intFromEnum(number)),32 : [number] "{g1}" (@intFromEnum(number)),
33 [arg1] "{o0}" (arg1),33 [arg1] "{o0}" (arg1),
...@@ -42,9 +42,9 @@ pub fn syscall2(...@@ -42,9 +42,9 @@ pub fn syscall2(
42 return asm volatile (42 return asm volatile (
43 \\ t 0x6d43 \\ t 0x6d
44 \\ bcc,pt %%xcc, 1f44 \\ bcc,pt %%xcc, 1f
45 \\ nop45 \\ nop
46 \\ neg %%o046 \\ neg %%o0
47 \\ 1:47 \\1:
48 : [ret] "={o0}" (-> u64),48 : [ret] "={o0}" (-> u64),
49 : [number] "{g1}" (@intFromEnum(number)),49 : [number] "{g1}" (@intFromEnum(number)),
50 [arg1] "{o0}" (arg1),50 [arg1] "{o0}" (arg1),
...@@ -61,9 +61,9 @@ pub fn syscall3(...@@ -61,9 +61,9 @@ pub fn syscall3(
61 return asm volatile (61 return asm volatile (
62 \\ t 0x6d62 \\ t 0x6d
63 \\ bcc,pt %%xcc, 1f63 \\ bcc,pt %%xcc, 1f
64 \\ nop64 \\ nop
65 \\ neg %%o065 \\ neg %%o0
66 \\ 1:66 \\1:
67 : [ret] "={o0}" (-> u64),67 : [ret] "={o0}" (-> u64),
68 : [number] "{g1}" (@intFromEnum(number)),68 : [number] "{g1}" (@intFromEnum(number)),
69 [arg1] "{o0}" (arg1),69 [arg1] "{o0}" (arg1),
...@@ -82,9 +82,9 @@ pub fn syscall4(...@@ -82,9 +82,9 @@ pub fn syscall4(
82 return asm volatile (82 return asm volatile (
83 \\ t 0x6d83 \\ t 0x6d
84 \\ bcc,pt %%xcc, 1f84 \\ bcc,pt %%xcc, 1f
85 \\ nop85 \\ nop
86 \\ neg %%o086 \\ neg %%o0
87 \\ 1:87 \\1:
88 : [ret] "={o0}" (-> u64),88 : [ret] "={o0}" (-> u64),
89 : [number] "{g1}" (@intFromEnum(number)),89 : [number] "{g1}" (@intFromEnum(number)),
90 [arg1] "{o0}" (arg1),90 [arg1] "{o0}" (arg1),
...@@ -105,9 +105,9 @@ pub fn syscall5(...@@ -105,9 +105,9 @@ pub fn syscall5(
105 return asm volatile (105 return asm volatile (
106 \\ t 0x6d106 \\ t 0x6d
107 \\ bcc,pt %%xcc, 1f107 \\ bcc,pt %%xcc, 1f
108 \\ nop108 \\ nop
109 \\ neg %%o0109 \\ neg %%o0
110 \\ 1:110 \\1:
111 : [ret] "={o0}" (-> u64),111 : [ret] "={o0}" (-> u64),
112 : [number] "{g1}" (@intFromEnum(number)),112 : [number] "{g1}" (@intFromEnum(number)),
113 [arg1] "{o0}" (arg1),113 [arg1] "{o0}" (arg1),
...@@ -130,9 +130,9 @@ pub fn syscall6(...@@ -130,9 +130,9 @@ pub fn syscall6(
130 return asm volatile (130 return asm volatile (
131 \\ t 0x6d131 \\ t 0x6d
132 \\ bcc,pt %%xcc, 1f132 \\ bcc,pt %%xcc, 1f
133 \\ nop133 \\ nop
134 \\ neg %%o0134 \\ neg %%o0
135 \\ 1:135 \\1:
136 : [ret] "={o0}" (-> u64),136 : [ret] "={o0}" (-> u64),
137 : [number] "{g1}" (@intFromEnum(number)),137 : [number] "{g1}" (@intFromEnum(number)),
138 [arg1] "{o0}" (arg1),138 [arg1] "{o0}" (arg1),
...@@ -151,10 +151,10 @@ pub fn syscall_pipe(...@@ -151,10 +151,10 @@ pub fn syscall_pipe(
151 \\ mov %[arg], %%g3151 \\ mov %[arg], %%g3
152 \\ t 0x6d152 \\ t 0x6d
153 \\ bcc,pt %%xcc, 1f153 \\ bcc,pt %%xcc, 1f
154 \\ nop154 \\ nop
155 \\ # Return the error code155 \\ # Return the error code
156 \\ ba 2f156 \\ ba 2f
157 \\ neg %%o0157 \\ neg %%o0
158 \\1:158 \\1:
159 \\ st %%o0, [%%g3+0]159 \\ st %%o0, [%%g3+0]
160 \\ st %%o1, [%%g3+4]160 \\ st %%o1, [%%g3+4]
...@@ -175,14 +175,14 @@ pub fn syscall_fork() u64 {...@@ -175,14 +175,14 @@ pub fn syscall_fork() u64 {
175 return asm volatile (175 return asm volatile (
176 \\ t 0x6d176 \\ t 0x6d
177 \\ bcc,pt %%xcc, 1f177 \\ bcc,pt %%xcc, 1f
178 \\ nop178 \\ nop
179 \\ ba 2f179 \\ ba 2f
180 \\ neg %%o0180 \\ neg %%o0
181 \\ 1:181 \\1:
182 \\ # Clear the child's %%o0182 \\ # Clear the child's %%o0
183 \\ dec %%o1183 \\ dec %%o1
184 \\ and %%o1, %%o0, %%o0184 \\ and %%o1, %%o0, %%o0
185 \\ 2:185 \\2:
186 : [ret] "={o0}" (-> u64),186 : [ret] "={o0}" (-> u64),
187 : [number] "{g1}" (@intFromEnum(SYS.fork)),187 : [number] "{g1}" (@intFromEnum(SYS.fork)),
188 : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true });188 : .{ .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 {...@@ -209,20 +209,20 @@ pub fn clone() callconv(.naked) u64 {
209 \\ ldx [%%fp + 0x8af], %%o4209 \\ ldx [%%fp + 0x8af], %%o4
210 \\ t 0x6d210 \\ t 0x6d
211 \\ bcs,pn %%xcc, 1f211 \\ bcs,pn %%xcc, 1f
212 \\ nop212 \\ nop
213 \\ # The child pid is returned in o0 while o1 tells if this213 \\ # 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).
215 \\ brnz %%o1, 2f215 \\ brnz %%o1, 2f
216 \\ nop216 \\ nop
217 \\ # Parent process, return the child pid217 \\ # Parent process, return the child pid
218 \\ mov %%o0, %%i0218 \\ mov %%o0, %%i0
219 \\ ret219 \\ ret
220 \\ restore220 \\ restore
221 \\1:221 \\1:
222 \\ # The syscall failed222 \\ # The syscall failed
223 \\ sub %%g0, %%o0, %%i0223 \\ sub %%g0, %%o0, %%i0
224 \\ ret224 \\ ret
225 \\ restore225 \\ restore
226 \\2:226 \\2:
227 \\ # Child process227 \\ # Child process
228 );228 );
...@@ -234,9 +234,8 @@ pub fn clone() callconv(.naked) u64 {...@@ -234,9 +234,8 @@ pub fn clone() callconv(.naked) u64 {
234 \\ mov %%g0, %%i7234 \\ mov %%g0, %%i7
235 \\235 \\
236 \\ # call func(arg)236 \\ # call func(arg)
237 \\ mov %%g0, %%fp
238 \\ call %%g2237 \\ call %%g2
239 \\ mov %%g3, %%o0238 \\ mov %%g3, %%o0
240 \\ # Exit239 \\ # Exit
241 \\ mov 1, %%g1 // SYS_exit240 \\ mov 1, %%g1 // SYS_exit
242 \\ t 0x6d241 \\ t 0x6d