summaryrefslogtreecommitdiff
path: root/kernel/task.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-17 14:56:01 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-17 14:56:01 +0100
commit54d36998da2e98039b960a3a9e6fb82e09717991 (patch)
tree49ab40cafbd33fb3a91df9a4157895e2059f6f55 /kernel/task.c
parente1b3206c11baa396edaf49bfb45a2a443717eaa4 (diff)
trying to reactivate multitasking.
Diffstat (limited to 'kernel/task.c')
-rw-r--r--kernel/task.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/kernel/task.c b/kernel/task.c
index 1e94b26..094c74d 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -5,16 +5,21 @@
#include "lib/logger/log.h" // logger facilities
#include "lib/int/stdint.h"
#include "mem.h"
+
+#include "syscalls.h"
+#include "fs/fs.h"
+#include "fs/ext2.h"
#define FOOLOS_MODULE_NAME "task"
int started;
uint64_t task_system_clock;
-uint32_t c1,c2,c3;
+static uint32_t c1,c2,c3;
void task_test1()
{
-
+ // ext2_check(EXT2_RAM_ADDRESS);
+ // syscall_execve(15,0,0);
while(1)
{
c1++;
@@ -24,8 +29,6 @@ void task_test1()
void task_test2()
{
- uint32_t c;
-
while(1)
{
c2++;
@@ -36,8 +39,6 @@ void task_test2()
void task_test3()
{
- uint32_t c;
-
while(1)
{
c3++;
@@ -63,7 +64,7 @@ void task_create(int pid,void(*thread)())
Threads[pid].esp0 = pmmngr_alloc_block();
stack = (unsigned int*)Threads[pid].esp0+4095; //This makes a pointer to the stack for us
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"new task : stack: 0x%08X ", stack);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"new task : stack: 0x%08X thread: 0x%08X", stack, thread);
//First, this stuff is pushed by the processor
*--stack = 0x0202; //This is EFLAGS
@@ -81,7 +82,6 @@ void task_create(int pid,void(*thread)())
*--stack = 0; //EAX
//Now these are the data segments pushed by the IRQ handler
-
/*
*--stack = 0x10; //DS
*--stack = 0x10; //ES
@@ -90,6 +90,7 @@ void task_create(int pid,void(*thread)())
*/
+log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"new task : stack: 0x%08X ", stack);
Threads[pid].esp0 = (uint32_t)stack; //Update the stack pointer
@@ -97,8 +98,8 @@ void task_create(int pid,void(*thread)())
uint32_t task_switch_next(uint32_t oldesp)
{
- task_system_clock++;
+ task_system_clock++;
if(started!=0xabcde) return oldesp;
if(CurrentTask!=-1)Threads[CurrentTask].esp0=oldesp;
@@ -106,7 +107,13 @@ uint32_t task_switch_next(uint32_t oldesp)
CurrentTask++;
if(CurrentTask>2)CurrentTask=0;
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_FINE,"oldesp: 0x%08X saved / next task: %d (esp: 0x%08X) ",oldesp, CurrentTask,Threads[CurrentTask].esp0);
+ log(
+ FOOLOS_MODULE_NAME,
+ FOOLOS_LOG_INFO,
+ "oldesp: 0x%08X saved / next task: %d (esp: 0x%08X) ",
+ oldesp,
+ CurrentTask,
+ Threads[CurrentTask].esp0);
return Threads[CurrentTask].esp0; //Return new stack pointer to ASM
}