This commit is contained in:
2026-08-11 17:48:20 +02:00
committed by Marvin Friedrich
parent cf33867e68
commit 0e2d4ed8c6
55 changed files with 279 additions and 346 deletions
+3 -2
View File
@@ -3,6 +3,7 @@
#include <zinnia/status.h>
#include <zinnia/syscall_stubs.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -10,12 +11,12 @@ extern "C" {
// Blocks the calling thread if *addr == expected.
// Returns immediately if the value at addr has changed.
static inline zn_status_t zn_futex_wait(int* addr, int expected) {
static inline zn_status_t zn_futex_wait(int32_t* addr, int32_t expected) {
return zn_syscall2(addr, expected, ZN_SYSCALL_FUTEX_WAIT);
}
// Wakes up to `count` threads waiting on the given futex address.
static inline zn_status_t zn_futex_wake(int* addr, int count) {
static inline zn_status_t zn_futex_wake(int32_t* addr, int32_t count) {
return zn_syscall2(addr, count, ZN_SYSCALL_FUTEX_WAKE);
}
+2 -3
View File
@@ -24,9 +24,8 @@ static inline zn_status_t zn_handle_validate(zn_handle_t handle) {
return zn_syscall1(handle, ZN_SYSCALL_HANDLE_VALIDATE);
}
// Drops an object handle.
// All further references using this handle are invalid. The numerical value
// may become valid again, but it is an error to keep using it.
// Drops an object handle. All further references using this handle are invalid.
// The numerical value may become valid again, but it is an error to keep using it.
// The underlying object gets freed only once no other handle references it.
static inline zn_status_t zn_handle_drop(zn_handle_t handle) {
return zn_syscall1(handle, ZN_SYSCALL_HANDLE_DROP);
+26
View File
@@ -0,0 +1,26 @@
#ifndef ZINNIA_IPC_H
#define ZINNIA_IPC_H
#include <zinnia/handle.h>
#include <zinnia/rights.h>
#include <zinnia/status.h>
#include <zinnia/syscall_stubs.h>
#ifdef __cplusplus
extern "C" {
#endif
// Defines an IPC window.
struct zn_ipcw {
zn_handle_t handles[16];
};
static inline zn_status_t zn_ipcw_init(struct zn_ipcw** ipcw) {
return ZN_ERR_UNSUPPORTED;
}
#ifdef __cplusplus
}
#endif
#endif
-46
View File
@@ -1,46 +0,0 @@
#pragma once
#include <zinnia/handle.h>
#include <stddef.h>
#include <stdint.h>
#define IPC_GET_STRING(data, str, buf) \
do { \
memcpy(buf, (data) + (str)->offset, (str)->len); \
} while (0)
#define IPC_SET_STRING(cursor, data, field, string) \
do { \
const size_t _len = strlen(string); \
(field)->offset = cursor; \
(field)->len = _len; \
memcpy(data + cursor, string, _len); \
cursor += _len; \
} while (0)
enum ipc_msg_id {
IPC_MSG_FOO,
IPC_MSG_BAR,
IPC_MSG_BAZ,
};
struct ipc_array {
uint16_t offset;
uint16_t len;
};
struct ipc_option {
uint16_t offset;
};
struct ipc_init_register_rq {
enum ipc_msg_id id;
struct ipc_array name;
char data[];
};
struct ipc_kernel_msg {
enum ipc_msg_id id;
struct ipc_array name;
char data[];
};
+1 -1
View File
@@ -25,7 +25,7 @@ enum zn_vm_flags {
// Map at a fixed address, replacing whatever is in the way.
ZN_VM_MAP_FIXED = 1 << 8,
// Map at a fixed address, failing if anything is in the way.
ZB_VM_MAP_FIXED_NOREPLACE = 1 << 9,
ZN_VM_MAP_FIXED_NOREPLACE = 1 << 9,
// Map the entire range immediately.
ZN_VM_MAP_POPULATE = 1 << 10,
};
+3 -1
View File
@@ -13,7 +13,9 @@ static inline zn_status_t zn_ns_create(zn_handle_t* out) {
return ZN_ERR_UNSUPPORTED;
}
static inline zn_status_t zn_ns_move(zn_handle_t handle, zn_handle_t target_namespace) {
// Moves a handle to another namespace.
// The handle must have the `ZN_RIGHT_MOVE` right.
static inline zn_status_t zn_ns_move(zn_handle_t handle, zn_handle_t target_ns) {
return ZN_ERR_UNSUPPORTED;
}