All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m45s
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
#ifndef _KERNEL_PROC_PROC_H
|
|
#define _KERNEL_PROC_PROC_H
|
|
|
|
#include <aux/compiler.h>
|
|
#include <libk/std.h>
|
|
#include <sync/spin_lock.h>
|
|
#include <sys/mm.h>
|
|
|
|
#if defined(__x86_64__)
|
|
#include <amd64/gdt.h> /* KSTACK_SIZE */
|
|
#include <amd64/proc.h> /* USTACK_SIZE */
|
|
#endif
|
|
|
|
/// Process is ready to run
|
|
#define PROC_READY 0
|
|
/// Process marked garbage collection
|
|
#define PROC_DEAD 1
|
|
|
|
|
|
struct cpu;
|
|
|
|
struct proc_mapping {
|
|
struct proc_mapping* next;
|
|
uintptr_t paddr;
|
|
uintptr_t vaddr;
|
|
size_t size;
|
|
} PACKED;
|
|
|
|
struct procw;
|
|
|
|
struct proc {
|
|
struct proc* next;
|
|
struct proc_mapping* mappings; /* pd.lock implicitly protects this field */
|
|
struct proc_platformdata pdata;
|
|
struct pd pd;
|
|
spin_lock_t lock;
|
|
struct cpu* cpu;
|
|
struct procw* procw; /* link to it's global struct */
|
|
atomic_int state;
|
|
};
|
|
|
|
/*
|
|
* struct proc is a member of a CPU's proc_run_q.
|
|
* struct procw is a process wrapper that is a member of
|
|
* a global process list.
|
|
*/
|
|
struct procw {
|
|
struct procw* next;
|
|
struct proc* proc;
|
|
};
|
|
|
|
void proc_sched (void);
|
|
void proc_kill (struct proc* proc);
|
|
void proc_init (void);
|
|
|
|
#endif // _KERNEL_PROC_PROC_H
|