Xref: news-dnh.mv.net comp.os.msdos.djgpp:2624 Newsgroups: comp.os.msdos.djgpp Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!bcm.tmc.edu!news.msfc.nasa.gov!newsfeed.internetmci.com!elvis.delphi.com!uunet!in1.uu.net!psinntp!psinntp!psinntp!psinntp!netrixgw.netrix.com!root From: ld AT jasmine DOT netrix DOT com (Long Doan) Subject: Re: [Q] ISR - Stack switching Lines: 51 Sender: root AT netrix DOT com Organization: Netrix Corporation References: <813408666 DOT 180snx AT techm DOT pl DOT my> Date: Fri, 13 Oct 1995 14:51:26 GMT To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp 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 ==============================================================