60 } __attribute__((packed))
Thread;
pid_t pid
The PID of this process.
Definition: tasking.h:35
int num_threads_blocked
The number of blocked threads in this process.
Definition: tasking.h:38
int num_threads
The number of threads in this process.
Definition: tasking.h:37
pid_t next_tid
The TID that the next created thread will use.
Definition: tasking.h:36
struct Thread * first_thread
A pointer to the head of the linked list of threads for this process.
Definition: tasking.h:39
char priv
Whether the process is privileged (can execute syscalls to acesss all of memory/has acess to IO ports...
Definition: tasking.h:34
thread_state state
The state of this thread. (running,ready to run,blocked,etc.)
Definition: tasking.h:50
Process * process
The thread's process.
Definition: tasking.h:56
void * rpc_ret_buf
The return buffer of the RPC call that the thread made.
Definition: tasking.h:59
struct Thread * next_thread_in_process
The next thread in the process.
Definition: tasking.h:52
void * address_space
The address space of this thread. (it is in here and not in the process to simplify the task switch a...
Definition: tasking.h:48
struct Thread * prev_ready_to_run
If the thread is in the ready to run list, this is the previous ready to run thread....
Definition: tasking.h:55
void * kernel_esp
The thread's kernel stack.
Definition: tasking.h:46
struct Thread * next_ready_to_run
If the thread is in the ready to run list, this is the next ready to run thread. (potentially in a di...
Definition: tasking.h:54
pid_t tid
The TID of this thread.
Definition: tasking.h:49
pid_t rpc_calling_tid
The TID of the thread that called this RPC (only used for RPC handler threads)
Definition: tasking.h:58
pid_t rpc_calling_pid
The PID of the thread that called this RPC (only used for RPC handler threads)
Definition: tasking.h:57
int errno
The errno value for this thread.
Definition: tasking.h:51
void * kernel_esp_top
The top of the thread's kernel stack.
Definition: tasking.h:47
struct Thread * prev_thread_in_process
The previous thread in the process.
Definition: tasking.h:53
void tasking_block(thread_state newstate)
Definition: tasking.c:257
void tasking_create_task(void *eip, void *address_space, char kmode, void *param1, void *param2, char isThread, char is_irq_handler)
Definition: tasking.c:93
pid_t tasking_get_rpc_calling_thread(pid_t *tid)
Definition: tasking.c:384
pid_t tasking_new_thread(void *start, pid_t pid, void *param, char is_irq_handler)
Definition: tasking.c:160
int * tasking_get_errno_address()
Definition: tasking.c:156
void tasking_init()
Definition: tasking.c:136
void * tasking_get_rpc_ret_buf()
Definition: tasking.c:396
char tasking_is_privleged()
Definition: tasking.c:144
thread_state
Definition: tasking.h:17
@ THREAD_BLOCKED
The state of a generically blocked thread.
Definition: tasking.h:21
@ THREAD_RUNNING
The state of a running thread.
Definition: tasking.h:18
@ THREAD_WAITING_FOR_RPC_INIT
The state of a thread waiting for a process to fully initilaize it's RPC functions.
Definition: tasking.h:23
@ THREAD_EXITED
The state of an exited thread.
Definition: tasking.h:20
@ THREAD_WAITING_FOR_RPC
The state of a thread waiting for an RPC call to return.
Definition: tasking.h:22
@ THREAD_READY
The state of a ready to run thread.
Definition: tasking.h:19
pid_t tasking_get_TID()
Definition: tasking.c:152
void tasking_yield()
Definition: tasking.c:227
void * tasking_get_address_space(pid_t pid)
Definition: tasking.c:374
void tasking_unblock(pid_t pid, pid_t tid)
Definition: tasking.c:321
pid_t tasking_get_PID()
Definition: tasking.c:148
Thread * current_thread
Currently running thread.
Definition: tasking.c:22
void tasking_exit(int code)
Definition: tasking.c:336
void tasking_set_rpc_calling_thread(pid_t pid, pid_t tid)
Definition: tasking.c:378
void tasking_thread_exit()
Definition: tasking.c:400
void tasking_set_rpc_ret_buf(void *buf)
Definition: tasking.c:389
char tasking_check_proc_exists(pid_t pid)
Definition: tasking.c:404