Mail Archives: djgpp/1995/10/13/19:10:25
In article <813408666 DOT 180snx AT techm DOT pl DOT my> kenfoo AT techm DOT pl DOT my (Kenneth Foo) writes:
> Question.
> How do we switch stacks in an interrupt service routine?
Some sample of code:
asm ("
/*--------------------------------------------------------------------
Switch stack.
--------------------------------------------------------------------*/
pushl %eax
pushl %ebx
movl %esp, %eax
movw %ss, %bx
pushl %ds
popl %ss
movl _My_isr_stack_end, %esp
pushl $0
pushl %eax
pushl %ebx
/*--------------------------------------------------------------------
Do whatever is necessary here
--------------------------------------------------------------------*/
call _my_big_interrupt_service_routine
/*--------------------------------------------------------------------
Switch stack back.
--------------------------------------------------------------------*/
popl %ebx
popl %eax
movw %bx, %ss
movl %eax, %esp
popl %ebx
popl %eax
");
> Must %esp be doubleword (4-byte) aligned?
Yep.
Hope that helps,
Long.
--
==============================================================
Long Doan ld AT netrix DOT com
Netrix Corporation ldoan1 AT osf1 DOT gmu DOT edu
13595 Dulles Technology Drive
Herndon Va 22071
==============================================================
- Raw text -