Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!samsung!umich!sharkey!tygra!dave From: dave@tygra.ddmi.com (David Conrad) Newsgroups: comp.lang.pascal Subject: Re: Problems with interrupt handler for interrupt 08 or 1C in TP 6.0 Message-ID: <1991Jan7.112746.8829@tygra.ddmi.com> Date: 7 Jan 91 11:27:46 GMT References: <11648@j.cc.purdue.edu> <139.2787282f@vax1.cc.lehigh.edu> Organization: Moore Software, Detroit, MI Lines: 31 In article <139.2787282f@vax1.cc.lehigh.edu> lukrw@vax1.cc.lehigh.edu writes: > The other thing to >be very careful of is the stack size at the time of the interrupt. >It is very unpredictable, and you may be running out and not know it. >Be sure to turn off all runtime check to help keep your interrupt >from overflowing the stack, and keep the processing to an absolute >minimum (try not to use any procedures or local variables as well). >It is possible to switch to an alternate stack using an assembly >routine, which would make things much safer. Email me for the >procedure if you need it. -- Kevin That may not make things safer. In fact, if not done extremely carefully, it could be really, really dangerous. The reason is that if you switch to an alternate stack then your handler will most likely not be reentrant, and if it does reenter it trashes its own stack. I can think of ways to make handlers which switch stacks reentrant, but they are ugly and complex (How about storing the state of the stack in a global variable and have all instructions which affect the stack execute in `critical' sections of code with interrupts turned off and the global variable gets updated at the same time. Sound like fun? No? I didn't think so). -- David Conrad | Computer: SYNTAX ERROR. dave@tygra.ddmi.com | Me: No, a syntax error would be, `Me hit uunet!tygra!dave | computer in screen with big rock'. ------------------------| Computer: APPROXIMATELY TWO BILLION DOLLARS. "Why not just go mad?" | -- Dave Barry -- = CAT-TALK Conferencing Network, Computer Conferencing and File Archive = - 1-313-343-0800, 300/1200/2400/9600 baud, 8/N/1. New users use 'new' - = as a login id. AVAILABLE VIA PC-PURSUIT!!! (City code "MIDET") = E-MAIL Address: dave@DDMI.COM