LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "arch_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 #include "defs_GOOS_GOARCH.h" | 7 #include "defs_GOOS_GOARCH.h" |
8 #include "os_GOOS.h" | 8 #include "os_GOOS.h" |
9 #include "malloc.h" | 9 #include "malloc.h" |
10 | 10 |
11 enum | 11 enum |
12 { | 12 { |
13 EAGAIN = 11, | |
14 ENOMEM = 12, | |
15 _PAGE_SIZE = 4096, | 13 _PAGE_SIZE = 4096, |
16 }; | 14 }; |
17 | 15 |
18 static int32 | 16 static int32 |
19 addrspace_free(void *v, uintptr n) | 17 addrspace_free(void *v, uintptr n) |
20 { | 18 { |
21 int32 errval; | 19 int32 errval; |
22 uintptr chunk; | 20 uintptr chunk; |
23 uintptr off; | 21 uintptr off; |
24 static byte vec[4096]; | 22 static byte vec[4096]; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 125 } |
128 return; | 126 return; |
129 } | 127 } |
130 | 128 |
131 p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_FIXED|MAP_PRIV
ATE, -1, 0); | 129 p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_FIXED|MAP_PRIV
ATE, -1, 0); |
132 if(p == (void*)ENOMEM) | 130 if(p == (void*)ENOMEM) |
133 runtime·throw("runtime: out of memory"); | 131 runtime·throw("runtime: out of memory"); |
134 if(p != v) | 132 if(p != v) |
135 runtime·throw("runtime: cannot map pages in arena address space"
); | 133 runtime·throw("runtime: cannot map pages in arena address space"
); |
136 } | 134 } |
LEFT | RIGHT |