summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-17 17:34:27 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-17 17:34:27 +0100
commite72b6a00ee64f00bc38e3a64d16330d8c101c3ff (patch)
treed1cb3ae7794bab7c9083fa60b6a03c7eedbd7322 /kernel
parentb5e134d86833521b5e30f3901934777832062011 (diff)
hardcoded shell as task1
Diffstat (limited to 'kernel')
-rw-r--r--kernel/task.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/task.c b/kernel/task.c
index 094c74d..29ccaa4 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -18,12 +18,14 @@ static uint32_t c1,c2,c3;
void task_test1()
{
- // ext2_check(EXT2_RAM_ADDRESS);
- // syscall_execve(15,0,0);
+ ext2_check(EXT2_RAM_ADDRESS);
+ syscall_execve(15,0,0);
+ /*
while(1)
{
c1++;
}
+ */
}
@@ -54,7 +56,7 @@ typedef struct{ //Simple structure for a thread
} Thread;
-Thread Threads[3]; //Space for our simple threads. Just 2!
+Thread Threads[3]; //Space for our simple threads.
volatile int CurrentTask; //The thread currenlty running (-1 == none)
@@ -63,8 +65,8 @@ void task_create(int pid,void(*thread)())
unsigned int *stack;
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 thread: 0x%08X", stack, thread);
+ 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 thread: 0x%08X", stack, thread);
//First, this stuff is pushed by the processor
*--stack = 0x0202; //This is EFLAGS
@@ -89,8 +91,6 @@ void task_create(int pid,void(*thread)())
*--stack = 0x10; //GS
*/
-
-log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"new task : stack: 0x%08X ", stack);
Threads[pid].esp0 = (uint32_t)stack; //Update the stack pointer
@@ -109,12 +109,13 @@ uint32_t task_switch_next(uint32_t oldesp)
log(
FOOLOS_MODULE_NAME,
- FOOLOS_LOG_INFO,
+ FOOLOS_LOG_FINE,
"oldesp: 0x%08X saved / next task: %d (esp: 0x%08X) ",
oldesp,
CurrentTask,
Threads[CurrentTask].esp0);
+// return oldesp;
return Threads[CurrentTask].esp0; //Return new stack pointer to ASM
}
@@ -131,12 +132,13 @@ void stack_trace(uint32_t *stack,int size)
void task_init()
{
+ CurrentTask=-1;
+
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init multitasking.");
task_create(0,task_test1);
task_create(1,task_test2);
task_create(2,task_test3);
started=0xabcde;
- CurrentTask=-1;
}