diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 17:23:29 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 17:23:29 +0100 |
commit | f67c0b7e20ef0816a2d9047fd20346e3ede98b75 (patch) | |
tree | 7e547ff85cf10777b882fe925800dad4e65e6414 /src/kernel/include/thread.h | |
parent | 1ca5c37cee8a9d9c3058746da78240d8dc289a02 (diff) | |
download | kogata-f67c0b7e20ef0816a2d9047fd20346e3ede98b75.tar.gz kogata-f67c0b7e20ef0816a2d9047fd20346e3ede98b75.zip |
Prepare for user memory management and usermode code
Diffstat (limited to 'src/kernel/include/thread.h')
-rw-r--r-- | src/kernel/include/thread.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/kernel/include/thread.h b/src/kernel/include/thread.h index b5fa50d..011067f 100644 --- a/src/kernel/include/thread.h +++ b/src/kernel/include/thread.h @@ -3,6 +3,7 @@ #include <sys.h> #include <paging.h> #include <region.h> +#include <idt.h> #define T_STATE_RUNNING 1 #define T_STATE_PAUSED 2 @@ -12,6 +13,8 @@ #define TASK_SWITCH_FREQUENCY 50 // in herz +typedef void (*user_pf_handler_t)(pagedir_t *pd, registers_t *regs, void* addr); + typedef struct saved_context { uint32_t *esp; void (*eip)(); @@ -27,6 +30,8 @@ typedef struct thread { region_info_t *stack_region; struct process *proc; // process : L1 data structure + user_pf_handler_t usermem_pf_handler; // page fault in user memory + isr_handler_t kmem_violation_handler; // page fault in kernel memory accessed by user code (violation) struct thread *next_in_queue; } thread_t; @@ -40,6 +45,7 @@ extern thread_t *current_thread; void yield(); void pause(); +void exit(); void resume_thread(thread_t *thread, bool run_at_once); |