Mercurial > lcfOS
view kernel/src/memory.c3 @ 393:6ae782a085e0
Added init program
author | Windel Bouwman |
---|---|
date | Sat, 17 May 2014 21:17:40 +0200 |
parents | 2ec730e45ea1 |
children |
line wrap: on
line source
module memory; import arch; import io; var int ptr; // Let the heap grow upwards.. function void init() { ptr = 0x80000; } function u8* alloc(int size) { var int ptr2; ptr2 = ptr; io.print2("alloc size ", size); io.print2("alloc address ", ptr); // Increment new free point: ptr = ptr + size; return cast<u8*>(ptr2); } function void memcpy(u8* dst, u8* src, int size) { // var int i; for (i = 0; i < size; i = i + 1) { *(dst + i) = *(src + i); } }