summaryrefslogtreecommitdiffstats
path: root/apps/init/main.c
blob: 17b825e63798bb3dce69ef64c7eff090f4fba6ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdint.h>
#include <string.h>
#include <kernel/object.h>
#include <jove/jove.h>
#include <jove/object.h>
#include <jove/syscall.h>

#include "memory.h"

/**This program acts as a memory and process server.*/

#define INIT_HEAP_START_BYTES 8192
__attribute__((section(".bss.heap")))
uint8_t init_heap[INIT_HEAP_START_BYTES];
size_t init_heap_start = (uintptr_t)init_heap;

__attribute__((noreturn))
static void
spin_fail(void)
{
    for(;;);
}

void*
init_bumpalloc(size_t bytes)
{
    void *r = (void*)init_heap_start;
    init_heap_start += bytes;
    return r;
}

KernelObjectDirectory untypedDirectory;

void
main(void *message_ptr)
{
    libjove_init(
            INIT_OBJECT_MESSAGE,
            message_ptr);
    _jove_alloc = init_bumpalloc;

    jove_kprintf("Hello, Userland!\n");
    pager_setup();

    for(;;);
}