2008-06-05 20:38:39 -06:00
|
|
|
// Copyright 2009 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.
|
|
|
|
|
|
|
|
/*
|
|
|
|
* basic types
|
|
|
|
*/
|
|
|
|
typedef signed char int8;
|
|
|
|
typedef unsigned char uint8;
|
|
|
|
typedef signed short int16;
|
|
|
|
typedef unsigned short uint16;
|
|
|
|
typedef signed int int32;
|
|
|
|
typedef unsigned int uint32;
|
|
|
|
typedef signed long long int int64;
|
|
|
|
typedef unsigned long long int uint64;
|
|
|
|
typedef float float32;
|
|
|
|
typedef double float64;
|
2009-03-30 01:01:07 -06:00
|
|
|
|
|
|
|
#ifdef _64BIT
|
2008-11-17 13:32:35 -07:00
|
|
|
typedef uint64 uintptr;
|
2009-03-30 01:01:07 -06:00
|
|
|
#else
|
|
|
|
typedef uint32 uintptr;
|
|
|
|
#endif
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* get rid of C types
|
2008-11-23 18:08:55 -07:00
|
|
|
* the / / / forces a syntax error immediately,
|
|
|
|
* which will show "last name: XXunsigned".
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
2008-11-23 18:08:55 -07:00
|
|
|
#define unsigned XXunsigned / / /
|
|
|
|
#define signed XXsigned / / /
|
|
|
|
#define char XXchar / / /
|
|
|
|
#define short XXshort / / /
|
|
|
|
#define int XXint / / /
|
|
|
|
#define long XXlong / / /
|
|
|
|
#define float XXfloat / / /
|
|
|
|
#define double XXdouble / / /
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* defined types
|
|
|
|
*/
|
|
|
|
typedef uint8 bool;
|
|
|
|
typedef uint8 byte;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Alg Alg;
|
|
|
|
typedef struct Func Func;
|
2008-07-13 15:29:46 -06:00
|
|
|
typedef struct G G;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Gobuf Gobuf;
|
2008-08-04 17:43:49 -06:00
|
|
|
typedef struct Lock Lock;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct M M;
|
2008-08-04 17:43:49 -06:00
|
|
|
typedef struct Mem Mem;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef union Note Note;
|
2009-08-25 16:54:25 -06:00
|
|
|
typedef struct Slice Slice;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Stktop Stktop;
|
2009-04-09 19:16:21 -06:00
|
|
|
typedef struct String String;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Usema Usema;
|
2008-12-19 18:11:54 -07:00
|
|
|
typedef struct SigTab SigTab;
|
|
|
|
typedef struct MCache MCache;
|
|
|
|
typedef struct Iface Iface;
|
2009-07-07 12:02:54 -06:00
|
|
|
typedef struct Itab Itab;
|
2009-05-20 15:57:55 -06:00
|
|
|
typedef struct Eface Eface;
|
2009-07-07 12:02:54 -06:00
|
|
|
typedef struct Type Type;
|
2009-01-27 13:03:53 -07:00
|
|
|
typedef struct Defer Defer;
|
2009-07-08 14:55:57 -06:00
|
|
|
typedef struct hash Hmap;
|
2009-07-08 16:00:54 -06:00
|
|
|
typedef struct Hchan Hchan;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
|
|
|
/*
|
2009-08-11 14:30:35 -06:00
|
|
|
* per-cpu declaration.
|
|
|
|
* "extern register" is a special storage class implemented by 6c, 8c, etc.
|
|
|
|
* on machines with lots of registers, it allocates a register that will not be
|
|
|
|
* used in generated code. on the x86, it allocates a slot indexed by a
|
|
|
|
* segment register.
|
|
|
|
*
|
|
|
|
* amd64: allocated downwards from R15
|
|
|
|
* x86: allocated upwards from 0(FS)
|
|
|
|
* arm: allocated upwards from R9
|
2009-08-26 11:47:18 -06:00
|
|
|
*
|
2009-08-11 14:30:35 -06:00
|
|
|
* every C file linked into a Go program must include runtime.h
|
|
|
|
* so that the C compiler knows to avoid other uses of these registers.
|
|
|
|
* the Go compilers know to avoid them.
|
2008-07-13 15:29:46 -06:00
|
|
|
*/
|
2009-08-11 14:30:35 -06:00
|
|
|
extern register G* g;
|
|
|
|
extern register M* m;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* defined constants
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
// G status
|
|
|
|
Gidle,
|
|
|
|
Grunnable,
|
2008-08-04 17:43:49 -06:00
|
|
|
Grunning,
|
2008-12-05 16:24:18 -07:00
|
|
|
Gsyscall,
|
2008-07-14 15:33:39 -06:00
|
|
|
Gwaiting,
|
2008-08-05 15:18:47 -06:00
|
|
|
Gmoribund,
|
2008-07-13 15:29:46 -06:00
|
|
|
Gdead,
|
|
|
|
};
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
true = 1,
|
|
|
|
false = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* structures
|
|
|
|
*/
|
2008-08-04 17:43:49 -06:00
|
|
|
struct Lock
|
|
|
|
{
|
|
|
|
uint32 key;
|
2008-09-09 12:50:14 -06:00
|
|
|
uint32 sema; // for OS X
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
2008-09-24 11:25:28 -06:00
|
|
|
struct Usema
|
|
|
|
{
|
|
|
|
uint32 u;
|
|
|
|
uint32 k;
|
|
|
|
};
|
2008-09-09 12:50:14 -06:00
|
|
|
union Note
|
2008-08-04 17:43:49 -06:00
|
|
|
{
|
2008-09-09 12:50:14 -06:00
|
|
|
struct { // Linux
|
|
|
|
Lock lock;
|
|
|
|
};
|
|
|
|
struct { // OS X
|
|
|
|
int32 wakeup;
|
2008-09-24 11:25:28 -06:00
|
|
|
Usema sema;
|
2008-09-09 12:50:14 -06:00
|
|
|
};
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
2008-07-13 15:29:46 -06:00
|
|
|
struct String
|
2008-06-05 20:38:39 -06:00
|
|
|
{
|
2009-04-09 19:16:21 -06:00
|
|
|
byte* str;
|
2008-06-05 20:38:39 -06:00
|
|
|
int32 len;
|
2008-07-13 15:29:46 -06:00
|
|
|
};
|
2008-12-19 18:11:54 -07:00
|
|
|
struct Iface
|
|
|
|
{
|
2009-07-07 12:02:54 -06:00
|
|
|
Itab* tab;
|
2009-04-09 19:16:21 -06:00
|
|
|
void* data;
|
2008-12-19 18:11:54 -07:00
|
|
|
};
|
2009-05-20 15:57:55 -06:00
|
|
|
struct Eface
|
|
|
|
{
|
2009-07-07 12:02:54 -06:00
|
|
|
Type* type;
|
2009-05-20 15:57:55 -06:00
|
|
|
void* data;
|
|
|
|
};
|
2008-08-27 18:28:30 -06:00
|
|
|
|
2009-08-25 16:54:25 -06:00
|
|
|
struct Slice
|
2008-08-27 18:28:30 -06:00
|
|
|
{ // must not move anything
|
|
|
|
byte* array; // actual data
|
2009-08-25 16:54:25 -06:00
|
|
|
uint32 len; // number of elements
|
2008-11-17 13:32:35 -07:00
|
|
|
uint32 cap; // allocated number of elements
|
2008-08-27 18:28:30 -06:00
|
|
|
};
|
2008-07-11 20:16:39 -06:00
|
|
|
struct Gobuf
|
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
byte* sp;
|
|
|
|
byte* pc;
|
|
|
|
G* g;
|
2009-06-25 12:26:10 -06:00
|
|
|
uintptr r0; // used on arm
|
2008-07-11 20:16:39 -06:00
|
|
|
};
|
2008-07-09 12:35:26 -06:00
|
|
|
struct G
|
2008-07-08 18:19:17 -06:00
|
|
|
{
|
2009-10-03 11:37:12 -06:00
|
|
|
byte* stackguard; // cannot move - also known to linker, libmach, libcgo
|
|
|
|
byte* stackbase; // cannot move - also known to libmach, libcgo
|
2009-06-17 16:12:16 -06:00
|
|
|
Defer* defer;
|
2009-06-17 17:31:02 -06:00
|
|
|
Gobuf sched; // cannot move - also known to libmach
|
2009-10-03 11:37:12 -06:00
|
|
|
byte* stack0;
|
2009-06-17 16:12:16 -06:00
|
|
|
byte* entry; // initial function
|
2008-07-28 12:29:41 -06:00
|
|
|
G* alllink; // on allg
|
2008-07-25 16:55:12 -06:00
|
|
|
void* param; // passed parameter on wakeup
|
|
|
|
int16 status;
|
2008-07-11 20:16:39 -06:00
|
|
|
int32 goid;
|
2008-07-25 16:55:12 -06:00
|
|
|
int32 selgen; // valid sudog pointer
|
2008-08-05 15:18:47 -06:00
|
|
|
G* schedlink;
|
2009-01-27 13:03:53 -07:00
|
|
|
bool readyonstop;
|
2009-06-17 16:12:16 -06:00
|
|
|
M* m; // for debuggers, but offset not hard-coded
|
2009-07-13 18:28:39 -06:00
|
|
|
M* lockedm;
|
2009-10-03 11:37:12 -06:00
|
|
|
void (*cgofn)(void*); // for cgo/ffi
|
|
|
|
void *cgoarg;
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
|
|
|
struct Mem
|
|
|
|
{
|
|
|
|
uint8* hunk;
|
|
|
|
uint32 nhunk;
|
|
|
|
uint64 nmmap;
|
|
|
|
uint64 nmal;
|
2008-07-08 18:19:17 -06:00
|
|
|
};
|
|
|
|
struct M
|
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
G* g0; // goroutine with scheduling stack
|
|
|
|
void (*morepc)(void);
|
2009-07-08 19:16:09 -06:00
|
|
|
void* morefp; // frame pointer for more stack
|
2009-06-17 16:12:16 -06:00
|
|
|
Gobuf morebuf; // gobuf arg to morestack
|
|
|
|
|
2009-06-17 17:31:02 -06:00
|
|
|
// Fields not known to debuggers.
|
2009-06-17 16:12:16 -06:00
|
|
|
uint32 moreframe; // size arguments to morestack
|
|
|
|
uint32 moreargs;
|
|
|
|
uintptr cret; // return value from C
|
|
|
|
uint64 procid; // for debuggers, but offset not hard-coded
|
|
|
|
G* gsignal; // signal-handling G
|
|
|
|
uint32 tls[8]; // thread-local storage (for 386 extern register)
|
|
|
|
Gobuf sched; // scheduling stack
|
|
|
|
G* curg; // current running goroutine
|
2008-11-25 17:48:10 -07:00
|
|
|
int32 id;
|
2008-12-19 04:13:39 -07:00
|
|
|
int32 mallocing;
|
2009-06-15 22:31:56 -06:00
|
|
|
int32 gcing;
|
2009-01-26 18:37:05 -07:00
|
|
|
int32 locks;
|
2009-07-13 18:28:39 -06:00
|
|
|
int32 waitnextg;
|
2008-08-05 15:18:47 -06:00
|
|
|
Note havenextg;
|
|
|
|
G* nextg;
|
2009-10-09 16:35:33 -06:00
|
|
|
M* alllink; // on allm
|
2008-08-05 15:18:47 -06:00
|
|
|
M* schedlink;
|
2008-08-04 17:43:49 -06:00
|
|
|
Mem mem;
|
2008-09-09 12:50:14 -06:00
|
|
|
uint32 machport; // Return address for Mach IPC (OS X)
|
2008-12-18 16:42:28 -07:00
|
|
|
MCache *mcache;
|
2009-07-13 18:28:39 -06:00
|
|
|
G* lockedg;
|
2008-07-11 20:16:39 -06:00
|
|
|
};
|
2008-07-14 15:33:39 -06:00
|
|
|
struct Stktop
|
2008-07-13 15:29:46 -06:00
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
uint8* stackguard;
|
|
|
|
uint8* stackbase;
|
|
|
|
Gobuf gobuf;
|
|
|
|
uint32 args;
|
2009-07-08 19:16:09 -06:00
|
|
|
|
|
|
|
// Frame pointer: where args start in old frame.
|
|
|
|
// fp == gobuf.sp except in the case of a reflected
|
|
|
|
// function call, which uses an off-stack argument frame.
|
|
|
|
uint8* fp;
|
2008-07-08 18:19:17 -06:00
|
|
|
};
|
2008-07-13 15:29:46 -06:00
|
|
|
struct Alg
|
2008-07-11 20:16:39 -06:00
|
|
|
{
|
2009-06-04 22:09:06 -06:00
|
|
|
uintptr (*hash)(uint32, void*);
|
2008-07-13 15:29:46 -06:00
|
|
|
uint32 (*equal)(uint32, void*, void*);
|
|
|
|
void (*print)(uint32, void*);
|
|
|
|
void (*copy)(uint32, void*, void*);
|
2008-07-11 20:16:39 -06:00
|
|
|
};
|
2008-07-13 15:29:46 -06:00
|
|
|
struct SigTab
|
2008-06-05 20:38:39 -06:00
|
|
|
{
|
2008-12-03 15:21:28 -07:00
|
|
|
int32 flags;
|
2008-07-13 15:29:46 -06:00
|
|
|
int8 *name;
|
2008-06-05 20:38:39 -06:00
|
|
|
};
|
2008-12-03 15:21:28 -07:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SigCatch = 1<<0,
|
|
|
|
SigIgnore = 1<<1,
|
|
|
|
SigRestart = 1<<2,
|
|
|
|
};
|
2008-06-05 20:38:39 -06:00
|
|
|
|
2008-11-23 18:08:55 -07:00
|
|
|
// (will be) shared with go; edit ../cmd/6g/sys.go too.
|
|
|
|
// should move out of sys.go eventually.
|
|
|
|
// also eventually, the loaded symbol table should
|
|
|
|
// be closer to this form.
|
|
|
|
struct Func
|
|
|
|
{
|
2009-04-09 19:16:21 -06:00
|
|
|
String name;
|
|
|
|
String type; // go type string
|
|
|
|
String src; // src file name
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
uint64 entry; // entry pc
|
|
|
|
int64 frame; // stack frame size
|
2009-08-25 16:54:25 -06:00
|
|
|
Slice pcln; // pc/ln tab for this func
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int64 pc0; // starting pc, ln for table
|
|
|
|
int32 ln0;
|
2008-11-25 17:48:10 -07:00
|
|
|
int32 args; // number of 32-bit in/out args
|
|
|
|
int32 locals; // number of 32-bit locals
|
2008-11-23 18:08:55 -07:00
|
|
|
};
|
|
|
|
|
2008-06-05 20:38:39 -06:00
|
|
|
/*
|
|
|
|
* defined macros
|
|
|
|
* you need super-goru privilege
|
|
|
|
* to add this list.
|
|
|
|
*/
|
|
|
|
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
|
|
|
#define nil ((void*)0)
|
|
|
|
|
2008-12-19 13:05:22 -07:00
|
|
|
/*
|
|
|
|
* known to compiler
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
2009-01-26 10:56:42 -07:00
|
|
|
AMEM,
|
|
|
|
ANOEQ,
|
2008-12-19 13:05:22 -07:00
|
|
|
ASTRING,
|
|
|
|
AINTER,
|
2009-05-20 15:57:55 -06:00
|
|
|
ANILINTER,
|
2009-01-26 13:36:21 -07:00
|
|
|
AFAKE,
|
2009-01-26 10:56:42 -07:00
|
|
|
Amax
|
2008-12-19 13:05:22 -07:00
|
|
|
};
|
|
|
|
|
2009-07-02 22:25:46 -06:00
|
|
|
|
|
|
|
enum {
|
|
|
|
Structrnd = sizeof(uintptr)
|
|
|
|
};
|
|
|
|
|
2009-01-27 13:03:53 -07:00
|
|
|
/*
|
2009-01-27 14:23:28 -07:00
|
|
|
* deferred subroutine calls
|
2009-01-27 13:03:53 -07:00
|
|
|
*/
|
|
|
|
struct Defer
|
|
|
|
{
|
|
|
|
int32 siz;
|
|
|
|
byte* sp;
|
|
|
|
byte* fn;
|
|
|
|
Defer* link;
|
|
|
|
byte args[8]; // padded to actual size
|
|
|
|
};
|
|
|
|
|
2008-07-13 15:29:46 -06:00
|
|
|
/*
|
|
|
|
* external data
|
|
|
|
*/
|
2009-01-26 10:56:42 -07:00
|
|
|
extern Alg algarray[Amax];
|
2009-04-09 19:16:21 -06:00
|
|
|
extern String emptystring;
|
2008-07-13 15:29:46 -06:00
|
|
|
G* allg;
|
2009-10-09 16:35:33 -06:00
|
|
|
M* allm;
|
2008-07-13 15:29:46 -06:00
|
|
|
int32 goidgen;
|
2008-08-04 17:43:49 -06:00
|
|
|
extern int32 gomaxprocs;
|
2008-09-12 10:44:41 -06:00
|
|
|
extern int32 panicking;
|
2008-11-05 22:50:28 -07:00
|
|
|
extern int32 maxround;
|
2009-10-13 23:48:03 -06:00
|
|
|
extern int32 fd; // usually 1; set to 2 when panicking
|
2009-09-22 17:28:32 -06:00
|
|
|
int8* goos;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
2008-06-30 12:50:36 -06:00
|
|
|
/*
|
|
|
|
* common functions and data
|
|
|
|
*/
|
2008-07-11 20:16:39 -06:00
|
|
|
int32 strcmp(byte*, byte*);
|
2008-11-23 18:08:55 -07:00
|
|
|
int32 findnull(byte*);
|
2008-06-30 12:50:36 -06:00
|
|
|
void dump(byte*, int32);
|
2008-07-11 20:16:39 -06:00
|
|
|
int32 runetochar(byte*, int32);
|
2009-04-12 18:01:17 -06:00
|
|
|
int32 charntorune(int32*, uint8*, int32);
|
2008-06-30 12:50:36 -06:00
|
|
|
|
2008-06-05 20:38:39 -06:00
|
|
|
/*
|
2008-06-16 23:34:50 -06:00
|
|
|
* very low level c-called
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
2009-06-17 16:12:16 -06:00
|
|
|
void gogo(Gobuf*, uintptr);
|
|
|
|
void gogocall(Gobuf*, void(*)(void));
|
|
|
|
uintptr gosave(Gobuf*);
|
|
|
|
void sys·lessstack(void);
|
2009-01-16 15:58:14 -07:00
|
|
|
void goargs(void);
|
2008-06-05 20:38:39 -06:00
|
|
|
void FLUSH(void*);
|
2008-06-30 15:39:47 -06:00
|
|
|
void* getu(void);
|
2008-06-16 23:34:50 -06:00
|
|
|
void throw(int8*);
|
2008-07-13 15:29:46 -06:00
|
|
|
uint32 rnd(uint32, uint32);
|
2008-06-05 20:38:39 -06:00
|
|
|
void prints(int8*);
|
2008-11-25 17:48:10 -07:00
|
|
|
void printf(int8*, ...);
|
2008-11-23 18:08:55 -07:00
|
|
|
byte* mchr(byte*, byte, byte*);
|
2008-06-15 21:24:30 -06:00
|
|
|
void mcpy(byte*, byte*, uint32);
|
2009-01-26 13:36:21 -07:00
|
|
|
int32 mcmp(byte*, byte*, uint32);
|
2008-11-13 11:35:44 -07:00
|
|
|
void mmov(byte*, byte*, uint32);
|
2008-06-15 21:24:30 -06:00
|
|
|
void* mal(uint32);
|
2009-04-09 19:16:21 -06:00
|
|
|
uint32 cmpstring(String, String);
|
|
|
|
String gostring(byte*);
|
2008-06-21 16:36:23 -06:00
|
|
|
void initsig(void);
|
2008-09-22 14:47:53 -06:00
|
|
|
int32 gotraceback(void);
|
2008-07-11 20:16:39 -06:00
|
|
|
void traceback(uint8 *pc, uint8 *sp, G* gp);
|
2008-07-28 12:29:41 -06:00
|
|
|
void tracebackothers(G*);
|
2008-07-14 21:54:55 -06:00
|
|
|
int32 open(byte*, int32, ...);
|
|
|
|
int32 write(int32, void*, int32);
|
2008-08-04 17:43:49 -06:00
|
|
|
bool cas(uint32*, uint32, uint32);
|
2009-06-03 00:02:12 -06:00
|
|
|
void jmpdefer(byte*, void*);
|
2008-08-04 17:43:49 -06:00
|
|
|
void exit1(int32);
|
|
|
|
void ready(G*);
|
|
|
|
byte* getenv(int8*);
|
|
|
|
int32 atoi(byte*);
|
2008-08-05 15:18:47 -06:00
|
|
|
void newosproc(M *m, G *g, void *stk, void (*fn)(void));
|
2008-09-18 16:56:46 -06:00
|
|
|
void signalstack(byte*, int32);
|
|
|
|
G* malg(int32);
|
|
|
|
void minit(void);
|
2009-03-30 01:01:07 -06:00
|
|
|
Func* findfunc(uintptr);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int32 funcline(Func*, uint64);
|
2008-12-04 09:30:54 -07:00
|
|
|
void* stackalloc(uint32);
|
|
|
|
void stackfree(void*);
|
2008-12-18 16:42:28 -07:00
|
|
|
MCache* allocmcache(void);
|
|
|
|
void mallocinit(void);
|
2009-01-26 10:56:42 -07:00
|
|
|
bool ifaceeq(Iface, Iface);
|
2009-05-20 15:57:55 -06:00
|
|
|
bool efaceeq(Eface, Eface);
|
2009-06-04 22:09:06 -06:00
|
|
|
uintptr ifacehash(Iface);
|
|
|
|
uintptr efacehash(Eface);
|
|
|
|
uintptr nohash(uint32, void*);
|
2009-01-26 10:56:42 -07:00
|
|
|
uint32 noequal(uint32, void*, void*);
|
2009-01-26 18:37:05 -07:00
|
|
|
void* malloc(uintptr size);
|
|
|
|
void* mallocgc(uintptr size);
|
|
|
|
void free(void *v);
|
2009-05-08 16:21:41 -06:00
|
|
|
void exit(int32);
|
|
|
|
void breakpoint(void);
|
|
|
|
void gosched(void);
|
|
|
|
void goexit(void);
|
2009-10-03 11:37:12 -06:00
|
|
|
void runcgo(void (*fn)(void*), void*);
|
2008-08-04 17:43:49 -06:00
|
|
|
|
2008-12-15 11:50:33 -07:00
|
|
|
#pragma varargck argpos printf 1
|
|
|
|
|
|
|
|
#pragma varargck type "d" int32
|
|
|
|
#pragma varargck type "d" uint32
|
|
|
|
#pragma varargck type "D" int64
|
|
|
|
#pragma varargck type "D" uint64
|
|
|
|
#pragma varargck type "x" int32
|
|
|
|
#pragma varargck type "x" uint32
|
|
|
|
#pragma varargck type "X" int64
|
|
|
|
#pragma varargck type "X" uint64
|
|
|
|
#pragma varargck type "p" void*
|
2009-03-30 01:01:07 -06:00
|
|
|
#pragma varargck type "p" uintptr
|
2008-12-15 11:50:33 -07:00
|
|
|
#pragma varargck type "s" int8*
|
|
|
|
#pragma varargck type "s" uint8*
|
2009-04-09 19:16:21 -06:00
|
|
|
#pragma varargck type "S" String
|
2008-12-15 11:50:33 -07:00
|
|
|
|
2008-12-05 16:24:18 -07:00
|
|
|
// TODO(rsc): Remove. These are only temporary,
|
|
|
|
// for the mark and sweep collector.
|
|
|
|
void stoptheworld(void);
|
|
|
|
void starttheworld(void);
|
|
|
|
|
2008-08-04 17:43:49 -06:00
|
|
|
/*
|
|
|
|
* mutual exclusion locks. in the uncontended case,
|
|
|
|
* as fast as spin locks (just a few user-level instructions),
|
|
|
|
* but on the contention path they sleep in the kernel.
|
2008-08-05 15:18:47 -06:00
|
|
|
* a zeroed Lock is unlocked (no need to initialize each lock).
|
2008-08-04 17:43:49 -06:00
|
|
|
*/
|
|
|
|
void lock(Lock*);
|
|
|
|
void unlock(Lock*);
|
|
|
|
|
|
|
|
/*
|
2009-10-13 23:48:03 -06:00
|
|
|
* sleep and wakeup on one-time events, like
|
|
|
|
* Notification (but shorter to type).
|
2008-08-05 15:21:42 -06:00
|
|
|
* before any calls to notesleep or notewakeup,
|
2008-08-05 15:18:47 -06:00
|
|
|
* must call noteclear to initialize the Note.
|
|
|
|
* then, any number of threads can call notesleep
|
|
|
|
* and exactly one thread can call notewakeup (once).
|
|
|
|
* once notewakeup has been called, all the notesleeps
|
|
|
|
* will return. future notesleeps will return immediately.
|
2008-08-04 17:43:49 -06:00
|
|
|
*/
|
2008-08-05 15:18:47 -06:00
|
|
|
void noteclear(Note*);
|
|
|
|
void notesleep(Note*);
|
|
|
|
void notewakeup(Note*);
|
2008-06-16 23:34:50 -06:00
|
|
|
|
2009-01-13 10:55:24 -07:00
|
|
|
/*
|
|
|
|
* Redefine methods for the benefit of gcc, which does not support
|
|
|
|
* UTF-8 characters in identifiers.
|
|
|
|
*/
|
|
|
|
#ifndef __GNUC__
|
|
|
|
#define sys_memclr sys·memclr
|
|
|
|
#define sys_getcallerpc sys·getcallerpc
|
|
|
|
#define sys_mmap sys·mmap
|
2009-08-25 16:54:25 -06:00
|
|
|
#define sys_printslice sys·printslice
|
2009-01-13 10:55:24 -07:00
|
|
|
#define sys_printbool sys·printbool
|
|
|
|
#define sys_printfloat sys·printfloat
|
|
|
|
#define sys_printhex sys·printhex
|
|
|
|
#define sys_printint sys·printint
|
2009-05-20 15:57:55 -06:00
|
|
|
#define sys_printiface sys·printiface
|
|
|
|
#define sys_printeface sys·printeface
|
2009-01-13 10:55:24 -07:00
|
|
|
#define sys_printpc sys·printpc
|
|
|
|
#define sys_printpointer sys·printpointer
|
|
|
|
#define sys_printstring sys·printstring
|
|
|
|
#define sys_printuint sys·printuint
|
|
|
|
#define sys_setcallerpc sys·setcallerpc
|
|
|
|
#endif
|
|
|
|
|
2008-06-16 23:34:50 -06:00
|
|
|
/*
|
2009-01-22 17:23:44 -07:00
|
|
|
* low level go-called
|
2008-06-16 23:34:50 -06:00
|
|
|
*/
|
2009-01-13 10:55:24 -07:00
|
|
|
uint8* sys_mmap(byte*, uint32, int32, int32, int32, uint32);
|
|
|
|
void sys_memclr(byte*, uint32);
|
|
|
|
void sys_setcallerpc(void*, void*);
|
|
|
|
void* sys_getcallerpc(void*);
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
2008-06-16 23:34:50 -06:00
|
|
|
* runtime go-called
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
2009-01-13 10:55:24 -07:00
|
|
|
void sys_printbool(bool);
|
|
|
|
void sys_printfloat(float64);
|
|
|
|
void sys_printint(int64);
|
2009-05-20 15:57:55 -06:00
|
|
|
void sys_printiface(Iface);
|
|
|
|
void sys_printeface(Eface);
|
2009-04-09 19:16:21 -06:00
|
|
|
void sys_printstring(String);
|
2009-01-13 10:55:24 -07:00
|
|
|
void sys_printpc(void*);
|
|
|
|
void sys_printpointer(void*);
|
|
|
|
void sys_printuint(uint64);
|
|
|
|
void sys_printhex(uint64);
|
2009-08-25 16:54:25 -06:00
|
|
|
void sys_printslice(Slice);
|
2008-07-08 11:36:43 -06:00
|
|
|
|
|
|
|
/*
|
2009-01-22 17:23:44 -07:00
|
|
|
* wrapped for go users
|
2008-07-08 11:36:43 -06:00
|
|
|
*/
|
2009-01-22 17:23:44 -07:00
|
|
|
float64 Inf(int32 sign);
|
|
|
|
float64 NaN(void);
|
|
|
|
float32 float32frombits(uint32 i);
|
|
|
|
uint32 float32tobits(float32 f);
|
|
|
|
float64 float64frombits(uint64 i);
|
|
|
|
uint64 float64tobits(float64 f);
|
|
|
|
float64 frexp(float64 d, int32 *ep);
|
|
|
|
bool isInf(float64 f, int32 sign);
|
|
|
|
bool isNaN(float64 f);
|
|
|
|
float64 ldexp(float64 d, int32 e);
|
|
|
|
float64 modf(float64 d, float64 *ip);
|
|
|
|
void semacquire(uint32*);
|
|
|
|
void semrelease(uint32*);
|
2009-07-08 16:00:54 -06:00
|
|
|
|
2009-07-08 14:55:57 -06:00
|
|
|
void mapassign(Hmap*, byte*, byte*);
|
|
|
|
void mapaccess(Hmap*, byte*, byte*, bool*);
|
|
|
|
struct hash_iter* mapiterinit(Hmap*);
|
|
|
|
void mapiternext(struct hash_iter*);
|
|
|
|
bool mapiterkey(struct hash_iter*, void*);
|
|
|
|
void mapiterkeyvalue(struct hash_iter*, void*, void*);
|
2009-09-08 14:46:54 -06:00
|
|
|
Hmap* makemap(Type*, Type*, uint32);
|
2009-07-08 16:00:54 -06:00
|
|
|
|
2009-09-08 14:46:54 -06:00
|
|
|
Hchan* makechan(Type*, uint32);
|
2009-07-08 16:00:54 -06:00
|
|
|
void chansend(Hchan*, void*, bool*);
|
|
|
|
void chanrecv(Hchan*, void*, bool*);
|
2009-08-26 11:47:18 -06:00
|
|
|
void chanclose(Hchan*);
|
|
|
|
bool chanclosed(Hchan*);
|
2009-08-26 13:42:22 -06:00
|
|
|
int32 chanlen(Hchan*);
|
|
|
|
int32 chancap(Hchan*);
|
2009-07-10 17:32:26 -06:00
|
|
|
|
|
|
|
void ifaceE2I(struct InterfaceType*, Eface, Iface*);
|