summaryrefslogtreecommitdiffstats
path: root/hal/memory.h
blob: ca021ef2abd149895fb9f2a445d2f70980f79969 (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
#ifndef _JOVE_HAL_MEMORY_H
#define _JOVE_HAL_MEMORY_H 1

#include "obj.h"
#include "api/syscall.h"

typedef struct jove_obj_untyped
{
    size_t limit;
} jove_untyped_t;

#define JOVE_UNTYPED_MINSIZE 0x10

void mem_setup_untyped(void);

void *phys_tovirt(uintptr_t phys);

uintptr_t untyped_address(jove_owned_obj_t *tgt);
size_t untyped_size(jove_owned_obj_t *tgt);

int untyped_split(jove_owned_obj_t *tgt, jove_owned_obj_t *dst, size_t bytes);
int untyped_merge(jove_owned_obj_t *a, jove_owned_obj_t *b);
int untyped_retype(jove_owned_obj_t *tgt, uint8_t newtype);

int pagedir_map_frame(
        jove_owned_obj_t *tgt, jove_owned_obj_t *untyped_obj, 
        uintptr_t vptr, struct syscall_pagedir_flags flg);
int pagedir_map_table(
        jove_owned_obj_t *tgt, jove_owned_obj_t *untyped_obj, 
        uintptr_t vptr, struct syscall_pagedir_flags flg);

#endif