You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
747 B
32 lines
747 B
#pragma once
|
|
|
|
#include "src/kernel/fs.h"
|
|
#include "src/kernel/path.h"
|
|
#include "src/kernel/stream.h"
|
|
|
|
#define USER_RFLAGS 0x202
|
|
|
|
typedef struct process {
|
|
const struct process *parent;
|
|
uint64_t *pml4;
|
|
void *kernel_stack;
|
|
void *kernel_rsp;
|
|
void *user_stack;
|
|
void *user_rsp;
|
|
const fs_node_t *root;
|
|
const path_t *cwd;
|
|
const stream_t *stdin;
|
|
const stream_t *stdout;
|
|
} process_t;
|
|
|
|
typedef void (*app_t)(process_t *proc, uint8_t argc, char **argv);
|
|
|
|
extern process_t *current_process;
|
|
|
|
extern void process_trampoline();
|
|
|
|
process_t *process_create(const process_t *parent, const uint8_t *code, uint64_t size);
|
|
|
|
extern void process_switch_to(void **save_rsp, void *new_rsp, void *new_pml4_phys);
|
|
|
|
void process_destroy(process_t *proc);
|
|
|