C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches
runtime.h
1#pragma once
2
3#include <threads.h>
4#include <stdatomic.h>
5#include <pthread.h>
6#include <kernel/rpc.h>
7
8#define os_init_core(x)
9
10struct OS_thread_t;
11
12void os_thread_initialize_arch(struct OS_thread_t * thread, unsigned stack_size, entrypoint_t * entrypoint, void * data);
13void os_init_arch(void);
14
17enum SyscallOutcome {
19 SYSCALL_OUTCOME_RETURN,
21 SYSCALL_OUTCOME_RPC_CALL
22};
23
30 long args[6];
31 long retval;
32 unsigned char syscall_id;
33 enum SyscallOutcome outcome;
36};
37
45struct Arch_State_t {
59 int block_pipe[2]; // [read_fd, write_fd]
61 volatile atomic_int is_suspended;
65 pthread_t sched_thread_id;
69};
70
void os_thread_initialize_arch(struct OS_thread_t *thread, unsigned stack_size, entrypoint_t *entrypoint, void *data)
Perform platform-specific initialization of thread.
Definition sched.c:29
int(* RPC_Method_t)(RPC_Service_t *service, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long zarg3)
Calling signature of a RPC call.
Definition rpc.h:34
ARM-specific architecture state of a thread.
Definition runtime.h:58
struct syscall_dispatch_t syscall
Buffer for dispatching system calls to the kernel and return values back to the userspace.
Definition runtime.h:68
pthread_t sched_thread_id
POSIX thread identifier of the Linux thread that support this CMRX thread.
Definition runtime.h:65
thrd_t sched_thread
C11 thread identifier of the Linux thread that supports this CMRX thread.
Definition runtime.h:63
volatile atomic_int is_suspended
State information on if thread is suspended or not (unused)
Definition runtime.h:61
int block_pipe[2]
Pipe used to force thread to stop.
Definition runtime.h:59
Thread control block.
Definition runtime.h:72
Syscall dispatch data structure.
Definition runtime.h:29
long dispatch_args[5]
Definition runtime.h:35
enum SyscallOutcome outcome
Definition runtime.h:33
RPC_Method_t dispatch_target
Definition runtime.h:34
long args[6]
Definition runtime.h:30
long retval
Definition runtime.h:31
unsigned char syscall_id
Definition runtime.h:32