Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irq_common_stub:
- pushad
- mov ax, ds
- push eax
- mov ax, 0x10 ;0x10
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov eax, dr6
- push eax
- push esp ; At this point ESP is a pointer to where DS (and the rest
- ; of the interrupt handler state resides)
- ; Push ESP as 1st parameter as it's a
- ; pointer to a registers_t
- call irq_handler
- mov eax, [switch_task]
- cmp eax, 1
- je changeTasks
- pop ebx
- pop ebx ; Remove the saved ESP on the stack. Efficient to just pop it
- ; into any register. You could have done: add esp, 4 as well
- pop ebx
- mov ds, bx
- mov es, bx
- mov fs, bx
- mov gs, bx
- popad
- add esp, 8
- sti
- iret
- changeTasks:
- mov eax, 0
- mov [switch_task], eax
- call store_global ; Set a global variable with C
- add esp, 72 ; "Pop" 18 values off the stack
- jmp irq_schedule ; Switch task
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement