diff options
Diffstat (limited to 'src/kernel/include/process.h')
-rw-r--r-- | src/kernel/include/process.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/kernel/include/process.h b/src/kernel/include/process.h index d1914ef..30e24db 100644 --- a/src/kernel/include/process.h +++ b/src/kernel/include/process.h @@ -1,12 +1,25 @@ #pragma once -// A process is a recipient for user code, as well as for mounting File Systems, -// which allow access to features of the system. +// A process is basically : +// - a page directory and a list of segments mapped in user space +// - a list of file systems each associated to a name +// - some threads (currently, only one thread per process supported) -#include <thread.h> +// Notes on memory mapping : +// - mmap creates an empty zone (zero-initialized) +// - mmap_file increments the refcount of the file handle +// - mchmap = change mode on already mapped zone (eg. after loading code) #include <hashtbl.h> +#include <thread.h> +#include <vfs.h> + + +// Modes for mmaping regions +#define MM_READ (0x01) +#define MM_WRITE (0x02) +#define MM_EXEC (0x04) struct process; typedef struct process process_t; @@ -14,14 +27,16 @@ typedef struct process process_t; process_t *current_process(); process_t *new_process(process_t *parent); -void delete_process(process_t *p); +// void delete_process(process_t *p); // TODO define semantics for freeing stuff -void start_process(process_t *p, entry_t entry, void* data); +bool start_process(process_t *p, void* entry); // maps a region for user stack bool proc_add_fs(process_t *p, fs_t *fs, const char* name); fs_t *proc_find_fs(process_t *p, const char* name); -bool mmap(process_t *proc, void* addr, size_t size, int type); -bool mmap_file(process_t *proc, fs_handle_t *h, void* addr, size_t size, int mode); +bool mmap(process_t *proc, void* addr, size_t size, int mode); // create empty zone +bool mmap_file(process_t *proc, fs_handle_t *h, size_t offset, void* addr, size_t size, int mode); +bool mchmap(process_t *proc, void* addr, int mode); +bool munmap(process_t *proc, void* addr); /* vim: set ts=4 sw=4 tw=0 noet :*/ |