Skip to content

Commit e9ce76b

Browse files
wathiedebradfitz
authored andcommitted
runtime, syscall: use SYSCALL instruction on FreeBSD.
This manually reverts 555da73 from #6372 which implies a minimum FreeBSD version of 8-STABLE. Updates docs to mention new minimum requirement. Fixes #9627 Change-Id: I40ae64be3682d79dd55024e32581e3e5e2be8aa7 Reviewed-on: https://go-review.googlesource.com/3020 Reviewed-by: Minux Ma <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 30e9101 commit e9ce76b

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

doc/install.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ <h2 id="download">Download the Go distribution</h2>
1414

1515
<p>
1616
<a href="https://golang.org/dl/" target="_blank">Official binary
17-
distributions</a> are available for the FreeBSD (release 8 and above), Linux, Mac OS X (Snow Leopard
18-
and above), and Windows operating systems and the 32-bit (<code>386</code>) and
19-
64-bit (<code>amd64</code>) x86 processor architectures.
17+
distributions</a> are available for the FreeBSD (release 8-STABLE and above),
18+
Linux, Mac OS X (Snow Leopard and above), and Windows operating systems and
19+
the 32-bit (<code>386</code>) and 64-bit (<code>amd64</code>) x86 processor
20+
architectures.
2021
</p>
2122

2223
<p>
@@ -44,7 +45,7 @@ <h2 id="requirements">System requirements</h2>
4445
<th align="center">Notes</th>
4546
</tr>
4647
<tr><td colspan="3"><hr></td></tr>
47-
<tr><td>FreeBSD 8 or later</td> <td>amd64, 386, arm</td> <td>Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later</td></tr>
48+
<tr><td>FreeBSD 8-STABLE or later</td> <td>amd64, 386, arm</td> <td>Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later</td></tr>
4849
<tr><td>Linux 2.6.23 or later with glibc</td> <td>amd64, 386, arm</td> <td>CentOS/RHEL 5.x not supported; no binary distribution for ARM yet</td></tr>
4950
<tr><td>Mac OS X 10.6 or later</td> <td>amd64, 386</td> <td>use the gcc<sup>&#8224;</sup> that comes with Xcode<sup>&#8225;</sup></td></tr>
5051
<tr><td>Windows XP or later</td> <td>amd64, 386</td> <td>use MinGW gcc<sup>&#8224;</sup>. No need for cygwin or msys.</td></tr>

src/runtime/sys_freebsd_amd64.s

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,6 @@
1010
#include "go_tls.h"
1111
#include "textflag.h"
1212

13-
// FreeBSD 8, FreeBSD 9, and older versions that I have checked
14-
// do not restore R10 on exit from a "restarted" system call
15-
// if you use the SYSCALL instruction. This means that, for example,
16-
// if a signal arrives while the wait4 system call is executing,
17-
// the wait4 internally returns ERESTART, which makes the kernel
18-
// back up the PC to execute the SYSCALL instruction a second time.
19-
// However, since the kernel does not restore R10, the fourth
20-
// argument to the system call has been lost. (FreeBSD 9 also fails
21-
// to restore the fifth and sixth arguments, R8 and R9, although
22-
// some earlier versions did restore those correctly.)
23-
// The broken code is in fast_syscall in FreeBSD's amd64/amd64/exception.S.
24-
// It restores only DI, SI, DX, AX, and RFLAGS on system call return.
25-
// http://fxr.watson.org/fxr/source/amd64/amd64/exception.S?v=FREEBSD91#L399
26-
//
27-
// The INT $0x80 system call path (int0x80_syscall in FreeBSD's
28-
// amd64/ia32/ia32_exception.S) does not have this problem,
29-
// but it expects the third argument in R10. Instead of rewriting
30-
// all the assembly in this file, #define SYSCALL to a safe simulation
31-
// using INT $0x80.
32-
//
33-
// INT $0x80 is a little slower than SYSCALL, but correctness wins.
34-
//
35-
// See golang.org/issue/6372.
36-
#define SYSCALL MOVQ R10, CX; INT $0x80
37-
3813
TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0
3914
MOVQ addr+0(FP), DI
4015
MOVL mode+8(FP), SI

src/syscall/asm_freebsd_amd64.s

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
// System call support for AMD64, FreeBSD
1313
//
1414

15-
// The SYSCALL variant for invoking system calls is broken in FreeBSD.
16-
// See comment at top of ../runtime/sys_freebsd_amd64.c and
17-
// golang.org/issue/6372.
18-
#define SYSCALL MOVQ R10, CX; INT $0x80
19-
2015
// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
2116
// func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64);
2217
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64)

0 commit comments

Comments
 (0)