summaryrefslogtreecommitdiff
path: root/libgo/runtime/runtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/runtime.h')
-rw-r--r--libgo/runtime/runtime.h50
1 files changed, 43 insertions, 7 deletions
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 6bd53a852b4..8fc10ff81f1 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -49,6 +49,8 @@ typedef unsigned int uintptr __attribute__ ((mode (pointer)));
typedef intptr intgo; // Go's int
typedef uintptr uintgo; // Go's uint
+typedef uintptr uintreg;
+
/* Defined types. */
typedef uint8 bool;
@@ -216,6 +218,7 @@ struct G
bool ispanic;
bool issystem; // do not output in stack dump
bool isbackground; // ignore in deadlock detector
+ bool paniconfault; // panic (instead of crash) on unexpected fault address
M* m; // for debuggers, but offset not hard-coded
M* lockedm;
int32 sig;
@@ -251,6 +254,7 @@ struct M
int32 throwing;
int32 gcing;
int32 locks;
+ int32 softfloat;
int32 dying;
int32 profilehz;
int32 helpgc;
@@ -272,15 +276,11 @@ struct M
uint32 waitsemacount;
uint32 waitsemalock;
GCStats gcstats;
- bool racecall;
bool needextram;
bool dropextram; // for gccgo: drop after call is done.
+ uint8 traceback;
bool (*waitunlockf)(G*, void*);
void* waitlock;
-
- uintptr settype_buf[1024];
- uintptr settype_bufsize;
-
uintptr end[];
};
@@ -340,6 +340,7 @@ enum
SigDefault = 1<<4, // if the signal isn't explicitly requested, don't monitor it
SigHandling = 1<<5, // our signal handler is registered
SigIgnored = 1<<6, // the signal was ignored before we registered for it
+ SigGoExit = 1<<7, // cause all runtime procs to exit (only used on Plan 9).
};
// Layout of in-memory per-function information prepared by linker
@@ -352,6 +353,16 @@ struct Func
uintptr entry; // entry pc
};
+#ifdef GOOS_nacl
+enum {
+ NaCl = 1,
+};
+#else
+enum {
+ NaCl = 0,
+};
+#endif
+
#ifdef GOOS_windows
enum {
Windows = 1
@@ -385,6 +396,8 @@ struct Timers
// Package time knows the layout of this structure.
// If this struct changes, adjust ../time/sleep.go:/runtimeTimer.
+// For GOOS=nacl, package syscall knows the layout of this structure.
+// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer.
struct Timer
{
int32 i; // heap index
@@ -441,11 +454,13 @@ struct DebugVars
int32 allocfreetrace;
int32 efence;
int32 gctrace;
+ int32 gcdead;
int32 scheddetail;
int32 schedtrace;
};
extern bool runtime_precisestack;
+extern bool runtime_copystack;
/*
* defined macros
@@ -490,6 +505,7 @@ extern uint32 runtime_panicking;
extern int8* runtime_goos;
extern int32 runtime_ncpu;
extern void (*runtime_sysargs)(int32, uint8**);
+extern uint32 runtime_Hchansize;
extern DebugVars runtime_debug;
extern uintptr runtime_maxstacksize;
@@ -497,6 +513,7 @@ extern uintptr runtime_maxstacksize;
* common functions and data
*/
#define runtime_strcmp(s1, s2) __builtin_strcmp((s1), (s2))
+#define runtime_strncmp(s1, s2, n) __builtin_strncmp((s1), (s2), (n))
#define runtime_strstr(s1, s2) __builtin_strstr((s1), (s2))
intgo runtime_findnull(const byte*);
intgo runtime_findnullw(const uint16*);
@@ -511,8 +528,10 @@ void runtime_goenvs(void);
void runtime_goenvs_unix(void);
void runtime_throw(const char*) __attribute__ ((noreturn));
void runtime_panicstring(const char*) __attribute__ ((noreturn));
+bool runtime_canpanic(G*);
void runtime_prints(const char*);
void runtime_printf(const char*, ...);
+int32 runtime_snprintf(byte*, int32, const char*, ...);
#define runtime_mcmp(a, b, s) __builtin_memcmp((a), (b), (s))
#define runtime_memmove(a, b, s) __builtin_memmove((a), (b), (s))
void* runtime_mal(uintptr);
@@ -552,6 +571,7 @@ int32 runtime_gcount(void);
void runtime_mcall(void(*)(G*));
uint32 runtime_fastrand1(void);
int32 runtime_timediv(int64, int32, int32*);
+int32 runtime_round2(int32 x); // round x up to a power of 2.
// atomic operations
#define runtime_cas(pval, old, new) __sync_bool_compare_and_swap (pval, old, new)
@@ -590,7 +610,8 @@ G* __go_go(void (*pfn)(void*), void*);
void siginit(void);
bool __go_sigsend(int32 sig);
int32 runtime_callers(int32, Location*, int32);
-int64 runtime_nanotime(void);
+int64 runtime_nanotime(void); // monotonic time
+int64 runtime_unixnanotime(void); // real time, can skip
void runtime_dopanic(int32) __attribute__ ((noreturn));
void runtime_startpanic(void);
void runtime_freezetheworld(void);
@@ -611,12 +632,18 @@ int32 runtime_netpollopen(uintptr, PollDesc*);
int32 runtime_netpollclose(uintptr);
void runtime_netpollready(G**, PollDesc*, int32);
uintptr runtime_netpollfd(PollDesc*);
-void runtime_netpollarm(uintptr, int32);
+void runtime_netpollarm(PollDesc*, int32);
+void** runtime_netpolluser(PollDesc*);
+bool runtime_netpollclosing(PollDesc*);
+void runtime_netpolllock(PollDesc*);
+void runtime_netpollunlock(PollDesc*);
void runtime_crash(void);
void runtime_parsedebugvars(void);
void _rt0_go(void);
void* runtime_funcdata(Func*, int32);
int32 runtime_setmaxthreads(int32);
+G* runtime_timejump(void);
+void runtime_iterate_finq(void (*callback)(FuncVal*, void*, const FuncType*, const PtrType*));
void runtime_stoptheworld(void);
void runtime_starttheworld(void);
@@ -814,3 +841,12 @@ bool runtime_gcwaiting(void);
void runtime_badsignal(int);
Defer* runtime_newdefer(void);
void runtime_freedefer(Defer*);
+
+struct time_now_ret
+{
+ int64_t sec;
+ int32_t nsec;
+};
+
+struct time_now_ret now() __asm__ (GOSYM_PREFIX "time.now")
+ __attribute__ ((no_split_stack));