From 59cac783f5ba12a47308b05b87d5cfa769473a49 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 11 Jul 2018 05:38:01 +1000 Subject: Modified the tick_handler interrupt routine in timer.s so that it no longer calls reschedule() directly. It now calls sched_tick() so that the scheduler can make it's own decisions relating to handling the timer interrupt. The reschedule() function now *actually* implements a basic round-robin scheduling algorithm that iterates through the list of tasks. This is still a temporary algorithm but at least it now includes *all* runnable processes instead of switching back and forth between process 1 and 2. --- kernel/asm.s | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'kernel/asm.s') diff --git a/kernel/asm.s b/kernel/asm.s index 0bf9067..6d35334 100644 --- a/kernel/asm.s +++ b/kernel/asm.s @@ -3,6 +3,7 @@ global switch_to global set_tss extern cstate extern ctask +extern ctaskn extern gdt extern save_state @@ -27,9 +28,11 @@ switch_to: ltr ax ; copy the saved state into the previous TSS call save_state - ; update ctask + ; update ctask and ctaskn mov ebx, [ebp+12] mov [ctask], ebx + mov ebx, [ebp+8] + mov [ctaskn], ebx ; calculate the task segment index and jump to it mov ebx, [ebp+8] add ebx, 5 -- cgit v1.3