summaryrefslogtreecommitdiffstats
path: root/include/object.h
blob: 190b0827fff7cd8fd1df4e2e6fafaff1fb903e6f (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
#ifndef _JOVE_OBJECT_H
#define _JOVE_OBJECT_H 

#include <stdint.h>

#if defined(__x86_64__)
#include "arch/x86_64/object.h"
#endif

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