vbos/include/kernel/proc.h
Michael Shaw d7477ae860 amd64: add syscall entry mechanism
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-07-15 20:08:22 -04:00

53 lines
759 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _PROC_H_
#define _PROC_H_
#include <kernel/types.h>
#include <kernel/spinlock.h>
#include <lib/rbtree.h>
#define PROC_STATE_RUNNING 0
#define PROC_STATE_WAITING 1
#define PROC_STATE_DNS 2 /* do not schedule */
typedef u64 pid_t;
typedef u64 tid_t;
struct vm_area {
vaddr_t start;
vaddr_t end;
u64 flags;
};
struct proc;
struct thread {
tid_t tid;
vaddr_t stack_addr;
u64 state;
bool in_kernel;
u64 tls_base;
struct proc *proc;
struct thread *next;
};
struct proc {
pid_t pid;
struct thread main_thread;
char *name;
rbtree_t vm_tree;
spinlock_t vm_lock;
spinlock_t sched_lock;
};
void proc_init();
void switch_to(struct thread *from, struct thread *to);
#endif /* _PROC_H_ */