summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/embedded/mem.c
blob: 0232c6c8e55e3efdf84a0c63b1ff97155178fc96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// 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".

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);
}