Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2010 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 | |
5 #include "runtime.h" | |
6 #include "malloc.h" | |
7 | |
8 extern int8 end[]; | |
9 static int8 *bloc = { end }; | |
10 | |
11 enum | |
12 { | |
13 Round = 7 | |
14 }; | |
15 | |
16 void* | |
17 SysAlloc(uintptr ask) | |
18 { | |
19 uintptr bl; | |
20 ········ | |
21 // Plan9 sbrk from /sys/src/libc/9sys/sbrk.c | |
22 bl = ((uintptr)bloc + Round) & ~Round; | |
23 if(brk_((void*)(bl + ask)) < 0) | |
24 return (void*)-1; | |
25 bloc = (int8*)bl + ask; | |
26 return (void*)bl; | |
27 } | |
28 | |
29 void | |
30 SysFree(void *v, uintptr n) | |
31 { | |
32 USED(v, n); | |
rsc1
2010/09/24 22:58:47
It's probably a good idea to implement this
at lea
paulzhol
2010/10/07 22:52:23
Done.
| |
33 } | |
34 | |
35 void | |
36 SysUnused(void *v, uintptr n) | |
37 { | |
38 USED(v, n); | |
39 } | |
40 | |
OLD | NEW |