Kernel processes / multitasking
This commit is contained in:
44
kernel/proc/proc.h
Normal file
44
kernel/proc/proc.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef PROC_PROC_H_
|
||||
#define PROC_PROC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "hal/hal.h"
|
||||
#include "vmm/vmm.h"
|
||||
#include "spinlock/spinlock.h"
|
||||
#include "bitmap/bitmap.h"
|
||||
|
||||
#define PROC_NAME_MAX 0x100
|
||||
|
||||
#define PROC_STACKBLOCKS 32
|
||||
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
||||
|
||||
enum {
|
||||
PROC_READY,
|
||||
PROC_RUNNING,
|
||||
PROC_ZOMBIE,
|
||||
PROC_WAITING,
|
||||
};
|
||||
|
||||
typedef struct Proc {
|
||||
struct Proc *next;
|
||||
uint64_t pid;
|
||||
char name[PROC_NAME_MAX];
|
||||
ProcPlatformData platformdata;
|
||||
uint8_t state;
|
||||
VasRange *vas;
|
||||
bool kern;
|
||||
} Proc;
|
||||
|
||||
typedef struct {
|
||||
SpinLock spinlock;
|
||||
Proc *procs;
|
||||
Proc *current;
|
||||
} Procs;
|
||||
|
||||
extern Procs PROCS;
|
||||
|
||||
void proc_init(void);
|
||||
Proc *proc_spawnkern(void (*ent)(void), char *name);
|
||||
void proc_sched(void *cpustate);
|
||||
|
||||
#endif // PROC_PROC_H_
|
Reference in New Issue
Block a user