64 if (
strcmp(
string,
"kill") == 0)
106 queue->
flags &= ~NOTE_QUEUE_RECEIVED_KILL;
141 LOG_DEBUG(
"delivering note '%s' to pid=%d rsp=%p rip=%p\n", note->
buffer, process->
id, (
void*)frame->
rsp,
158 noteHandler->
func = handler;
177 queue->
flags &= ~NOTE_QUEUE_HANDLING;
#define assert(expression)
#define INTERRUPT_FRAME_IN_USER_SPACE(frame)
Checks if a interrupt frame is from user space.
#define SYSCALL_DEFINE(num, returnType,...)
Macro to define a syscall.
@ SYSCALL_FORCE_FAKE_INTERRUPT
#define RED_ZONE_SIZE
The size of the red zone in bytes.
#define NOTE_MAX
Maximum size of a notes buffer.
bool note_handle_pending(interrupt_frame_t *frame, cpu_t *self)
Handle pending notes for the current thread.
uint64_t note_send(note_queue_t *queue, const char *string)
Write a note to a note queue.
uint64_t note_amount(note_queue_t *queue)
The amount of pending notes in a note queue, including special notes.
void note_handler_init(note_handler_t *handler)
Initialize a note handler.
void note_queue_init(note_queue_t *queue)
Initialize a note queue.
@ NOTE_QUEUE_RECEIVED_KILL
@ NOTE_QUEUE_HANDLING
User space is currently handling a note.
#define LOG_DEBUG(format,...)
uint64_t space_check_access(space_t *space, const void *addr, uint64_t length)
Checks if a virtual memory region is within the allowed address range of the space.
uint64_t thread_copy_to_user(thread_t *thread, void *dest, const void *userSrc, uint64_t length)
Safely copy data to user space.
@ THREAD_DYING
The thread is currently dying, it will be freed by the scheduler once its invoked.
process_t * sched_process(void)
Retrieves the process of the currently running thread.
thread_t * sched_thread(void)
Retrieves the currently running thread.
thread_t * sched_thread_unsafe(void)
Retrieves the currently running thread without disabling interrupts.
_NORETURN void sched_thread_exit(void)
Terminates the currently executing thread.
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static void lock_release(lock_t *lock)
Releases a lock.
static void lock_acquire(lock_t *lock)
Acquires a lock, blocking until it is available.
#define CONFIG_MAX_NOTES
Maximum note queue configuration.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define ROUND_DOWN(number, multiple)
void(* note_func_t)(char *note)
Note handler function type.
#define NULL
Pointer error value.
#define ERR
Integer error value.
errno_t memcpy_s(void *_RESTRICT s1, rsize_t s1max, const void *_RESTRICT s2, rsize_t n)
errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
#define RFLAGS_INTERRUPT_ENABLE
#define atomic_store(object, desired)
_PUBLIC int strcmp(const char *s1, const char *s2)
size_t strnlen_s(const char *s, size_t maxsize)
Per-process note handler.
note_t notes[CONFIG_MAX_NOTES]
interrupt_frame_t noteFrame
The interrupt frame to return to after handling a note.
note_handler_t noteHandler
interrupt_frame_t * frame
If a fake interrupt is generated, this is the interrupt frame to return to.
syscall_flags_t flags
Flags for the current syscall.
Thread of execution structure.
process_t * process
The parent process that the thread executes within.