From d1865477fb675a1bf60cbbe5c98bd12fb7cbbb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Thu, 4 Jun 2026 00:29:58 +0200 Subject: [PATCH] std.os.linux.sparc64: format inline asm a bit Also remove a redundant frame pointer zeroing in clone(). --- lib/std/os/linux/sparc64.zig | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/lib/std/os/linux/sparc64.zig b/lib/std/os/linux/sparc64.zig index dfd7f6c660c12b0178d8a565efffafb331f152d7..09926745dd2bd9299eacfe2bc61fe9527268229c 100644 --- a/lib/std/os/linux/sparc64.zig +++ b/lib/std/os/linux/sparc64.zig @@ -10,9 +10,9 @@ pub fn syscall0( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); @@ -25,9 +25,9 @@ pub fn syscall1( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -42,9 +42,9 @@ pub fn syscall2( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -61,9 +61,9 @@ pub fn syscall3( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -82,9 +82,9 @@ pub fn syscall4( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -105,9 +105,9 @@ pub fn syscall5( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -130,9 +130,9 @@ pub fn syscall6( return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ neg %%o0 - \\ 1: + \\1: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(number)), [arg1] "{o0}" (arg1), @@ -151,10 +151,10 @@ pub fn syscall_pipe( \\ mov %[arg], %%g3 \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ # Return the error code \\ ba 2f - \\ neg %%o0 + \\ neg %%o0 \\1: \\ st %%o0, [%%g3+0] \\ st %%o1, [%%g3+4] @@ -175,14 +175,14 @@ pub fn syscall_fork() u64 { return asm volatile ( \\ t 0x6d \\ bcc,pt %%xcc, 1f - \\ nop + \\ nop \\ ba 2f - \\ neg %%o0 - \\ 1: + \\ neg %%o0 + \\1: \\ # Clear the child's %%o0 \\ dec %%o1 \\ and %%o1, %%o0, %%o0 - \\ 2: + \\2: : [ret] "={o0}" (-> u64), : [number] "{g1}" (@intFromEnum(SYS.fork)), : .{ .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 { \\ ldx [%%fp + 0x8af], %%o4 \\ t 0x6d \\ bcs,pn %%xcc, 1f - \\ nop + \\ nop \\ # The child pid is returned in o0 while o1 tells if this - \\ # process is # the child (=1) or the parent (=0). + \\ # process is the child (=1) or the parent (=0). \\ brnz %%o1, 2f - \\ nop + \\ nop \\ # Parent process, return the child pid \\ mov %%o0, %%i0 \\ ret - \\ restore + \\ restore \\1: \\ # The syscall failed \\ sub %%g0, %%o0, %%i0 \\ ret - \\ restore + \\ restore \\2: \\ # Child process ); @@ -234,9 +234,8 @@ pub fn clone() callconv(.naked) u64 { \\ mov %%g0, %%i7 \\ \\ # call func(arg) - \\ mov %%g0, %%fp \\ call %%g2 - \\ mov %%g3, %%o0 + \\ mov %%g3, %%o0 \\ # Exit \\ mov 1, %%g1 // SYS_exit \\ t 0x6d -- 2.54.0