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.
|
|
|
|
|
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
|
|
|
extern int32 runtime·write(int32 fd, void* buffer, int32 nbytes);
|
|
|
|
extern void runtime·exits(int8* msg);
|
|
|
|
extern int32 runtime·brk_(void*);
|
2010-10-18 10:32:55 -06:00
|
|
|
|
2011-06-10 01:23:54 -06:00
|
|
|
/* open */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
OREAD = 0,
|
|
|
|
OWRITE = 1,
|
|
|
|
ORDWR = 2
|
|
|
|
};
|
|
|
|
|
2010-10-18 10:32:55 -06:00
|
|
|
/* rfork */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RFNAMEG = (1<<0),
|
|
|
|
RFENVG = (1<<1),
|
|
|
|
RFFDG = (1<<2),
|
|
|
|
RFNOTEG = (1<<3),
|
|
|
|
RFPROC = (1<<4),
|
|
|
|
RFMEM = (1<<5),
|
|
|
|
RFNOWAIT = (1<<6),
|
|
|
|
RFCNAMEG = (1<<10),
|
|
|
|
RFCENVG = (1<<11),
|
|
|
|
RFCFDG = (1<<12),
|
|
|
|
RFREND = (1<<13),
|
|
|
|
RFNOMNT = (1<<14)
|
|
|
|
};
|
2011-06-10 01:23:54 -06:00
|
|
|
|
|
|
|
typedef struct Tos Tos;
|
|
|
|
typedef intptr Plink;
|
|
|
|
|
|
|
|
struct Tos {
|
|
|
|
struct /* Per process profiling */
|
|
|
|
{
|
|
|
|
Plink *pp; /* known to be 0(ptr) */
|
|
|
|
Plink *next; /* known to be 4(ptr) */
|
|
|
|
Plink *last;
|
|
|
|
Plink *first;
|
|
|
|
uint32 pid;
|
|
|
|
uint32 what;
|
|
|
|
} prof;
|
|
|
|
uint64 cyclefreq; /* cycle clock frequency if there is one, 0 otherwise */
|
|
|
|
int64 kcycles; /* cycles spent in kernel */
|
|
|
|
int64 pcycles; /* cycles spent in process (kernel + user) */
|
|
|
|
uint32 pid; /* might as well put the pid here */
|
|
|
|
uint32 clock;
|
|
|
|
/* top of stack is here */
|
|
|
|
};
|
|
|
|
|
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
|
|
|
extern int32 runtime·rfork(int32 flags, void *stk, M *m, G *g, void (*fn)(void));
|
|
|
|
extern int32 runtime·plan9_semacquire(uint32 *addr, int32 block);
|
|
|
|
extern int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
|