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.
30 lines
725 B
30 lines
725 B
#pragma once
|
|
|
|
#include "src/kernel/fs.h"
|
|
#include "src/kernel/path.h"
|
|
#include "src/kernel/stream.h"
|
|
#include "src/lib/string.h"
|
|
|
|
#define USER_RFLAGS 0x202
|
|
|
|
typedef struct process {
|
|
uint64_t *pml4;
|
|
void *kernel_stack;
|
|
fs_node_t *root;
|
|
path_t *cwd;
|
|
stream_t *stdin;
|
|
stream_t *stdout;
|
|
} process_t;
|
|
|
|
typedef void (*app_t)(process_t *proc, uint8_t argc, char **argv);
|
|
|
|
extern process_t *current_process;
|
|
|
|
process_t *process_create(const process_t *parent, const uint8_t *code, uint64_t size);
|
|
|
|
void process_run(process_t *proc);
|
|
|
|
void process_destroy(process_t *proc);
|
|
|
|
#define WRITE_S(s) proc->stdout->write(proc->stdout, s, sizeof(s) - 1);
|
|
#define WRITE_D(s) proc->stdout->write(proc->stdout, s, string_length(s));
|
|
|