diff options
Diffstat (limited to 'kernel/timer.s')
| -rw-r--r-- | kernel/timer.s | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/timer.s b/kernel/timer.s index c3af34b..b96e1f1 100644 --- a/kernel/timer.s +++ b/kernel/timer.s @@ -1,9 +1,11 @@ +global ticked global ticks global timer_init extern check_signals extern register_isr extern sched_tick +ticked: dd 0 ticks: dd 0 tick_handler: @@ -17,17 +19,20 @@ tick_handler: mov es, ax mov fs, ax mov gs, ax - ; handle the timer tick + mov dword [ticked], 1 inc dword [ticks] mov al, 0x20 out 0x20, al - - ; call the scheduler + ; check that the user isn't executing in kernel space + mov eax, [esp+38] + test eax, 0x03 + jz .end + ; if it isn't, call the scheduler call sched_tick ; handle any pending signals before returning to normal execution call check_signals - +.end: ; restore the data segment selectors pop ax mov ds, ax |
