29 lines
638 B
C
29 lines
638 B
C
#pragma once
|
|
|
|
#include "cpu_context.h"
|
|
#include "mem.h"
|
|
|
|
#define KTHREAD_NAME_MAX_LENGTH 32
|
|
#define KTHREAD_DEFAULT_STACK_SIZE PAGE_SIZE
|
|
|
|
struct kthread {
|
|
char name[KTHREAD_NAME_MAX_LENGTH];
|
|
struct cpu_state *cpuState;
|
|
vaddr_t stackAddr;
|
|
size_t stackSize;
|
|
struct kthread *next;
|
|
struct kthread *prev;
|
|
};
|
|
|
|
|
|
int kthreadSetup(vaddr_t mainStack, size_t mainStackSize);
|
|
void kthread_exit();
|
|
|
|
struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func,
|
|
void *args);
|
|
|
|
void deleteKthread(struct kthread *thread);
|
|
|
|
struct kthread *selectNextKthread();
|
|
struct cpu_state *switchKthread(struct cpu_state *prevCpu);
|