diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-08-30 18:32:21 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-08-30 18:32:21 +0200 |
| commit | 837255c8ff040f84699d3c2efd329fc04dbafbdf (patch) | |
| tree | 69e7f907818c289e615c216c242f055acf45d55c /asm | |
| parent | e733ac719f0bec2bd8f749dbca4de8ad524aaddb (diff) | |
Added multitasking support for two tasks ;)
Diffstat (limited to 'asm')
| -rw-r--r-- | asm/int_clock_handler.asm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/asm/int_clock_handler.asm b/asm/int_clock_handler.asm new file mode 100644 index 0000000..dd0de96 --- /dev/null +++ b/asm/int_clock_handler.asm @@ -0,0 +1,37 @@ +global int_clock_handler +[extern task_switch_next] + +CLOCK_COUNTER: + db 0x00 + +[bits 32] +int_clock_handler: + + ;Notice there is no IRQ number or error code - we don't need them + + inc byte [CLOCK_COUNTER] + + cmp byte [CLOCK_COUNTER], 0x10 + + jne skip_clock + + mov byte [CLOCK_COUNTER], 0x00 + + pusha ;Push all standard registers + + push esp ;Push pointer to all the stuff we just pushed + + call task_switch_next ;Call C code + + mov esp, eax ;Replace the stack with what the C code gave us + + popa ;Put the standard registers back + + skip_clock: + + mov al, 0x20 ;Port number AND command number to Acknowledge IRQ + out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts + + ;We didn't push an error code or IRQ number, so we don't have to edit esp now + + iret ;Interrupt-Return |
