comparison kernel/memory.c3 @ 402:0fb6633c42f6

Moved several files to logical locations
author Windel Bouwman
date Thu, 19 Feb 2015 00:13:07 +0100
parents kernel/src/memory.c3@6ae782a085e0
children ad6be5454067
comparison
equal deleted inserted replaced
401:994c00d55fd5 402:0fb6633c42f6
1 module memory;
2
3 import arch;
4 import io;
5
6 var int ptr;
7
8 // Let the heap grow upwards..
9
10 function void init()
11 {
12 ptr = 0x80000;
13 }
14
15 function byte* alloc(int size)
16 {
17 var int ptr2;
18 ptr2 = ptr;
19
20 io.print2("alloc size ", size);
21 io.print2("alloc address ", ptr);
22
23 // Increment new free point:
24 ptr = ptr + size;
25 return ptr2;
26 }
27
28 function void memcpy(byte* dst, byte* src, int size)
29 {
30 var int i;
31 for (i = 0; i < size; i = i + 1)
32 {
33 *(dst + i) = *(src + i);
34 }
35 }
36