view kernel/src/memory.c3 @ 399:a7c444404df9

Fix hexwrite
author Windel Bouwman
date Fri, 20 Jun 2014 16:36:49 +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);
    }
}