summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/sys_plan9_386.s
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2013-03-23 11:28:53 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-23 11:28:53 +0100
commitb39e15dde5ec7b96c15da9faf4ab5892501c1aae (patch)
tree718cede1f6ca97d082c6c40b7dc3f4f6148253c0 /src/pkg/runtime/sys_plan9_386.s
parent04b08da9af0c450d645ab7389d1467308cfc2db8 (diff)
downloadgolang-upstream/1.1_hg20130323.tar.gz
Imported Upstream version 1.1~hg20130323upstream/1.1_hg20130323
Diffstat (limited to 'src/pkg/runtime/sys_plan9_386.s')
-rw-r--r--src/pkg/runtime/sys_plan9_386.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pkg/runtime/sys_plan9_386.s b/src/pkg/runtime/sys_plan9_386.s
index 3385b083a..1f860a961 100644
--- a/src/pkg/runtime/sys_plan9_386.s
+++ b/src/pkg/runtime/sys_plan9_386.s
@@ -170,3 +170,30 @@ TEXT runtime·sigtramp(SB),7,$0
// Only used by the 64-bit runtime.
TEXT runtime·setfpmasks(SB),7,$0
RET
+
+#define ERRMAX 128 /* from os_plan9.h */
+
+// func errstr() String
+// Only used by package syscall.
+// Grab error string due to a syscall made
+// in entersyscall mode, without going
+// through the allocator (issue 4994).
+// See ../syscall/asm_plan9_386.s:/·Syscall/
+TEXT runtime·errstr(SB),7,$0
+ get_tls(AX)
+ MOVL m(AX), BX
+ MOVL m_errstr(BX), CX
+ MOVL CX, 4(SP)
+ MOVL $ERRMAX, 8(SP)
+ MOVL $41, AX
+ INT $64
+
+ // syscall requires caller-save
+ MOVL 4(SP), CX
+
+ // push the argument
+ PUSHL CX
+ CALL runtime·findnull(SB)
+ POPL CX
+ MOVL AX, 8(SP)
+ RET