summaryrefslogtreecommitdiffstats
path: root/include/object.h
blob: 94e6b1511ed11782d94a9a5052fc88daf0b0a299 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _JOVE_OBJECT_H
#define _JOVE_OBJECT_H 

#include <stdint.h>

enum {
    INIT_OBJECT_ROOTDIR = 0,
    INIT_OBJECT_PAGEMAP,
    INIT_OBJECT_PROCESSOR_DIR,
    INIT_OBJECT_UNTYPED_DIR,
    INIT_OBJECT_INITRD_DIR,
    INIT_OBJECT_TCB,
    INIT_OBJECT_MESSAGE,
    INIT_OBJECT_LOG
};

enum
{
    /* Generic objects */
    KO_NONE = 0,
    KO_OBJECT_DIRECTORY,
    KO_INIT_DATA,
    KO_MEMORY_UNTYPED,
    KO_MEMORY_MAPPING, //4KiB aligned fixed width
    KO_INITRD_FILE,
    KO_TCB,
    KO_MESSAGE,
    /* Device objects*/
    KO_DEV_INVALID = 0x100,
    KO_DEV_PROCESSOR,
    KO_DEV_UART
};

#define KO_MESSAGE_BYTES 4096
#define KO_MESSAGE_ALIGN 0x1000

typedef uint8_t path_byte_t;
typedef uint16_t obj_type_t;

typedef struct jove_ObjectDirectoryEntry
{
    obj_type_t type;
    union {
        struct {
            unsigned char lock;
            char u0;
        };
        unsigned short flg;
    };
    uintmax_t data;
} objdir_entry_t;

#define OBJECT_DIRECTORY_MAX_ENTRIES 256

typedef struct jove_ObjectDirectory
{
    union {
        objdir_entry_t self;
        objdir_entry_t entries[OBJECT_DIRECTORY_MAX_ENTRIES];
    };
} objdir_t;

objdir_entry_t *objdir_seek(objdir_t *dir, uint8_t *path, unsigned long pathw);
unsigned long objdir_pathw(objdir_t *dir, uint8_t *path);

#endif