aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.h
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2014-02-25 09:47:42 -0500
committerRuss Cox <rsc@golang.org>2014-02-25 09:47:42 -0500
commit7c8280c9efcd24b882e441d359b6880c1a456ad8 (patch)
tree120ce40112502f840faa88faee49f5055536a316 /src/pkg/runtime/runtime.h
parent7206f50f719cdac2a93e2beb723908bff69d7f22 (diff)
downloadgo-7c8280c9efcd24b882e441d359b6880c1a456ad8.tar.xz
all: merge NaCl branch (part 1)
See golang.org/s/go13nacl for design overview. This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come. CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately. The exact change lists included are 15050047: syscall: support for Native Client 15360044: syscall: unzip implementation for Native Client 15370044: syscall: Native Client SRPC implementation 15400047: cmd/dist, cmd/go, go/build, test: support for Native Client 15410048: runtime: support for Native Client 15410049: syscall: file descriptor table for Native Client 15410050: syscall: in-memory file system for Native Client 15440048: all: update +build lines for Native Client port 15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client 15570045: os: support for Native Client 15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32 15690044: net: support for Native Client 15690048: runtime: support for fake time like on Go Playground 15690051: build: disable various tests on Native Client LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/68150047
Diffstat (limited to 'src/pkg/runtime/runtime.h')
-rw-r--r--src/pkg/runtime/runtime.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index c9887b6637..0069d5a774 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -21,11 +21,19 @@ typedef uint64 uintptr;
typedef int64 intptr;
typedef int64 intgo; // Go's int
typedef uint64 uintgo; // Go's uint
+typedef uint64 uintreg;
#else
typedef uint32 uintptr;
typedef int32 intptr;
typedef int32 intgo; // Go's int
typedef uint32 uintgo; // Go's uint
+typedef uint32 uintreg;
+#endif
+
+#ifdef _64BITREG
+//typedef uint64 uintreg;
+#else
+//typedef uint32 uintreg;
#endif
/*
@@ -209,8 +217,8 @@ struct Gobuf
uintptr sp;
uintptr pc;
G* g;
- uintptr ret;
void* ctxt;
+ uintreg ret;
uintptr lr;
};
struct GCStats
@@ -295,8 +303,8 @@ struct M
// Fields not known to debuggers.
uint32 moreframesize; // size arguments to morestack
- uint32 moreargsize;
- uintptr cret; // return value from C
+ uint32 moreargsize; // known by amd64 asm to follow moreframesize
+ uintreg cret; // return value from C
uint64 procid; // for debuggers, but offset not hard-coded
G* gsignal; // signal-handling G
uintptr tls[4]; // thread-local storage (for x86 extern register)
@@ -479,6 +487,16 @@ struct Itab
void (*fun[])(void);
};
+#ifdef GOOS_nacl
+enum {
+ NaCl = 1,
+};
+#else
+enum {
+ NaCl = 0,
+};
+#endif
+
#ifdef GOOS_windows
enum {
Windows = 1
@@ -512,6 +530,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
@@ -588,7 +608,7 @@ extern bool runtime·precisestack;
* known to compiler
*/
enum {
- Structrnd = sizeof(uintptr)
+ Structrnd = sizeof(uintreg),
};
/*
@@ -762,6 +782,7 @@ void runtime·dump(byte*, int32);
int32 runtime·runetochar(byte*, int32);
int32 runtime·charntorune(int32*, uint8*, int32);
+
/*
* This macro is used when writing C functions
* called as if they were Go functions.
@@ -774,8 +795,6 @@ int32 runtime·charntorune(int32*, uint8*, int32);
* first output value. Almost all code should write such
* functions in .goc files, where goc2c (part of cmd/dist)
* can arrange the correct alignment for the target system.
- * Goc2c also takes care of conveying to the garbage collector
- * which parts of the argument list are input vs outputs.
*
* Therefore, do NOT use this macro if at all possible.
*/
@@ -926,6 +945,7 @@ void runtime·parsedebugvars(void);
void _rt0_go(void);
void* runtime·funcdata(Func*, int32);
int32 runtime·setmaxthreads(int32);
+G* runtime·timejump(void);
#pragma varargck argpos runtime·printf 1
#pragma varargck type "c" int32
@@ -1017,13 +1037,6 @@ void runtime·parfordo(ParFor *desc);
void runtime·parforiters(ParFor*, uintptr, uintptr*, uintptr*);
/*
- * This is consistent across Linux and BSD.
- * If a new OS is added that is different, move this to
- * $GOOS/$GOARCH/defs.h.
- */
-#define EACCES 13
-
-/*
* low level C-called
*/
// for mmap, we only pass the lower 32 bits of file offset to the
@@ -1057,6 +1070,7 @@ void reflect·call(FuncVal*, byte*, uint32);
void runtime·panic(Eface);
void runtime·panicindex(void);
void runtime·panicslice(void);
+void runtime·panicdivide(void);
/*
* runtime c-called (but written in Go)