Fix switching to same task jumping to random memory
diff --git a/src/kernel/main.c b/src/kernel/main.c
index 6a37471..355ce9f 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -82,6 +82,10 @@
 
 	asm volatile("cli");
 
+	switch_task();
+
+	kprintf("Switched task, this should have done nothing.\n");
+
 	while (true)
 		asm volatile("hlt");
 
diff --git a/src/kernel/task.c b/src/kernel/task.c
index 1285a44..4d740cf 100644
--- a/src/kernel/task.c
+++ b/src/kernel/task.c
@@ -153,8 +153,6 @@
 	// sti is called in switch_to_task
 	asm volatile("cli");
 
-	kprintf("\nin _do_switch_task(%d, %d, %d)\n", eip, ebp, esp);
-
 	// save context for this task
 	current_task->task.ebp = ebp;
 	current_task->task.esp = esp;
@@ -162,10 +160,6 @@
 
 	if (current_task->next == NULL)
 	{
-		// Start from the first task if there are more tasks, or just return
-		if (current_task == first_task)
-			return; // No context switch necessary
-
 		current_task = first_task;
 	}
 	else
@@ -174,7 +168,5 @@
 		current_task = current_task->next;
 	}
 
-	kprintf("Will switch to task id %d\n", current_task->task.id);
-
 	switch_to_task(&current_task->task);
 }
diff --git a/src/kernel/task_api.s b/src/kernel/task_api.s
index 1678969..1673866 100644
--- a/src/kernel/task_api.s
+++ b/src/kernel/task_api.s
@@ -8,9 +8,12 @@
 	push .after
 	call _do_switch_task
 .after:
+	;; add esp, 12 				; Clear the arguments
 	popa						; Reset everything
 	xor eax, eax				; Return 0
-	ret
+
+	pop ebx						; This is just to make debugging easy
+	jmp ebx
 
 	[global _switch_to_task]
 	;; _switch_to_task(uint page_directory, uint eip, uint ebp, uint esp)