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 @@...@@ -1,18 +1,11 @@
1usingnamespace @import("../bits.zig");1usingnamespace @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
12pub fn syscall0(number: SYS) usize {4pub fn syscall0(number: SYS) usize {
13 return asm volatile (5 return asm volatile (
14 \\ t 0x6d6 \\ t 0x6d
15 \\ bcc %%xcc, 1f7 \\ bcc %%xcc, 1f
8 \\ nop
16 \\ neg %%o09 \\ neg %%o0
17 \\ 1:10 \\ 1:
18 : [ret] "={o0}" (-> usize)11 : [ret] "={o0}" (-> usize)
...@@ -25,6 +18,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize {...@@ -25,6 +18,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize {
25 return asm volatile (18 return asm volatile (
26 \\ t 0x6d19 \\ t 0x6d
27 \\ bcc %%xcc, 1f20 \\ bcc %%xcc, 1f
21 \\ nop
28 \\ neg %%o022 \\ neg %%o0
29 \\ 1:23 \\ 1:
30 : [ret] "={o0}" (-> usize)24 : [ret] "={o0}" (-> usize)
...@@ -38,6 +32,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {...@@ -38,6 +32,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
38 return asm volatile (32 return asm volatile (
39 \\ t 0x6d33 \\ t 0x6d
40 \\ bcc %%xcc, 1f34 \\ bcc %%xcc, 1f
35 \\ nop
41 \\ neg %%o036 \\ neg %%o0
42 \\ 1:37 \\ 1:
43 : [ret] "={o0}" (-> usize)38 : [ret] "={o0}" (-> usize)
...@@ -52,6 +47,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {...@@ -52,6 +47,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
52 return asm volatile (47 return asm volatile (
53 \\ t 0x6d48 \\ t 0x6d
54 \\ bcc %%xcc, 1f49 \\ bcc %%xcc, 1f
50 \\ nop
55 \\ neg %%o051 \\ neg %%o0
56 \\ 1:52 \\ 1:
57 : [ret] "={o0}" (-> usize)53 : [ret] "={o0}" (-> usize)
...@@ -67,6 +63,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize)...@@ -67,6 +63,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize)
67 return asm volatile (63 return asm volatile (
68 \\ t 0x6d64 \\ t 0x6d
69 \\ bcc %%xcc, 1f65 \\ bcc %%xcc, 1f
66 \\ nop
70 \\ neg %%o067 \\ neg %%o0
71 \\ 1:68 \\ 1:
72 : [ret] "={o0}" (-> usize)69 : [ret] "={o0}" (-> usize)
...@@ -83,6 +80,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize,...@@ -83,6 +80,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize,
83 return asm volatile (80 return asm volatile (
84 \\ t 0x6d81 \\ t 0x6d
85 \\ bcc %%xcc, 1f82 \\ bcc %%xcc, 1f
83 \\ nop
86 \\ neg %%o084 \\ neg %%o0
87 \\ 1:85 \\ 1:
88 : [ret] "={o0}" (-> usize)86 : [ret] "={o0}" (-> usize)
...@@ -108,6 +106,7 @@ pub fn syscall6(...@@ -108,6 +106,7 @@ pub fn syscall6(
108 return asm volatile (106 return asm volatile (
109 \\ t 0x6d107 \\ t 0x6d
110 \\ bcc %%xcc, 1f108 \\ bcc %%xcc, 1f
109 \\ nop
111 \\ neg %%o0110 \\ neg %%o0
112 \\ 1:111 \\ 1:
113 : [ret] "={o0}" (-> usize)112 : [ret] "={o0}" (-> usize)