Date: Wed, 2 Sep 1998 11:06:11 +0300 (IDT) From: Eli Zaretskii To: Zixyer S Qwerty cc: djgpp AT delorie DOT com Subject: Re: HW Interrupts In-Reply-To: <19980901.164210.6318.1.zixyer@juno.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 1 Sep 1998, Zixyer S Qwerty wrote: > I'm porting a program that hooks int 9 and chains to the initial > interrupt only under certain conditions (by executing a jmp instruction). > How would you do this in DJGPP? There are several examples floating around that do this. The FAQ lists some of them (in section 22.2). Another example is in the DJGPP library sources (djlsr201.zip), in the file src/libc/go32/exceptn.S (yes, the DJGPP startup code itself hooks the keyboard interrupt). > Also, the FAQ says that in practice it's impossible to lock all the > memory that an interrupt handler touches if it's written in C. Is > this true? Of course, it's true! One particularly nasty problem is that you cannot lock the stack from a C function, so automatic variables cannot be locked. Locking the code of a C function is also hard (how do you know the size of the code of a function?). A trick is widely used to work around this, but it isn't guaranteed to work with all versions of the compiler and with all possible combinations of optimization options.