Kernel: Implement basic shared memory objects

These can allocate memory that can be shared between processes using
a global key. There is currenly no safety checks meaning anyone can
map any shared memory object just by trying to map every possible key.
This commit is contained in:
2024-05-29 15:58:46 +03:00
parent 99270e96a9
commit d4d530e6c8
9 changed files with 224 additions and 0 deletions

View File

@@ -36,6 +36,11 @@ int poweroff(int command);
int load_keymap(const char* path);
// Create shared memory object and return its key or -1 on error
long smo_create(size_t size, int prot);
// Map shared memory object defined by its key and return address or null on error
void* smo_map(long key);
__END_DECLS
#endif

View File

@@ -74,6 +74,8 @@ __BEGIN_DECLS
O(SYS_LISTEN, listen) \
O(SYS_PSELECT, pselect) \
O(SYS_TRUNCATE, truncate) \
O(SYS_SMO_CREATE, smo_create) \
O(SYS_SMO_MAP, smo_map) \
enum Syscall
{