diff options
author | Bill Thiede <couchmoney@gmail.com> | 2015-01-17 21:09:15 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2015-01-18 23:51:50 +0000 |
commit | e9ce76b0eca8fa95dddb90b0a72aadab58de2ffc (patch) | |
tree | cf93ff0326d2736d2dbcea8816a2408423ac959b /src/runtime/sys_freebsd_amd64.s | |
parent | 30e910197a87773cec9ca53b4e0e5f6114bbd9bf (diff) | |
download | go-e9ce76b0eca8fa95dddb90b0a72aadab58de2ffc.tar.gz go-e9ce76b0eca8fa95dddb90b0a72aadab58de2ffc.zip |
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 <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_freebsd_amd64.s')
-rw-r--r-- | src/runtime/sys_freebsd_amd64.s | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/runtime/sys_freebsd_amd64.s b/src/runtime/sys_freebsd_amd64.s index 84cee51d8c..400c1845be 100644 --- a/src/runtime/sys_freebsd_amd64.s +++ b/src/runtime/sys_freebsd_amd64.s @@ -10,31 +10,6 @@ #include "go_tls.h" #include "textflag.h" -// FreeBSD 8, FreeBSD 9, and older versions that I have checked -// do not restore R10 on exit from a "restarted" system call -// if you use the SYSCALL instruction. This means that, for example, -// if a signal arrives while the wait4 system call is executing, -// the wait4 internally returns ERESTART, which makes the kernel -// back up the PC to execute the SYSCALL instruction a second time. -// However, since the kernel does not restore R10, the fourth -// argument to the system call has been lost. (FreeBSD 9 also fails -// to restore the fifth and sixth arguments, R8 and R9, although -// some earlier versions did restore those correctly.) -// The broken code is in fast_syscall in FreeBSD's amd64/amd64/exception.S. -// It restores only DI, SI, DX, AX, and RFLAGS on system call return. -// http://fxr.watson.org/fxr/source/amd64/amd64/exception.S?v=FREEBSD91#L399 -// -// The INT $0x80 system call path (int0x80_syscall in FreeBSD's -// amd64/ia32/ia32_exception.S) does not have this problem, -// but it expects the third argument in R10. Instead of rewriting -// all the assembly in this file, #define SYSCALL to a safe simulation -// using INT $0x80. -// -// INT $0x80 is a little slower than SYSCALL, but correctness wins. -// -// See golang.org/issue/6372. -#define SYSCALL MOVQ R10, CX; INT $0x80 - TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0 MOVQ addr+0(FP), DI MOVL mode+8(FP), SI |