This commit is contained in:
2026-08-18 01:28:35 +02:00
parent ac9d47fa16
commit cf3f1f9e99
11 changed files with 110 additions and 59 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
// Like the standard C assert, but also active in debug builds.
#define assert(expr, msg, ...) \
({ \
do { \
if (__unlikely(!(expr))) { \
panic( \
"In function \"%s\" (%s:%u):\n" \
@@ -17,7 +17,7 @@
##__VA_ARGS__ \
); \
} \
})
} while (0)
#ifndef NDEBUG
#define debug_assert(...) assert(__VA_ARGS__)
+4
View File
@@ -1,5 +1,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include <zinnia/channel.h>
#include <zinnia/status.h>
#include <kernel/spin.h>
#include <kernel/tailq.h>
@@ -19,6 +22,7 @@ struct channel_msg {
struct channel {
struct channel* peer;
struct spinlock lock;
enum zn_channel_flags flags;
tailq_head(struct channel_msg) messages;
struct wait_queue waiters;
};
+24 -22
View File
@@ -6,32 +6,34 @@ typedef zn_status_t (*syscall_fn_t)(struct arch_context* ctx);
void syscall_dispatch(struct arch_context* ctx);
zn_status_t syscall_log(struct arch_context* ctx);
zn_status_t syscall_archctl(struct arch_context* ctx);
zn_status_t syscall_page_size(struct arch_context* ctx);
zn_status_t syscall_time(struct arch_context* ctx);
#define DEFINE_SYSCALL(name) zn_status_t syscall_##name(struct arch_context* ctx)
zn_status_t syscall_handle_validate(struct arch_context* ctx);
zn_status_t syscall_handle_drop(struct arch_context* ctx);
zn_status_t syscall_handle_clone(struct arch_context* ctx);
DEFINE_SYSCALL(log);
DEFINE_SYSCALL(archctl);
DEFINE_SYSCALL(page_size);
DEFINE_SYSCALL(time);
zn_status_t syscall_vas_create(struct arch_context* ctx);
DEFINE_SYSCALL(handle_validate);
DEFINE_SYSCALL(handle_drop);
DEFINE_SYSCALL(handle_clone);
zn_status_t syscall_vmo_create(struct arch_context* ctx);
zn_status_t syscall_vmo_create_phys(struct arch_context* ctx);
zn_status_t syscall_vmo_map(struct arch_context* ctx);
DEFINE_SYSCALL(vas_create);
zn_status_t syscall_channel_create(struct arch_context* ctx);
zn_status_t syscall_channel_wait(struct arch_context* ctx);
zn_status_t syscall_channel_read(struct arch_context* ctx);
zn_status_t syscall_channel_write(struct arch_context* ctx);
DEFINE_SYSCALL(vmo_create);
DEFINE_SYSCALL(vmo_create_phys);
DEFINE_SYSCALL(vmo_map);
zn_status_t syscall_thread_create(struct arch_context* ctx);
zn_status_t syscall_thread_start(struct arch_context* ctx);
zn_status_t syscall_thread_exit(struct arch_context* ctx);
DEFINE_SYSCALL(channel_create);
DEFINE_SYSCALL(channel_wait);
DEFINE_SYSCALL(channel_read);
DEFINE_SYSCALL(channel_write);
zn_status_t syscall_random_get(struct arch_context* ctx);
zn_status_t syscall_random_entropy(struct arch_context* ctx);
DEFINE_SYSCALL(thread_create);
DEFINE_SYSCALL(thread_start);
DEFINE_SYSCALL(thread_exit);
zn_status_t syscall_futex_wait(struct arch_context* ctx);
zn_status_t syscall_futex_wake(struct arch_context* ctx);
DEFINE_SYSCALL(random_get);
DEFINE_SYSCALL(random_entropy);
DEFINE_SYSCALL(futex_wait);
DEFINE_SYSCALL(futex_wake);