summaryrefslogtreecommitdiff
path: root/asm/pit.s
diff options
context:
space:
mode:
Diffstat (limited to 'asm/pit.s')
-rw-r--r--asm/pit.s50
1 files changed, 28 insertions, 22 deletions
diff --git a/asm/pit.s b/asm/pit.s
index ab8dcdb..c25e9a1 100644
--- a/asm/pit.s
+++ b/asm/pit.s
@@ -12,32 +12,38 @@ pit_get_ticks:
pit_interrupt_handler:
- // increase tick counter
- push %eax
- mov $ticks, %eax
- incl (%eax)
- pop %eax
-
- ////
-
- pusha //Push all standard registers
-
- mov %esp, %eax //save current stack pointer (pointing to registers!)
-
- movl $stack_top, %esp //use stack from multiboot.s(16Kb)
+ push %eax // persist
- // call our scheduler passing it the old stack addres (pointing to pushed registers (pusha))
- push %eax
- call task_switch_next
-
- // the scheduler returned the new stack pointer (after taskswitch)
- mov %eax, %esp //Replace the stack with what the C code gave us
+ // INC TICK COUNTER
+ mov $ticks, %eax
+ incl (%eax)
- // acknowlege irq
- mov $0x20,%al
+ // ACK IRQ
+ mov $0x20,%al
out %al,$0x20
+
+ pop %eax // load original
- popa //Put the standard registers back
+ ///////
+
+ pusha //Push all standard registers
+ push %ds //Push data segment
+ push %es //etc...
+ push %fs
+ push %gs
+
+ mov %esp, %eax // remember current %esp
+ movl $stack_top, %esp // switch to our small scheduler stack
+
+ push %eax // set original %esp as param and...
+ call task_switch_next // call scheduler
+ mov %eax, %esp // use %esp we got from scheduler
+
+ pop %gs
+ pop %fs
+ pop %es
+ pop %ds
+ popa
iret