2010-10-18 10:32:55 -06:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2011-12-19 13:51:13 -07:00
|
|
|
#include "zasm_GOOS_GOARCH.h"
|
2010-10-18 10:32:55 -06:00
|
|
|
|
|
|
|
// setldt(int entry, int address, int limit)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·setldt(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
RET
|
|
|
|
|
2011-06-10 01:23:54 -06:00
|
|
|
TEXT runtime·open(SB),7,$0
|
|
|
|
MOVL $14, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
2011-11-17 20:09:28 -07:00
|
|
|
TEXT runtime·pread(SB),7,$0
|
|
|
|
MOVL $50, AX
|
|
|
|
INT $64
|
2011-10-05 10:07:44 -06:00
|
|
|
RET
|
|
|
|
|
2011-11-17 20:09:28 -07:00
|
|
|
TEXT runtime·pwrite(SB),7,$0
|
|
|
|
MOVL $51, AX
|
|
|
|
INT $64
|
2011-10-05 10:07:44 -06:00
|
|
|
RET
|
|
|
|
|
2012-12-17 09:07:40 -07:00
|
|
|
TEXT runtime·seek(SB),7,$0
|
|
|
|
MOVL $39, AX
|
|
|
|
INT $64
|
|
|
|
CMPL AX, $-1
|
|
|
|
JNE 4(PC)
|
|
|
|
MOVL a+0(FP), CX
|
|
|
|
MOVL AX, 0(CX)
|
|
|
|
MOVL AX, 4(CX)
|
|
|
|
RET
|
|
|
|
|
2011-10-05 10:07:44 -06:00
|
|
|
TEXT runtime·close(SB),7,$0
|
|
|
|
MOVL $4, AX
|
2012-12-17 09:07:40 -07:00
|
|
|
INT $64
|
2010-10-18 10:32:55 -06:00
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·exits(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL $8, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·brk_(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL $24, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
2011-10-05 10:07:44 -06:00
|
|
|
TEXT runtime·sleep(SB),7,$0
|
|
|
|
MOVL $17, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·plan9_semacquire(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL $37, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
2012-05-04 04:48:34 -06:00
|
|
|
|
2012-05-16 16:09:28 -06:00
|
|
|
TEXT runtime·plan9_tsemacquire(SB),7,$0
|
|
|
|
MOVL $52, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
2012-05-04 04:48:34 -06:00
|
|
|
TEXT runtime·notify(SB),7,$0
|
|
|
|
MOVL $28, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
|
|
|
TEXT runtime·noted(SB),7,$0
|
|
|
|
MOVL $29, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
2010-10-18 10:32:55 -06:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·plan9_semrelease(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL $38, AX
|
|
|
|
INT $64
|
|
|
|
RET
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
TEXT runtime·rfork(SB),7,$0
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL $19, AX // rfork
|
|
|
|
INT $64
|
|
|
|
|
|
|
|
// In parent, return.
|
|
|
|
CMPL AX, $0
|
|
|
|
JEQ 2(PC)
|
|
|
|
RET
|
|
|
|
|
|
|
|
// In child on old stack.
|
|
|
|
MOVL mm+12(SP), BX // m
|
|
|
|
MOVL gg+16(SP), DX // g
|
|
|
|
MOVL fn+20(SP), SI // fn
|
|
|
|
|
|
|
|
// set SP to be on the new child stack
|
|
|
|
MOVL stack+8(SP), CX
|
|
|
|
MOVL CX, SP
|
|
|
|
|
|
|
|
// Initialize m, g.
|
|
|
|
get_tls(AX)
|
|
|
|
MOVL DX, g(AX)
|
|
|
|
MOVL BX, m(AX)
|
|
|
|
|
2013-01-30 03:53:56 -07:00
|
|
|
// Initialize AX from TOS struct.
|
|
|
|
MOVL procid(AX), AX
|
2010-10-18 10:32:55 -06:00
|
|
|
MOVL AX, m_procid(BX) // save pid as m->procid
|
2011-02-11 11:39:05 -07:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·stackcheck(SB) // smashes AX, CX
|
2010-10-18 10:32:55 -06:00
|
|
|
|
|
|
|
MOVL 0(DX), DX // paranoia; check they are not nil
|
|
|
|
MOVL 0(BX), BX
|
|
|
|
|
|
|
|
// more paranoia; check that stack splitting code works
|
2011-11-17 20:09:28 -07:00
|
|
|
PUSHL SI
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·emptyfunc(SB)
|
2011-11-17 20:09:28 -07:00
|
|
|
POPL SI
|
2010-10-18 10:32:55 -06:00
|
|
|
|
|
|
|
CALL SI // fn()
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
CALL runtime·exit(SB)
|
2010-10-18 10:32:55 -06:00
|
|
|
RET
|
2012-10-05 14:23:30 -06:00
|
|
|
|
2013-01-30 03:53:56 -07:00
|
|
|
// void sigtramp(void *ureg, int8 *note)
|
|
|
|
TEXT runtime·sigtramp(SB),7,$0
|
|
|
|
get_tls(AX)
|
|
|
|
|
|
|
|
// check that m exists
|
|
|
|
MOVL m(AX), BX
|
|
|
|
CMPL BX, $0
|
|
|
|
JNE 3(PC)
|
2013-07-11 14:39:39 -06:00
|
|
|
CALL runtime·badsignal2(SB) // will exit
|
2013-01-30 03:53:56 -07:00
|
|
|
RET
|
|
|
|
|
|
|
|
// save args
|
|
|
|
MOVL ureg+4(SP), CX
|
|
|
|
MOVL note+8(SP), DX
|
|
|
|
|
|
|
|
// change stack
|
|
|
|
MOVL m_gsignal(BX), BP
|
|
|
|
MOVL g_stackbase(BP), BP
|
|
|
|
MOVL BP, SP
|
|
|
|
|
|
|
|
// make room for args and g
|
|
|
|
SUBL $16, SP
|
|
|
|
|
|
|
|
// save g
|
|
|
|
MOVL g(AX), BP
|
|
|
|
MOVL BP, 12(SP)
|
|
|
|
|
|
|
|
// g = m->gsignal
|
|
|
|
MOVL m_gsignal(BX), DI
|
|
|
|
MOVL DI, g(AX)
|
|
|
|
|
|
|
|
// load args and call sighandler
|
|
|
|
MOVL CX, 0(SP)
|
|
|
|
MOVL DX, 4(SP)
|
|
|
|
MOVL BP, 8(SP)
|
|
|
|
|
|
|
|
CALL runtime·sighandler(SB)
|
|
|
|
|
|
|
|
// restore g
|
|
|
|
get_tls(BX)
|
|
|
|
MOVL 12(SP), BP
|
|
|
|
MOVL BP, g(BX)
|
|
|
|
|
|
|
|
// call noted(AX)
|
|
|
|
MOVL AX, 0(SP)
|
|
|
|
CALL runtime·noted(SB)
|
|
|
|
RET
|
|
|
|
|
2012-10-05 14:23:30 -06:00
|
|
|
// Only used by the 64-bit runtime.
|
|
|
|
TEXT runtime·setfpmasks(SB),7,$0
|
|
|
|
RET
|
2013-03-07 16:54:44 -07:00
|
|
|
|
|
|
|
#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
|
2013-03-08 21:39:15 -07:00
|
|
|
|
|
|
|
// syscall requires caller-save
|
|
|
|
MOVL 4(SP), CX
|
|
|
|
|
|
|
|
// push the argument
|
|
|
|
PUSHL CX
|
2013-03-07 16:54:44 -07:00
|
|
|
CALL runtime·findnull(SB)
|
2013-03-08 21:39:15 -07:00
|
|
|
POPL CX
|
2013-03-07 16:54:44 -07:00
|
|
|
MOVL AX, 8(SP)
|
|
|
|
RET
|