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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#ifndef _JOVE_API_SYSCALL_H
#define _JOVE_API_SYSCALL_H 1
#include <stddef.h>
#include <stdint.h>
#include "obj.h"
/* General syscall behavior:
* If the message passed is not a JOVE_OBJ_MESSAGE type, the kernel will return EBADOBJ.
* If the message is too small to hold the target path, the kernel will return ETOOSMALL.
* If the target path does not target a real object, the kernel will return EBADPATH.
* If the target does not support the callid, the kernel will return EBADARG.
* Otherwise, behavior depends on the syscall specified in callid.
* */
struct syscall_header
{
uint16_t callid;
uint16_t pathlen;
objpath_part_t path[];
};
/* If the message is too small for data, the kernel will return ETOOSMALL.
* */
struct syscall_generic_write
{
size_t len;
char data[];
};
/* If the message is too small for path, the kernel will return ETOOSMALL.
* If the path does not point to an object, the kernel will return EBADPATH.
* */
struct syscall_generic_objpath
{
uint16_t pathlen;
objpath_part_t path[];
};
/* The kernel will return the physical memory address of this untyped object. */
#define SYSCALL_UNTYPED_ADDRESS 0
/* The kernel will return the size of this untyped object. */
#define SYSCALL_UNTYPED_SIZE 1
/* If newtype is not a valid JOVE object, the kernel will return EBADARG.
* If the untyped object is too small for this object, the kernel will return ETOOSMALL.
* If the untyped object is too big for this object, the kernel will return ETOOBIG.
* New objects will be initialized with default values.
* */
#define SYSCALL_UNTYPED_RETYPE 2
struct syscall_untyped_retype
{
uint16_t newtype;
};
/* Splits the tail of the untyped object into another untyped object with [bytes] length.
* If bytes is less than JOVE_UNTYPED_MINSIZE, the kernel will return ETOOSMALL.
* If the syscall message is too small for dest_path, the kernel will return ETOOSMALL.
* If dest_path does not target a JOVE_OBJ_NONE object, the kernel will return EBADOBJ.
* Destination path will be occupied by the untyped object created by the split.
* */
#define SYSCALL_UNTYPED_SPLIT 3
/* Follows rules declared above syscall_generic_objpath.
* If dest_path does not target a JOVE_OBJ_UNTYPED object, the kernel will return EBADPATH.
* If the dest untyped object is not adjacent to the target object, the kernel will return EBADOBJ.
* Destination path will be set to JOVE_OBJ_NONE and target untyped will grow to include the object.
* */
#define SYSCALL_UNTYPED_MERGE 4
struct syscall_untyped_split
{
size_t bytes;
uint16_t dest_pathlen;
objpath_part_t dest_path[];
};
/* Follows rules declared above syscall_generic_objpath.
* Returns the object type at path.
* */
#define SYSCALL_OBJDIR_OBJTYPE 0
/*
* If virtual_address does not have a page table, the kernel will return ENOMAP.
* If virtual_address already has a mapping, the kernel will return EEXIST.
* Follows the rules defined above syscall_pagedir_map.
* Maps the untyped page frame to the page table at virtual_address with the passed flags bits.
* */
#define SYSCALL_PAGEDIR_MAP_FRAME 0
/* If virtual_address already has a page table, the kernel will return EHASMAP.
* Follows the rules defined above syscall_pagedir_map.
* Creates a page table using the untyped object for memory allocation at virtual_address.
* Flags bits are always set to writeable and executable.
* */
#define SYSCALL_PAGEDIR_MAP_TABLE 1
/* If virtual_address is above the JOVE_USER_MEMORY_LIMIT, the kernel will return EBADARG.
* If the message is too small for untyped_path, the kernel will return ETOOSMALL.
* If untyped_path does not point to a valid JOVE_OBJ_UNTYPED, the kernel will return EBADOBJ.
* If the untyped object is not aligned to 0x1000, the kernel will return EALIGN.
* If the untyped object is not sized to 0x1000, the kernel will return EBADSIZE.
*
* */
struct syscall_pagedir_flags
{
uint8_t writeable : 1;
uint8_t executable : 1;
uint8_t flg_unused : 6;
};
struct syscall_pagedir_map
{
struct syscall_pagedir_flags flags;
uintptr_t virtual_address;
uint16_t untyped_pathlen;
objpath_part_t untyped_path[];
};
#define SYSCALL_VTT_WRITE 0
#endif
|