view 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
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 byte* 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 ptr2;
}

function void memcpy(byte* dst, byte* src, int size)
{
    var int i;
    for (i = 0; i < size; i = i + 1)
    {
        *(dst + i) = *(src + i);
    }
}