summaryrefslogtreecommitdiff
path: root/asm/int_clock_handler.asm
blob: 7b0afaf8c8e9e599734fd9a96afd2e1813671d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
global int_clock_handler
[extern task_switch_next]

[bits 32]

int_clock_handler:

cli	  
pusha          ;Push all standard registers

mov eax, esp	;save current stack pointer in esp
mov esp, 0x7000	;now put the stack outside of virtual memory in kernel space!

push eax      ;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
 
mov al, 0x20   ;Port number AND command number to Acknowledge IRQ
out 0x20, al   ;Acknowledge IRQ, so we keep getting interrupts

popa           ;Put the standard registers back
sti

iretd           ;Interrupt-Return