From 41c3e0bc640f570831bd6c18fbfb8c7cec23a43d Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Thu, 4 Dec 2014 23:30:15 +0100 Subject: struggling with gcc -O , and other stuff --- kernel/task.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'kernel/task.c') diff --git a/kernel/task.c b/kernel/task.c index 2d52017..b01975d 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -18,21 +18,21 @@ #define MAX_TASKS 10 -static volatile int current_task=-1; +static volatile int volatile current_task=-1; static volatile struct task_list_struct { - int parent; - bool active; - uint32_t esp; // stack pointer of the task; - pdirectory *vmem; // number of virtual memory table to switch to - bool waiting; - bool skipwait; - uint32_t brk; + volatile int parent; + volatile bool active; + volatile uint32_t esp; // stack pointer of the task; + volatile pdirectory *vmem; // number of virtual memory table to switch to + volatile bool waiting; + volatile bool skipwait; + volatile uint32_t brk; }volatile task_list[MAX_TASKS]; -int add_task(uint32_t esp, uint32_t vmem) +volatile int add_task(uint32_t esp, uint32_t vmem) { for(int i=0;i [%d] (free blocks remaining: %d )", current_task, pid,mem_get_free_blocks_count()); @@ -145,7 +145,7 @@ uint32_t task_fork(uint32_t oldesp) } // init task (root of all other tasks / processes) // -void task_init(pdirectory *dir) +volatile void task_init(pdirectory *dir) { // this is our main task on slot 0 task_list[0].parent=0; @@ -158,16 +158,16 @@ void task_init(pdirectory *dir) } -int task_get_current_pid() +volatile int task_get_current_pid() { return current_task; } -uint32_t task_get_brk() +volatile uint32_t task_get_brk() { return task_list[current_task].brk; } -void task_set_brk(uint32_t brk) +volatile void task_set_brk(uint32_t brk) { task_list[current_task].brk=brk; } -- cgit v1.2.3