| ... | ... | @@ -22,6 +22,11 @@ pub fn syscall_pipe(fd: *[2]i32) usize { |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | pub fn syscall_fork() usize { |
| 25 | // Linux/sparc64 fork() returns two values in %o0 and %o1: |
| 26 | // - On the parent's side, %o0 is the child's PID and %o1 is 0. |
| 27 | // - On the child's side, %o0 is the parent's PID and %o1 is 1. |
| 28 | // We need to clear the child's %o0 so that the return values |
| 29 | // conform to the libc convention. |
| 25 | 30 | return asm volatile ( |
| 26 | 31 | \\ t 0x6d |
| 27 | 32 | \\ bcc,pt %%xcc, 1f |
| ... | ... | @@ -29,6 +34,7 @@ pub fn syscall_fork() usize { |
| 29 | 34 | \\ ba 2f |
| 30 | 35 | \\ neg %%o0 |
| 31 | 36 | \\ 1: |
| 37 | \\ # Clear the child's %%o0 |
| 32 | 38 | \\ dec %%o1 |
| 33 | 39 | \\ and %%o1, %%o0, %%o0 |
| 34 | 40 | \\ 2: |