authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2020-08-28 21:01:39+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2020-10-24 20:01:32+07:00
logdba009fd21f76759e41158909b558a7f9955daa0
tree4cd55eab6de42c5cfcd8e613aa3603abf43f56ad
parentc29da84c0e0793683904a32deb8a7eff1ba98b54

Account for the delay slot


1 files changed, 7 insertions(+), 8 deletions(-)

lib/std/os/linux/sparc64.zig+7-8
......@@ -1,18 +1,11 @@
11usingnamespace @import("../bits.zig");
22
3// TODO: Handle the case of pipe(2) returning multiple values.
4// From syscall(2)'s manual page:
5// Some architectures (namely, Alpha, IA-64, MIPS, SuperH, sparc/32, and sparc/64)
6// use an additional register ("Retval2" in the above table) to pass back a second
7// return value from the pipe(2) system call; Alpha uses this technique in the
8// architecture-specific getxpid(2), getxuid(2), and getxgid(2) system calls
9// as well. Other architectures do not use the second return value register in
10// the system call interface, even if it is defined in the System V ABI.
113
124pub fn syscall0(number: SYS) usize {
135 return asm volatile (
146 \\ t 0x6d
157 \\ bcc %%xcc, 1f
8 \\ nop
169 \\ neg %%o0
1710 \\ 1:
1811 : [ret] "={o0}" (-> usize)
......@@ -25,6 +18,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize {
2518 return asm volatile (
2619 \\ t 0x6d
2720 \\ bcc %%xcc, 1f
21 \\ nop
2822 \\ neg %%o0
2923 \\ 1:
3024 : [ret] "={o0}" (-> usize)
......@@ -38,6 +32,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
3832 return asm volatile (
3933 \\ t 0x6d
4034 \\ bcc %%xcc, 1f
35 \\ nop
4136 \\ neg %%o0
4237 \\ 1:
4338 : [ret] "={o0}" (-> usize)
......@@ -52,6 +47,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
5247 return asm volatile (
5348 \\ t 0x6d
5449 \\ bcc %%xcc, 1f
50 \\ nop
5551 \\ neg %%o0
5652 \\ 1:
5753 : [ret] "={o0}" (-> usize)
......@@ -67,6 +63,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize)
6763 return asm volatile (
6864 \\ t 0x6d
6965 \\ bcc %%xcc, 1f
66 \\ nop
7067 \\ neg %%o0
7168 \\ 1:
7269 : [ret] "={o0}" (-> usize)
......@@ -83,6 +80,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize,
8380 return asm volatile (
8481 \\ t 0x6d
8582 \\ bcc %%xcc, 1f
83 \\ nop
8684 \\ neg %%o0
8785 \\ 1:
8886 : [ret] "={o0}" (-> usize)
......@@ -108,6 +106,7 @@ pub fn syscall6(
108106 return asm volatile (
109107 \\ t 0x6d
110108 \\ bcc %%xcc, 1f
109 \\ nop
111110 \\ neg %%o0
112111 \\ 1:
113112 : [ret] "={o0}" (-> usize)