summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/tiny/mem.c
diff options
context:
space:
mode:
authorKai Backman <kaib@golang.org>2010-02-18 23:33:21 -0800
committerKai Backman <kaib@golang.org>2010-02-18 23:33:21 -0800
commitda5d64eed76ca39a8024162b4b449a4485d4769b (patch)
treedc1145fe98dd33013d009c048499a7dad7162b1f /src/pkg/runtime/tiny/mem.c
parent26e036cd78c7bdd53c79b94ce3a13cf15f447c32 (diff)
downloadgolang-da5d64eed76ca39a8024162b4b449a4485d4769b.tar.gz
combined pchw and embedded into tiny. added section on arm to README
R=rsc CC=golang-dev http://codereview.appspot.com/194151 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/runtime/tiny/mem.c')
-rw-r--r--src/pkg/runtime/tiny/mem.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/pkg/runtime/tiny/mem.c b/src/pkg/runtime/tiny/mem.c
new file mode 100644
index 000000000..a66a4a731
--- /dev/null
+++ b/src/pkg/runtime/tiny/mem.c
@@ -0,0 +1,41 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "runtime.h"
+#include "malloc.h"
+
+// Assume there's an arbitrary amount of memory starting at "end".
+// Sizing PC memory is beyond the scope of this demo.
+
+void*
+SysAlloc(uintptr ask)
+{
+ static byte *p;
+ extern byte end[];
+ byte *q;
+
+ if(p == nil) {
+ p = end;
+ p += 7 & -(uintptr)p;
+ }
+ ask += 7 & -ask;
+
+ q = p;
+ p += ask;
+ ·memclr(q, ask);
+ return q;
+}
+
+void
+SysFree(void *v, uintptr n)
+{
+ USED(v, n);
+}
+
+void
+SysUnused(void *v, uintptr n)
+{
+ USED(v, n);
+}
+