Mercurial > lcfOS
view kernel/src/memory.c3 @ 395:3b0c495e3008
Speed improvements
author | Windel Bouwman |
---|---|
date | Fri, 23 May 2014 14:28:03 +0200 |
parents | 6ae782a085e0 |
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); } }