Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 1 | // Copyright 2009 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 5 | /* |
| 6 | * basic types |
| 7 | */ |
| 8 | typedef signed char int8; |
| 9 | typedef unsigned char uint8; |
| 10 | typedef signed short int16; |
| 11 | typedef unsigned short uint16; |
| 12 | typedef signed int int32; |
| 13 | typedef unsigned int uint32; |
| 14 | typedef signed long long int int64; |
| 15 | typedef unsigned long long int uint64; |
| 16 | typedef float float32; |
| 17 | typedef double float64; |
Russ Cox | 0d3a043 | 2009-03-30 00:01:07 -0700 | [diff] [blame] | 18 | |
| 19 | #ifdef _64BIT |
Russ Cox | 75647d2 | 2008-11-17 12:32:35 -0800 | [diff] [blame] | 20 | typedef uint64 uintptr; |
Devon H. O'Dell | 659780b | 2009-11-18 09:11:39 -0800 | [diff] [blame] | 21 | typedef int64 intptr; |
Russ Cox | 0d3a043 | 2009-03-30 00:01:07 -0700 | [diff] [blame] | 22 | #else |
| 23 | typedef uint32 uintptr; |
Devon H. O'Dell | 659780b | 2009-11-18 09:11:39 -0800 | [diff] [blame] | 24 | typedef int32 intptr; |
Russ Cox | 0d3a043 | 2009-03-30 00:01:07 -0700 | [diff] [blame] | 25 | #endif |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * get rid of C types |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 29 | * the / / / forces a syntax error immediately, |
| 30 | * which will show "last name: XXunsigned". |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 31 | */ |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 32 | #define unsigned XXunsigned / / / |
| 33 | #define signed XXsigned / / / |
| 34 | #define char XXchar / / / |
| 35 | #define short XXshort / / / |
| 36 | #define int XXint / / / |
| 37 | #define long XXlong / / / |
| 38 | #define float XXfloat / / / |
| 39 | #define double XXdouble / / / |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * defined types |
| 43 | */ |
| 44 | typedef uint8 bool; |
| 45 | typedef uint8 byte; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 46 | typedef struct Alg Alg; |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 47 | typedef struct Func Func; |
| 48 | typedef struct G G; |
| 49 | typedef struct Gobuf Gobuf; |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 50 | typedef struct Lock Lock; |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 51 | typedef struct M M; |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 52 | typedef struct Mem Mem; |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 53 | typedef union Note Note; |
Rob Pike | 87f2208 | 2009-08-25 15:54:25 -0700 | [diff] [blame] | 54 | typedef struct Slice Slice; |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 55 | typedef struct Stktop Stktop; |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 56 | typedef struct String String; |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 57 | typedef struct Usema Usema; |
Russ Cox | c3077f7 | 2008-12-19 17:11:54 -0800 | [diff] [blame] | 58 | typedef struct SigTab SigTab; |
| 59 | typedef struct MCache MCache; |
| 60 | typedef struct Iface Iface; |
Russ Cox | c7513ea | 2009-07-07 11:02:54 -0700 | [diff] [blame] | 61 | typedef struct Itab Itab; |
Ken Thompson | f59cb49 | 2010-02-19 20:42:50 -0800 | [diff] [blame] | 62 | typedef struct Eface Eface; |
Russ Cox | c7513ea | 2009-07-07 11:02:54 -0700 | [diff] [blame] | 63 | typedef struct Type Type; |
Ken Thompson | 1e1cc4e | 2009-01-27 12:03:53 -0800 | [diff] [blame] | 64 | typedef struct Defer Defer; |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 65 | typedef struct Panic Panic; |
Russ Cox | 764b6ec | 2009-07-08 13:55:57 -0700 | [diff] [blame] | 66 | typedef struct hash Hmap; |
Russ Cox | 5ddaf9a | 2009-07-08 15:00:54 -0700 | [diff] [blame] | 67 | typedef struct Hchan Hchan; |
Ken Thompson | f59cb49 | 2010-02-19 20:42:50 -0800 | [diff] [blame] | 68 | typedef struct Complex64 Complex64; |
| 69 | typedef struct Complex128 Complex128; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 70 | |
| 71 | /* |
Rob Pike | d08f006 | 2009-08-11 13:30:35 -0700 | [diff] [blame] | 72 | * per-cpu declaration. |
| 73 | * "extern register" is a special storage class implemented by 6c, 8c, etc. |
| 74 | * on machines with lots of registers, it allocates a register that will not be |
| 75 | * used in generated code. on the x86, it allocates a slot indexed by a |
| 76 | * segment register. |
| 77 | * |
| 78 | * amd64: allocated downwards from R15 |
| 79 | * x86: allocated upwards from 0(FS) |
Kai Backman | ebf32c5 | 2010-02-06 21:59:46 -0800 | [diff] [blame] | 80 | * arm: allocated downwards from R10 |
Russ Cox | 653cef1 | 2009-08-26 10:47:18 -0700 | [diff] [blame] | 81 | * |
Rob Pike | d08f006 | 2009-08-11 13:30:35 -0700 | [diff] [blame] | 82 | * every C file linked into a Go program must include runtime.h |
| 83 | * so that the C compiler knows to avoid other uses of these registers. |
| 84 | * the Go compilers know to avoid them. |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 85 | */ |
Rob Pike | d08f006 | 2009-08-11 13:30:35 -0700 | [diff] [blame] | 86 | extern register G* g; |
| 87 | extern register M* m; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 88 | |
| 89 | /* |
| 90 | * defined constants |
| 91 | */ |
| 92 | enum |
| 93 | { |
| 94 | // G status |
| 95 | Gidle, |
| 96 | Grunnable, |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 97 | Grunning, |
Russ Cox | 3f8aa66 | 2008-12-05 15:24:18 -0800 | [diff] [blame] | 98 | Gsyscall, |
Ken Thompson | 5262003 | 2008-07-14 14:33:39 -0700 | [diff] [blame] | 99 | Gwaiting, |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 100 | Gmoribund, |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 101 | Gdead, |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 102 | Grecovery, |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 103 | }; |
| 104 | enum |
| 105 | { |
| 106 | true = 1, |
| 107 | false = 0, |
| 108 | }; |
| 109 | |
| 110 | /* |
| 111 | * structures |
| 112 | */ |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 113 | struct Lock |
| 114 | { |
| 115 | uint32 key; |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 116 | #ifdef __MINGW__ |
| 117 | void* event; |
| 118 | #else |
Russ Cox | 376898c | 2008-09-09 11:50:14 -0700 | [diff] [blame] | 119 | uint32 sema; // for OS X |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 120 | #endif |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 121 | }; |
Russ Cox | 5ff12f8 | 2008-09-24 10:25:28 -0700 | [diff] [blame] | 122 | struct Usema |
| 123 | { |
| 124 | uint32 u; |
| 125 | uint32 k; |
| 126 | }; |
Russ Cox | 376898c | 2008-09-09 11:50:14 -0700 | [diff] [blame] | 127 | union Note |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 128 | { |
Russ Cox | 376898c | 2008-09-09 11:50:14 -0700 | [diff] [blame] | 129 | struct { // Linux |
| 130 | Lock lock; |
| 131 | }; |
| 132 | struct { // OS X |
| 133 | int32 wakeup; |
Russ Cox | 5ff12f8 | 2008-09-24 10:25:28 -0700 | [diff] [blame] | 134 | Usema sema; |
Russ Cox | 376898c | 2008-09-09 11:50:14 -0700 | [diff] [blame] | 135 | }; |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 136 | }; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 137 | struct String |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 138 | { |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 139 | byte* str; |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 140 | int32 len; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 141 | }; |
Russ Cox | c3077f7 | 2008-12-19 17:11:54 -0800 | [diff] [blame] | 142 | struct Iface |
| 143 | { |
Russ Cox | c7513ea | 2009-07-07 11:02:54 -0700 | [diff] [blame] | 144 | Itab* tab; |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 145 | void* data; |
Russ Cox | c3077f7 | 2008-12-19 17:11:54 -0800 | [diff] [blame] | 146 | }; |
Russ Cox | 2da5022 | 2009-05-20 14:57:55 -0700 | [diff] [blame] | 147 | struct Eface |
| 148 | { |
Russ Cox | c7513ea | 2009-07-07 11:02:54 -0700 | [diff] [blame] | 149 | Type* type; |
Russ Cox | 2da5022 | 2009-05-20 14:57:55 -0700 | [diff] [blame] | 150 | void* data; |
| 151 | }; |
Ken Thompson | f59cb49 | 2010-02-19 20:42:50 -0800 | [diff] [blame] | 152 | struct Complex64 |
| 153 | { |
| 154 | float32 real; |
| 155 | float32 imag; |
| 156 | }; |
| 157 | struct Complex128 |
| 158 | { |
| 159 | float64 real; |
| 160 | float64 imag; |
| 161 | }; |
Ken Thompson | 66a603c | 2008-08-27 17:28:30 -0700 | [diff] [blame] | 162 | |
Rob Pike | 87f2208 | 2009-08-25 15:54:25 -0700 | [diff] [blame] | 163 | struct Slice |
Ken Thompson | 66a603c | 2008-08-27 17:28:30 -0700 | [diff] [blame] | 164 | { // must not move anything |
| 165 | byte* array; // actual data |
Rob Pike | 87f2208 | 2009-08-25 15:54:25 -0700 | [diff] [blame] | 166 | uint32 len; // number of elements |
Russ Cox | 75647d2 | 2008-11-17 12:32:35 -0800 | [diff] [blame] | 167 | uint32 cap; // allocated number of elements |
Ken Thompson | 66a603c | 2008-08-27 17:28:30 -0700 | [diff] [blame] | 168 | }; |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 169 | struct Gobuf |
| 170 | { |
Russ Cox | 3802009 | 2009-06-17 16:31:02 -0700 | [diff] [blame] | 171 | // The offsets of these fields are known to (hard-coded in) libmach. |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 172 | byte* sp; |
| 173 | byte* pc; |
| 174 | G* g; |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 175 | }; |
Ken Thompson | 7b454bb | 2008-07-09 11:35:26 -0700 | [diff] [blame] | 176 | struct G |
Ken Thompson | 4528854 | 2008-07-08 17:19:17 -0700 | [diff] [blame] | 177 | { |
Russ Cox | 133a158 | 2009-10-03 10:37:12 -0700 | [diff] [blame] | 178 | byte* stackguard; // cannot move - also known to linker, libmach, libcgo |
| 179 | byte* stackbase; // cannot move - also known to libmach, libcgo |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 180 | Defer* defer; |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 181 | Panic* panic; |
| 182 | Gobuf sched; |
Russ Cox | 133a158 | 2009-10-03 10:37:12 -0700 | [diff] [blame] | 183 | byte* stack0; |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 184 | byte* entry; // initial function |
Rob Pike | 3835e01 | 2008-07-28 11:29:41 -0700 | [diff] [blame] | 185 | G* alllink; // on allg |
Ken Thompson | e963cba | 2008-07-25 15:55:12 -0700 | [diff] [blame] | 186 | void* param; // passed parameter on wakeup |
| 187 | int16 status; |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 188 | int32 goid; |
Adam Langley | 50d6c81 | 2009-12-18 12:25:53 -0800 | [diff] [blame] | 189 | uint32 selgen; // valid sudog pointer |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 190 | G* schedlink; |
Ken Thompson | 1e1cc4e | 2009-01-27 12:03:53 -0800 | [diff] [blame] | 191 | bool readyonstop; |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 192 | bool ispanic; |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 193 | M* m; // for debuggers, but offset not hard-coded |
Russ Cox | 218c393 | 2009-07-13 17:28:39 -0700 | [diff] [blame] | 194 | M* lockedm; |
Russ Cox | 133a158 | 2009-10-03 10:37:12 -0700 | [diff] [blame] | 195 | void (*cgofn)(void*); // for cgo/ffi |
| 196 | void *cgoarg; |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 197 | }; |
Ken Thompson | 4528854 | 2008-07-08 17:19:17 -0700 | [diff] [blame] | 198 | struct M |
| 199 | { |
Russ Cox | 3802009 | 2009-06-17 16:31:02 -0700 | [diff] [blame] | 200 | // The offsets of these fields are known to (hard-coded in) libmach. |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 201 | G* g0; // goroutine with scheduling stack |
| 202 | void (*morepc)(void); |
Russ Cox | bba278a | 2009-07-08 18:16:09 -0700 | [diff] [blame] | 203 | void* morefp; // frame pointer for more stack |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 204 | Gobuf morebuf; // gobuf arg to morestack |
| 205 | |
Russ Cox | 3802009 | 2009-06-17 16:31:02 -0700 | [diff] [blame] | 206 | // Fields not known to debuggers. |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 207 | uint32 moreframe; // size arguments to morestack |
| 208 | uint32 moreargs; |
| 209 | uintptr cret; // return value from C |
| 210 | uint64 procid; // for debuggers, but offset not hard-coded |
| 211 | G* gsignal; // signal-handling G |
| 212 | uint32 tls[8]; // thread-local storage (for 386 extern register) |
| 213 | Gobuf sched; // scheduling stack |
| 214 | G* curg; // current running goroutine |
Russ Cox | efc86a7 | 2008-11-25 16:48:10 -0800 | [diff] [blame] | 215 | int32 id; |
Russ Cox | da0a7d7 | 2008-12-19 03:13:39 -0800 | [diff] [blame] | 216 | int32 mallocing; |
Russ Cox | 8c357ce | 2009-06-15 21:31:56 -0700 | [diff] [blame] | 217 | int32 gcing; |
Russ Cox | 1ce1791 | 2009-01-26 17:37:05 -0800 | [diff] [blame] | 218 | int32 locks; |
Russ Cox | 6eb251f | 2010-03-24 09:40:09 -0700 | [diff] [blame] | 219 | int32 nomemprof; |
Russ Cox | 218c393 | 2009-07-13 17:28:39 -0700 | [diff] [blame] | 220 | int32 waitnextg; |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 221 | Note havenextg; |
| 222 | G* nextg; |
Russ Cox | 93689d8 | 2009-10-09 15:35:33 -0700 | [diff] [blame] | 223 | M* alllink; // on allm |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 224 | M* schedlink; |
Russ Cox | 376898c | 2008-09-09 11:50:14 -0700 | [diff] [blame] | 225 | uint32 machport; // Return address for Mach IPC (OS X) |
Russ Cox | e29ce17 | 2008-12-18 15:42:28 -0800 | [diff] [blame] | 226 | MCache *mcache; |
Russ Cox | 218c393 | 2009-07-13 17:28:39 -0700 | [diff] [blame] | 227 | G* lockedg; |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 228 | #ifdef __MINGW__ |
| 229 | void* return_address; // saved return address and stack |
| 230 | void* stack_pointer; // pointer for Windows stdcall |
| 231 | void* os_stack_pointer; |
| 232 | #endif |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 233 | }; |
Ken Thompson | 5262003 | 2008-07-14 14:33:39 -0700 | [diff] [blame] | 234 | struct Stktop |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 235 | { |
Russ Cox | 3802009 | 2009-06-17 16:31:02 -0700 | [diff] [blame] | 236 | // The offsets of these fields are known to (hard-coded in) libmach. |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 237 | uint8* stackguard; |
| 238 | uint8* stackbase; |
| 239 | Gobuf gobuf; |
| 240 | uint32 args; |
Russ Cox | bba278a | 2009-07-08 18:16:09 -0700 | [diff] [blame] | 241 | |
| 242 | // Frame pointer: where args start in old frame. |
| 243 | // fp == gobuf.sp except in the case of a reflected |
| 244 | // function call, which uses an off-stack argument frame. |
| 245 | uint8* fp; |
Russ Cox | 83727cc | 2010-03-29 21:48:22 -0700 | [diff] [blame] | 246 | bool free; // call stackfree for this frame? |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 247 | bool panic; // is this frame the top of a panic? |
Ken Thompson | 4528854 | 2008-07-08 17:19:17 -0700 | [diff] [blame] | 248 | }; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 249 | struct Alg |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 250 | { |
Russ Cox | a52fb81 | 2009-06-04 21:09:06 -0700 | [diff] [blame] | 251 | uintptr (*hash)(uint32, void*); |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 252 | uint32 (*equal)(uint32, void*, void*); |
| 253 | void (*print)(uint32, void*); |
| 254 | void (*copy)(uint32, void*, void*); |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 255 | }; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 256 | struct SigTab |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 257 | { |
Russ Cox | dfa5893 | 2008-12-03 14:21:28 -0800 | [diff] [blame] | 258 | int32 flags; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 259 | int8 *name; |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 260 | }; |
Russ Cox | dfa5893 | 2008-12-03 14:21:28 -0800 | [diff] [blame] | 261 | enum |
| 262 | { |
| 263 | SigCatch = 1<<0, |
| 264 | SigIgnore = 1<<1, |
| 265 | SigRestart = 1<<2, |
David Symonds | b586649 | 2009-12-15 18:21:29 -0800 | [diff] [blame] | 266 | SigQueue = 1<<3, |
Russ Cox | dfa5893 | 2008-12-03 14:21:28 -0800 | [diff] [blame] | 267 | }; |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 268 | |
Russ Cox | 6eb251f | 2010-03-24 09:40:09 -0700 | [diff] [blame] | 269 | // NOTE(rsc): keep in sync with extern.go:/type.Func. |
| 270 | // Eventually, the loaded symbol table should be closer to this form. |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 271 | struct Func |
| 272 | { |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 273 | String name; |
| 274 | String type; // go type string |
| 275 | String src; // src file name |
Rob Pike | 87f2208 | 2009-08-25 15:54:25 -0700 | [diff] [blame] | 276 | Slice pcln; // pc/ln tab for this func |
Russ Cox | 6eb251f | 2010-03-24 09:40:09 -0700 | [diff] [blame] | 277 | uintptr entry; // entry pc |
| 278 | uintptr pc0; // starting pc, ln for table |
Russ Cox | a543336 | 2008-11-25 09:23:36 -0800 | [diff] [blame] | 279 | int32 ln0; |
Russ Cox | 6eb251f | 2010-03-24 09:40:09 -0700 | [diff] [blame] | 280 | int32 frame; // stack frame size |
Russ Cox | efc86a7 | 2008-11-25 16:48:10 -0800 | [diff] [blame] | 281 | int32 args; // number of 32-bit in/out args |
| 282 | int32 locals; // number of 32-bit locals |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 283 | }; |
| 284 | |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 285 | /* |
| 286 | * defined macros |
| 287 | * you need super-goru privilege |
| 288 | * to add this list. |
| 289 | */ |
| 290 | #define nelem(x) (sizeof(x)/sizeof((x)[0])) |
| 291 | #define nil ((void*)0) |
| 292 | |
| 293 | /* |
Russ Cox | eee50ae | 2008-12-19 12:05:22 -0800 | [diff] [blame] | 294 | * known to compiler |
| 295 | */ |
| 296 | enum |
| 297 | { |
Russ Cox | a7f6d40 | 2009-01-26 09:56:42 -0800 | [diff] [blame] | 298 | AMEM, |
| 299 | ANOEQ, |
Russ Cox | eee50ae | 2008-12-19 12:05:22 -0800 | [diff] [blame] | 300 | ASTRING, |
Russ Cox | eee50ae | 2008-12-19 12:05:22 -0800 | [diff] [blame] | 301 | AINTER, |
Russ Cox | 2da5022 | 2009-05-20 14:57:55 -0700 | [diff] [blame] | 302 | ANILINTER, |
Russ Cox | 9b6d385 | 2009-01-26 12:36:21 -0800 | [diff] [blame] | 303 | AFAKE, |
Russ Cox | a7f6d40 | 2009-01-26 09:56:42 -0800 | [diff] [blame] | 304 | Amax |
Russ Cox | eee50ae | 2008-12-19 12:05:22 -0800 | [diff] [blame] | 305 | }; |
| 306 | |
Russ Cox | 29aa3ff | 2009-07-02 21:25:46 -0700 | [diff] [blame] | 307 | |
| 308 | enum { |
| 309 | Structrnd = sizeof(uintptr) |
| 310 | }; |
| 311 | |
Russ Cox | eee50ae | 2008-12-19 12:05:22 -0800 | [diff] [blame] | 312 | /* |
Ken Thompson | 47ab1c1 | 2009-01-27 13:23:28 -0800 | [diff] [blame] | 313 | * deferred subroutine calls |
Ken Thompson | 1e1cc4e | 2009-01-27 12:03:53 -0800 | [diff] [blame] | 314 | */ |
| 315 | struct Defer |
| 316 | { |
| 317 | int32 siz; |
| 318 | byte* sp; |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 319 | byte* pc; |
Ken Thompson | 1e1cc4e | 2009-01-27 12:03:53 -0800 | [diff] [blame] | 320 | byte* fn; |
| 321 | Defer* link; |
| 322 | byte args[8]; // padded to actual size |
| 323 | }; |
| 324 | |
| 325 | /* |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 326 | * panics |
| 327 | */ |
| 328 | struct Panic |
| 329 | { |
| 330 | Eface arg; // argument to panic |
| 331 | byte* stackbase; // g->stackbase in panic |
| 332 | Panic* link; // link to earlier panic |
| 333 | bool recovered; // whether this panic is over |
| 334 | }; |
| 335 | |
| 336 | /* |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 337 | * external data |
| 338 | */ |
Russ Cox | a7f6d40 | 2009-01-26 09:56:42 -0800 | [diff] [blame] | 339 | extern Alg algarray[Amax]; |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 340 | extern String emptystring; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 341 | G* allg; |
Russ Cox | 93689d8 | 2009-10-09 15:35:33 -0700 | [diff] [blame] | 342 | M* allm; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 343 | int32 goidgen; |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 344 | extern int32 gomaxprocs; |
Rob Pike | 6e8dbc2 | 2008-09-12 09:44:41 -0700 | [diff] [blame] | 345 | extern int32 panicking; |
Ken Thompson | 79fbbe3 | 2008-11-05 21:50:28 -0800 | [diff] [blame] | 346 | extern int32 maxround; |
Rob Pike | f6d67c9 | 2009-10-13 22:48:03 -0700 | [diff] [blame] | 347 | extern int32 fd; // usually 1; set to 2 when panicking |
Russ Cox | 5328df6 | 2010-01-09 09:47:45 -0800 | [diff] [blame] | 348 | extern int32 gcwaiting; // gc is waiting to run |
Russ Cox | 1b14bdb | 2009-09-22 16:28:32 -0700 | [diff] [blame] | 349 | int8* goos; |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 350 | |
| 351 | /* |
Rob Pike | 8e82a67 | 2008-06-30 11:50:36 -0700 | [diff] [blame] | 352 | * common functions and data |
| 353 | */ |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 354 | int32 strcmp(byte*, byte*); |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 355 | int32 findnull(byte*); |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 356 | int32 findnullw(uint16*); |
Rob Pike | 8e82a67 | 2008-06-30 11:50:36 -0700 | [diff] [blame] | 357 | void dump(byte*, int32); |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 358 | int32 runetochar(byte*, int32); |
Rob Pike | 54ec719 | 2009-04-12 17:01:17 -0700 | [diff] [blame] | 359 | int32 charntorune(int32*, uint8*, int32); |
Rob Pike | 8e82a67 | 2008-06-30 11:50:36 -0700 | [diff] [blame] | 360 | |
Rob Pike | 8e82a67 | 2008-06-30 11:50:36 -0700 | [diff] [blame] | 361 | /* |
Ken Thompson | 4e8142c | 2008-06-16 22:34:50 -0700 | [diff] [blame] | 362 | * very low level c-called |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 363 | */ |
Russ Cox | 7343e03 | 2009-06-17 15:12:16 -0700 | [diff] [blame] | 364 | void gogo(Gobuf*, uintptr); |
| 365 | void gogocall(Gobuf*, void(*)(void)); |
| 366 | uintptr gosave(Gobuf*); |
Russ Cox | 718be32 | 2010-01-25 18:52:55 -0800 | [diff] [blame] | 367 | void ·lessstack(void); |
Russ Cox | 3609624 | 2009-01-16 14:58:14 -0800 | [diff] [blame] | 368 | void goargs(void); |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 369 | void FLUSH(void*); |
Rob Pike | d3204ef | 2008-06-30 14:39:47 -0700 | [diff] [blame] | 370 | void* getu(void); |
Ken Thompson | 4e8142c | 2008-06-16 22:34:50 -0700 | [diff] [blame] | 371 | void throw(int8*); |
Ken Thompson | 594175d | 2008-07-13 14:29:46 -0700 | [diff] [blame] | 372 | uint32 rnd(uint32, uint32); |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 373 | void prints(int8*); |
Russ Cox | efc86a7 | 2008-11-25 16:48:10 -0800 | [diff] [blame] | 374 | void printf(int8*, ...); |
Russ Cox | 3aa063d | 2008-11-23 17:08:55 -0800 | [diff] [blame] | 375 | byte* mchr(byte*, byte, byte*); |
Ken Thompson | e1a06cc | 2008-06-15 20:24:30 -0700 | [diff] [blame] | 376 | void mcpy(byte*, byte*, uint32); |
Russ Cox | 9b6d385 | 2009-01-26 12:36:21 -0800 | [diff] [blame] | 377 | int32 mcmp(byte*, byte*, uint32); |
Russ Cox | 652f556 | 2009-11-20 09:11:46 -0800 | [diff] [blame] | 378 | void memmove(void*, void*, uint32); |
Russ Cox | 596c16e | 2010-03-23 20:48:23 -0700 | [diff] [blame] | 379 | void* mal(uintptr); |
| 380 | void* malx(uintptr size, int32 skip_delta); |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 381 | uint32 cmpstring(String, String); |
| 382 | String gostring(byte*); |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 383 | String gostringw(uint16*); |
Rob Pike | aeb4398 | 2008-06-21 15:36:23 -0700 | [diff] [blame] | 384 | void initsig(void); |
Russ Cox | fb40f88 | 2008-09-22 13:47:53 -0700 | [diff] [blame] | 385 | int32 gotraceback(void); |
Ken Thompson | 751ce3a | 2008-07-11 19:16:39 -0700 | [diff] [blame] | 386 | void traceback(uint8 *pc, uint8 *sp, G* gp); |
Rob Pike | 3835e01 | 2008-07-28 11:29:41 -0700 | [diff] [blame] | 387 | void tracebackothers(G*); |
Rob Pike | c870ac2 | 2008-07-14 20:54:55 -0700 | [diff] [blame] | 388 | int32 open(byte*, int32, ...); |
Rob Pike | c870ac2 | 2008-07-14 20:54:55 -0700 | [diff] [blame] | 389 | int32 write(int32, void*, int32); |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 390 | bool cas(uint32*, uint32, uint32); |
Hector Chu | 6bfe5f5 | 2010-01-06 17:58:55 -0800 | [diff] [blame] | 391 | bool casp(void**, void*, void*); |
| 392 | uint32 xadd(uint32 volatile*, int32); |
Russ Cox | aa3222d8 | 2009-06-02 23:02:12 -0700 | [diff] [blame] | 393 | void jmpdefer(byte*, void*); |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 394 | void exit1(int32); |
| 395 | void ready(G*); |
| 396 | byte* getenv(int8*); |
| 397 | int32 atoi(byte*); |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 398 | void newosproc(M *m, G *g, void *stk, void (*fn)(void)); |
Russ Cox | a67258f | 2008-09-18 15:56:46 -0700 | [diff] [blame] | 399 | void signalstack(byte*, int32); |
| 400 | G* malg(int32); |
| 401 | void minit(void); |
Russ Cox | 0d3a043 | 2009-03-30 00:01:07 -0700 | [diff] [blame] | 402 | Func* findfunc(uintptr); |
Russ Cox | a543336 | 2008-11-25 09:23:36 -0800 | [diff] [blame] | 403 | int32 funcline(Func*, uint64); |
Russ Cox | 79e1db2 | 2008-12-04 08:30:54 -0800 | [diff] [blame] | 404 | void* stackalloc(uint32); |
| 405 | void stackfree(void*); |
Russ Cox | e29ce17 | 2008-12-18 15:42:28 -0800 | [diff] [blame] | 406 | MCache* allocmcache(void); |
| 407 | void mallocinit(void); |
Russ Cox | a7f6d40 | 2009-01-26 09:56:42 -0800 | [diff] [blame] | 408 | bool ifaceeq(Iface, Iface); |
Russ Cox | 2da5022 | 2009-05-20 14:57:55 -0700 | [diff] [blame] | 409 | bool efaceeq(Eface, Eface); |
Russ Cox | a52fb81 | 2009-06-04 21:09:06 -0700 | [diff] [blame] | 410 | uintptr ifacehash(Iface); |
| 411 | uintptr efacehash(Eface); |
| 412 | uintptr nohash(uint32, void*); |
Russ Cox | a7f6d40 | 2009-01-26 09:56:42 -0800 | [diff] [blame] | 413 | uint32 noequal(uint32, void*, void*); |
Russ Cox | 1ce1791 | 2009-01-26 17:37:05 -0800 | [diff] [blame] | 414 | void* malloc(uintptr size); |
Russ Cox | 1ce1791 | 2009-01-26 17:37:05 -0800 | [diff] [blame] | 415 | void free(void *v); |
Russ Cox | 62d627f | 2010-02-08 21:41:54 -0800 | [diff] [blame] | 416 | void addfinalizer(void*, void(*fn)(void*), int32); |
Russ Cox | 4e28cfe | 2010-03-26 14:15:30 -0700 | [diff] [blame] | 417 | void walkfintab(void (*fn)(void*)); |
Russ Cox | 9b1507b | 2010-03-31 11:46:01 -0700 | [diff] [blame] | 418 | void runpanic(Panic*); |
Russ Cox | 4e28cfe | 2010-03-26 14:15:30 -0700 | [diff] [blame] | 419 | |
Russ Cox | 918afd94 | 2009-05-08 15:21:41 -0700 | [diff] [blame] | 420 | void exit(int32); |
| 421 | void breakpoint(void); |
| 422 | void gosched(void); |
| 423 | void goexit(void); |
Russ Cox | 133a158 | 2009-10-03 10:37:12 -0700 | [diff] [blame] | 424 | void runcgo(void (*fn)(void*), void*); |
Russ Cox | 718be32 | 2010-01-25 18:52:55 -0800 | [diff] [blame] | 425 | void ·entersyscall(void); |
| 426 | void ·exitsyscall(void); |
Russ Cox | 4e28cfe | 2010-03-26 14:15:30 -0700 | [diff] [blame] | 427 | G* newproc1(byte*, byte*, int32, int32); |
David Symonds | b586649 | 2009-12-15 18:21:29 -0800 | [diff] [blame] | 428 | void siginit(void); |
Russ Cox | 08579c2 | 2009-12-16 20:20:50 -0800 | [diff] [blame] | 429 | bool sigsend(int32 sig); |
Russ Cox | e4f0681 | 2010-02-08 14:32:22 -0800 | [diff] [blame] | 430 | void gettime(int64*, int32*); |
Russ Cox | 2b7d147 | 2010-03-23 17:01:17 -0700 | [diff] [blame] | 431 | int32 callers(int32, uintptr*, int32); |
Russ Cox | e4f0681 | 2010-02-08 14:32:22 -0800 | [diff] [blame] | 432 | int64 nanotime(void); |
Russ Cox | 63e878a | 2010-03-31 15:55:10 -0700 | [diff] [blame^] | 433 | void panic(int32); |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 434 | |
Russ Cox | 5bb0c4f | 2008-12-15 10:50:33 -0800 | [diff] [blame] | 435 | #pragma varargck argpos printf 1 |
| 436 | |
| 437 | #pragma varargck type "d" int32 |
| 438 | #pragma varargck type "d" uint32 |
| 439 | #pragma varargck type "D" int64 |
| 440 | #pragma varargck type "D" uint64 |
| 441 | #pragma varargck type "x" int32 |
| 442 | #pragma varargck type "x" uint32 |
| 443 | #pragma varargck type "X" int64 |
| 444 | #pragma varargck type "X" uint64 |
| 445 | #pragma varargck type "p" void* |
Russ Cox | 0d3a043 | 2009-03-30 00:01:07 -0700 | [diff] [blame] | 446 | #pragma varargck type "p" uintptr |
Russ Cox | 5bb0c4f | 2008-12-15 10:50:33 -0800 | [diff] [blame] | 447 | #pragma varargck type "s" int8* |
| 448 | #pragma varargck type "s" uint8* |
Ken Thompson | 3657061 | 2009-04-09 18:16:21 -0700 | [diff] [blame] | 449 | #pragma varargck type "S" String |
Russ Cox | 5bb0c4f | 2008-12-15 10:50:33 -0800 | [diff] [blame] | 450 | |
Russ Cox | 3f8aa66 | 2008-12-05 15:24:18 -0800 | [diff] [blame] | 451 | // TODO(rsc): Remove. These are only temporary, |
| 452 | // for the mark and sweep collector. |
| 453 | void stoptheworld(void); |
| 454 | void starttheworld(void); |
| 455 | |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 456 | /* |
| 457 | * mutual exclusion locks. in the uncontended case, |
| 458 | * as fast as spin locks (just a few user-level instructions), |
| 459 | * but on the contention path they sleep in the kernel. |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 460 | * a zeroed Lock is unlocked (no need to initialize each lock). |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 461 | */ |
| 462 | void lock(Lock*); |
| 463 | void unlock(Lock*); |
Russ Cox | 62d627f | 2010-02-08 21:41:54 -0800 | [diff] [blame] | 464 | void destroylock(Lock*); |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 465 | |
| 466 | /* |
Russ Cox | a68592a | 2009-10-14 13:02:05 -0700 | [diff] [blame] | 467 | * sleep and wakeup on one-time events. |
Russ Cox | f7f6329 | 2008-08-05 14:21:42 -0700 | [diff] [blame] | 468 | * before any calls to notesleep or notewakeup, |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 469 | * must call noteclear to initialize the Note. |
| 470 | * then, any number of threads can call notesleep |
| 471 | * and exactly one thread can call notewakeup (once). |
| 472 | * once notewakeup has been called, all the notesleeps |
| 473 | * will return. future notesleeps will return immediately. |
Russ Cox | d28acc4 | 2008-08-04 16:43:49 -0700 | [diff] [blame] | 474 | */ |
Russ Cox | 9682400 | 2008-08-05 14:18:47 -0700 | [diff] [blame] | 475 | void noteclear(Note*); |
| 476 | void notesleep(Note*); |
| 477 | void notewakeup(Note*); |
Ken Thompson | 4e8142c | 2008-06-16 22:34:50 -0700 | [diff] [blame] | 478 | |
| 479 | /* |
Ian Lance Taylor | 9b8da82 | 2009-01-13 09:55:24 -0800 | [diff] [blame] | 480 | * Redefine methods for the benefit of gcc, which does not support |
| 481 | * UTF-8 characters in identifiers. |
| 482 | */ |
| 483 | #ifndef __GNUC__ |
Russ Cox | 718be32 | 2010-01-25 18:52:55 -0800 | [diff] [blame] | 484 | #define runtime_memclr ·memclr |
| 485 | #define runtime_getcallerpc ·getcallerpc |
| 486 | #define runtime_mmap ·mmap |
| 487 | #define runtime_printslice ·printslice |
| 488 | #define runtime_printbool ·printbool |
| 489 | #define runtime_printfloat ·printfloat |
| 490 | #define runtime_printhex ·printhex |
| 491 | #define runtime_printint ·printint |
| 492 | #define runtime_printiface ·printiface |
| 493 | #define runtime_printeface ·printeface |
| 494 | #define runtime_printpc ·printpc |
| 495 | #define runtime_printpointer ·printpointer |
| 496 | #define runtime_printstring ·printstring |
| 497 | #define runtime_printuint ·printuint |
Ken Thompson | f59cb49 | 2010-02-19 20:42:50 -0800 | [diff] [blame] | 498 | #define runtime_printcomplex ·printcomplex |
Russ Cox | 718be32 | 2010-01-25 18:52:55 -0800 | [diff] [blame] | 499 | #define runtime_setcallerpc ·setcallerpc |
Ian Lance Taylor | 9b8da82 | 2009-01-13 09:55:24 -0800 | [diff] [blame] | 500 | #endif |
| 501 | |
| 502 | /* |
Adam Langley | 3f7a324 | 2009-11-13 10:08:51 -0800 | [diff] [blame] | 503 | * This is consistent across Linux and BSD. |
| 504 | * If a new OS is added that is different, move this to |
| 505 | * $GOOS/$GOARCH/defs.h. |
| 506 | */ |
| 507 | #define EACCES 13 |
| 508 | |
| 509 | /* |
Russ Cox | 1f8a40d | 2009-01-22 16:23:44 -0800 | [diff] [blame] | 510 | * low level go-called |
Ken Thompson | 4e8142c | 2008-06-16 22:34:50 -0700 | [diff] [blame] | 511 | */ |
Russ Cox | 22a5c78 | 2009-10-15 23:10:49 -0700 | [diff] [blame] | 512 | uint8* runtime_mmap(byte*, uint32, int32, int32, int32, uint32); |
| 513 | void runtime_memclr(byte*, uint32); |
| 514 | void runtime_setcallerpc(void*, void*); |
| 515 | void* runtime_getcallerpc(void*); |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 516 | |
| 517 | /* |
Ken Thompson | 4e8142c | 2008-06-16 22:34:50 -0700 | [diff] [blame] | 518 | * runtime go-called |
Ken Thompson | bbb2073 | 2008-06-05 19:38:39 -0700 | [diff] [blame] | 519 | */ |
Russ Cox | 22a5c78 | 2009-10-15 23:10:49 -0700 | [diff] [blame] | 520 | void runtime_printbool(bool); |
| 521 | void runtime_printfloat(float64); |
| 522 | void runtime_printint(int64); |
| 523 | void runtime_printiface(Iface); |
| 524 | void runtime_printeface(Eface); |
| 525 | void runtime_printstring(String); |
| 526 | void runtime_printpc(void*); |
| 527 | void runtime_printpointer(void*); |
| 528 | void runtime_printuint(uint64); |
| 529 | void runtime_printhex(uint64); |
| 530 | void runtime_printslice(Slice); |
Ken Thompson | f59cb49 | 2010-02-19 20:42:50 -0800 | [diff] [blame] | 531 | void runtime_printcomplex(Complex128); |
Russ Cox | 4e28cfe | 2010-03-26 14:15:30 -0700 | [diff] [blame] | 532 | void reflect·call(byte*, byte*, uint32); |
Russ Cox | 63e878a | 2010-03-31 15:55:10 -0700 | [diff] [blame^] | 533 | void ·panic(Eface); |
| 534 | |
| 535 | /* |
| 536 | * runtime c-called (but written in Go) |
| 537 | */ |
| 538 | void ·newError(String, Eface*); |
| 539 | void ·printany(Eface); |
| 540 | void ·newTypeAssertionError(Type*, Type*, Type*, String*, String*, String*, String*, Eface*); |
Rob Pike | 6db99de | 2008-07-08 10:36:43 -0700 | [diff] [blame] | 541 | |
| 542 | /* |
Russ Cox | 1f8a40d | 2009-01-22 16:23:44 -0800 | [diff] [blame] | 543 | * wrapped for go users |
Rob Pike | 6db99de | 2008-07-08 10:36:43 -0700 | [diff] [blame] | 544 | */ |
Russ Cox | 1f8a40d | 2009-01-22 16:23:44 -0800 | [diff] [blame] | 545 | float64 Inf(int32 sign); |
| 546 | float64 NaN(void); |
| 547 | float32 float32frombits(uint32 i); |
| 548 | uint32 float32tobits(float32 f); |
| 549 | float64 float64frombits(uint64 i); |
| 550 | uint64 float64tobits(float64 f); |
| 551 | float64 frexp(float64 d, int32 *ep); |
| 552 | bool isInf(float64 f, int32 sign); |
| 553 | bool isNaN(float64 f); |
| 554 | float64 ldexp(float64 d, int32 e); |
| 555 | float64 modf(float64 d, float64 *ip); |
| 556 | void semacquire(uint32*); |
| 557 | void semrelease(uint32*); |
David Symonds | b586649 | 2009-12-15 18:21:29 -0800 | [diff] [blame] | 558 | String signame(int32 sig); |
| 559 | |
Russ Cox | 5ddaf9a | 2009-07-08 15:00:54 -0700 | [diff] [blame] | 560 | |
Russ Cox | 764b6ec | 2009-07-08 13:55:57 -0700 | [diff] [blame] | 561 | void mapassign(Hmap*, byte*, byte*); |
| 562 | void mapaccess(Hmap*, byte*, byte*, bool*); |
| 563 | struct hash_iter* mapiterinit(Hmap*); |
| 564 | void mapiternext(struct hash_iter*); |
| 565 | bool mapiterkey(struct hash_iter*, void*); |
| 566 | void mapiterkeyvalue(struct hash_iter*, void*, void*); |
Russ Cox | 7a0f4ca | 2009-09-08 13:46:54 -0700 | [diff] [blame] | 567 | Hmap* makemap(Type*, Type*, uint32); |
Russ Cox | 5ddaf9a | 2009-07-08 15:00:54 -0700 | [diff] [blame] | 568 | |
Russ Cox | 7a0f4ca | 2009-09-08 13:46:54 -0700 | [diff] [blame] | 569 | Hchan* makechan(Type*, uint32); |
Russ Cox | 5ddaf9a | 2009-07-08 15:00:54 -0700 | [diff] [blame] | 570 | void chansend(Hchan*, void*, bool*); |
| 571 | void chanrecv(Hchan*, void*, bool*); |
Russ Cox | 653cef1 | 2009-08-26 10:47:18 -0700 | [diff] [blame] | 572 | void chanclose(Hchan*); |
| 573 | bool chanclosed(Hchan*); |
Russ Cox | de7920e | 2009-08-26 12:42:22 -0700 | [diff] [blame] | 574 | int32 chanlen(Hchan*); |
| 575 | int32 chancap(Hchan*); |
Russ Cox | 92e9257 | 2009-07-10 16:32:26 -0700 | [diff] [blame] | 576 | |
| 577 | void ifaceE2I(struct InterfaceType*, Eface, Iface*); |