summaryrefslogtreecommitdiffstats
path: root/lib/libjove/include/syscall.h
blob: 5d872a3ac1a848b23af38fb0e6300b98f5c8d51a (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
#ifndef _LIBJOVE_SYSCALL_H
#define _LIBJOVE_SYSCALL_H 1

#include <stdint.h>

#include <kernel/object.h>
#include <jove/object.h>

#define SYSCALL_PAYLOAD_PUTL(buf, at, v, type) \
    if(at + sizeof(type) > KO_MESSAGE_BYTES) return EJOVE_TOOBIG; \
    *((type*)(&buf[at])) = v; \
    at += sizeof(type)

#define SYSCALL_PAYLOAD_SAVEPTR(buf, at, type, val) \
    if(at + sizeof(type) >= KO_MESSAGE_BYTES) return EJOVE_TOOBIG; \
    val = (type*)(&buf[at]); \
    at += sizeof(type)

#define SYSCALL_PAYLOAD_PUTOBJ(buf, at, obj) \
    at = path_tobuf(JOVE_OBJECT_TYPED(obj), buf, at, KO_MESSAGE_BYTES); \
    if(at < 0) return -at


int _syscall_invoke(void);
void _syscall_debug_putc(char c);

int _syscall_invoke_objdir_getmemb(KernelObjectDirectory *dir, uint8_t member, obj_type_t *result);
int _syscall_invoke_objdir_lastmemb(KernelObjectDirectory *dir, uint8_t *result);
int _syscall_invoke_objdir_move(
        KernelObjectDirectory *dir, uint8_t memb, 
        KernelObjectDirectory *dest_dir, uint8_t dest_memb);

int _syscall_invoke_untyped_size(KernelObjectUntyped *untyped, size_t *bytes);
int _syscall_invoke_untyped_split(KernelObjectUntyped *path, size_t bytes, KernelObjectUntyped *dest);
int _syscall_invoke_untyped_merge(KernelObjectUntyped *a, KernelObjectUntyped *b);
int _syscall_invoke_untyped_alignment(KernelObjectUntyped *path, size_t *alignment);

#endif