diff options
| author | Miguel <m.i@gmx.at> | 2018-08-22 00:52:30 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-08-22 00:52:30 +0200 |
| commit | 59038fc67c20a1f04e5d2fd5f9a444e707d1d3ea (patch) | |
| tree | 1b0161c1b6d5caefe900f419fed31cc7d7ad6017 /asm/pit.s | |
| parent | 72c6e9763ca61bc9d7de5f7080ee1c8a1c7c1562 (diff) | |
userspace and kernelspace taskswitching
Diffstat (limited to 'asm/pit.s')
| -rw-r--r-- | asm/pit.s | 50 |
1 files changed, 28 insertions, 22 deletions
@@ -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 |
