This commit is contained in:
2026-09-15 22:21:27 +02:00
parent 9e5ed517bc
commit 09ab2f1a83
24 changed files with 356 additions and 357 deletions
-10
View File
@@ -1,10 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/archctl.h>
#include <kernel/vdso.h>
zn_status_t zn_archctl(zn_archctl_t op, void* value) {
return zn_syscall2(op, value, ZN_SYSCALL_ARCHCTL);
}
VDSO_SYMBOL(zn_archctl);
-45
View File
@@ -1,45 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/channel.h>
#include <kernel/vdso.h>
zn_status_t zn_channel_create(enum zn_channel_flags flags, zn_handle_t* endpoint0, zn_handle_t* endpoint1) {
return zn_syscall3(flags, endpoint0, endpoint1, ZN_SYSCALL_CHANNEL_CREATE);
}
VDSO_SYMBOL(zn_channel_create);
zn_status_t zn_channel_write(
zn_handle_t channel,
const zn_handle_t* handles,
const void* bytes,
size_t num_handles,
size_t num_bytes
) {
return zn_syscall5(channel, handles, bytes, num_handles, num_bytes, ZN_SYSCALL_CHANNEL_WRITE);
}
VDSO_SYMBOL(zn_channel_write);
zn_status_t zn_channel_read(
zn_handle_t channel,
zn_handle_t* handles,
void* bytes,
size_t num_handles,
size_t num_bytes,
size_t* read_handles,
size_t* read_bytes
) {
return zn_syscall7(
channel,
handles,
bytes,
num_handles,
num_bytes,
read_handles,
read_bytes,
ZN_SYSCALL_CHANNEL_READ
);
}
VDSO_SYMBOL(zn_channel_read);
-16
View File
@@ -1,16 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/futex.h>
#include <kernel/vdso.h>
zn_status_t zn_futex_wait(int32_t* addr, int32_t expected) {
return zn_syscall2(addr, expected, ZN_SYSCALL_FUTEX_WAIT);
}
VDSO_SYMBOL(zn_futex_wait);
zn_status_t zn_futex_wake(int32_t* addr, int32_t count) {
return zn_syscall2(addr, count, ZN_SYSCALL_FUTEX_WAKE);
}
VDSO_SYMBOL(zn_futex_wake);
-22
View File
@@ -1,22 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/handle.h>
#include <kernel/vdso.h>
zn_status_t zn_handle_validate(zn_handle_t handle) {
return zn_syscall1(handle, ZN_SYSCALL_HANDLE_VALIDATE);
}
VDSO_SYMBOL(zn_handle_validate);
zn_status_t zn_handle_drop(zn_handle_t handle) {
return zn_syscall1(handle, ZN_SYSCALL_HANDLE_DROP);
}
VDSO_SYMBOL(zn_handle_drop);
zn_status_t zn_handle_clone(zn_handle_t handle, zn_rights_t cloned_rights, zn_handle_t* cloned) {
return zn_syscall3(handle, cloned_rights, cloned, ZN_SYSCALL_HANDLE_CLONE);
}
VDSO_SYMBOL(zn_handle_clone);
-35
View File
@@ -1,35 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/mem.h>
#include <kernel/vdso.h>
zn_status_t zn_vmo_create(size_t length, zn_handle_t* out) {
return zn_syscall2(length, out, ZN_SYSCALL_VMO_CREATE);
}
VDSO_SYMBOL(zn_vmo_create);
zn_status_t zn_vmo_create_phys(uintptr_t phys_addr, size_t length, zn_handle_t* out) {
return zn_syscall3(phys_addr, length, out, ZN_SYSCALL_VMO_CREATE_PHYS);
}
VDSO_SYMBOL(zn_vmo_create_phys);
zn_status_t zn_vmo_map(
zn_handle_t vmo,
zn_handle_t vas,
uintptr_t vmo_offset,
uintptr_t* addr,
size_t bytes,
enum zn_vm_flags flags
) {
return zn_syscall6(vmo, vas, vmo_offset, addr, bytes, flags, ZN_SYSCALL_VMO_MAP);
}
VDSO_SYMBOL(zn_vmo_map);
zn_status_t zn_vas_create(zn_handle_t* out) {
return zn_syscall1(out, ZN_SYSCALL_VAS_CREATE);
}
VDSO_SYMBOL(zn_vas_create);
-16
View File
@@ -1,16 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/namespace.h>
#include <kernel/vdso.h>
zn_status_t zn_ns_create(zn_handle_t* out) {
return ZN_ERR_UNSUPPORTED;
}
VDSO_SYMBOL(zn_ns_create);
zn_status_t zn_ns_move(zn_handle_t handle, zn_handle_t target_ns) {
return ZN_ERR_UNSUPPORTED;
}
VDSO_SYMBOL(zn_ns_move);
-37
View File
@@ -1,37 +0,0 @@
// SPDX-License-Identifier: MIT
#include <zinnia/status.h>
#include <kernel/vdso.h>
const char* zn_status_to_string(zn_status_t err) {
switch (err) {
case ZN_OK:
return "No error (OK)";
case ZN_ERR_INTERNAL:
return "An internal error occured (INTERNAL)";
case ZN_ERR_BAD_SYSCALL:
return "Syscall number is not a recognized syscall (BAD_SYSCALL)";
case ZN_ERR_UNSUPPORTED:
return "This operation is not supported or implemented yet (UNSUPPORTED)";
case ZN_ERR_NO_MEMORY:
return "System does not have enough free memory for this operation (NO_MEMORY)";
case ZN_ERR_NO_HANDLES:
return "Process can not own any more handles (NO_HANDLES)";
case ZN_ERR_INVALID:
return "One or more of the provided arguments is not valid (INVALID)";
case ZN_ERR_BAD_RANGE:
return "Argument is outside of the range for valid values (BAD_RANGE)";
case ZN_ERR_BAD_HANDLE:
return "Object handle does not name a valid object (BAD_HANDLE)";
case ZN_ERR_BAD_PERMS:
return "Object has insufficient permissions for this operation (BAD_PERMS)";
case ZN_ERR_BAD_BUFFER:
return "Buffer is not large enough or doesn't point to a valid memory region (BAD_BUFFER)";
case ZN_ERR_ALREADY_EXISTS:
return "The resource already exists (ALREADY_EXISTS)";
}
return "Unknown error code";
}
VDSO_SYMBOL(zn_status_to_string);