proc: add basic proc loading

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-17 20:11:19 -04:00
commit 6b40cca5b0
10 changed files with 187 additions and 44 deletions

View file

@ -9,6 +9,8 @@
#include <lib/rbtree.h>
#include "elf.h"
#define PROC_STATE_RUNNING 0
#define PROC_STATE_WAITING 1
#define PROC_STATE_DNS 2 /* do not schedule */
@ -43,14 +45,23 @@ struct proc {
char *name;
rbtree_t vm_tree;
spinlock_t vm_lock;
pgd_t *pgd;
pgd_t *pgd;
spinlock_t sched_lock;
spinlock_t mem_lock;
rbtree_t memmap;
struct ehdr *ehdr;
struct phdrs *phdrs;
size_t n_phdrs;
};
void proc_init();
int proc_kill(struct proc *proc, int signal);
void proc_mmap(struct proc *proc, paddr_t p, vaddr_t v, size_t len, u64 flags);
struct proc *proc_create(struct proc *parent);
void proc_free(struct proc *proc);
void switch_to(struct thread *from, struct thread *to);
void proc_init();
#endif /* _PROC_H_ */

View file

@ -15,8 +15,6 @@ struct tty {
struct tty_serial_ops serial_ops;
};
void tty_layer_init();
struct tty *tty_create(const char *name, void *priv);
void tty_putchar(struct tty *tty, char c);
char tty_getchar(struct tty *tty);