summaryrefslogtreecommitdiffstats
path: root/lib/libjove/include/arch/x86_64/object-pagemap.h
blob: 48e959ea47536868fa5dafda69b14daf287c9090 (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
#ifndef _LIBJOVE_ARCH_x86_64_OBJECT_PAGEMAP_H
#define _LIBJOVE_ARCH_x86_64_OBJECT_PAGEMAP_H 1

#include <jove/object-typed.h>
#include <jove/object-dir.h>
#include <jove/object-untyped.h>

typedef struct KernelObjectPageMap
{
    KernelObjectTyped typed;
} KernelObjectPageMap;

KernelObjectPageMap *jove_object_as_pagemap(KernelObjectTyped *typed);

/**@FUNC Populates a given region of memory for a page map value.
 * @PARAM pagemap address of pagemap cache object.
 * @PARAM dir directory this memory is a member of.
 * @PARAM memb index into directory to place object.*/
void _jove_alloc_pagemap_inplace(
        KernelObjectPageMap *pagemap,
        KernelObjectDirectory *dir,
        uint8_t memb);

/**@FUNC Allocates a region of memory to represent a page map.
 * @PARAM dir directory to place new value in.
 * @PARAM memb index into directory to place object.
 * @RETURN newly allocated object. NULL on failure.
 * Possible failures:
 *      EJOVE_FULL: Slot is already taken by an existing object.
 *      EJOVE_NOALLOC: libjove does not have an allocator yet.*/
KernelObjectPageMap* _jove_alloc_pagemap(
        KernelObjectDirectory *dir, 
        uint8_t memb);

int jove_pagemap_exists(
        KernelObjectPageMap *map,
        uint8_t depth,
        uint16_t *path);

JoveError jove_pagemap_map(
        KernelObjectPageMap *map,
        uint8_t depth,
        uint16_t *path,
        KernelObjectUntyped *page);

JoveError jove_pagemap_map_unmap(
        KernelObjectPageMap *map,
        uint8_t depth,
        uint16_t *path,
        KernelObjectUntyped *dest);

#endif