Xref: news2.mv.net comp.os.msdos.djgpp:6784 From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams) Newsgroups: comp.os.msdos.djgpp Subject: Re: writing hw interrupt handlers. Date: Sat, 03 Aug 1996 23:15:07 GMT Lines: 52 Message-ID: <839113992.16777.1@abwillms.demon.co.uk> References: <4tuak7$h7m AT news DOT goodnet DOT com> NNTP-Posting-Host: abwillms.demon.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp snarfy AT goodnet DOT com wrote: >After reading the DPMI 0.9 spec and after looking through FAQ, I'm a >bit perplexed. The FAQ says that using _go32_dpmi_allocate_iret_wrapper >shouldn't be used in production quality code, since you can't really >lock the wrapper. I'm not sure what a DPMI compliant interrupt handler >should do though, and I know very little about protected mode. > >Lets say I was hooking IRQ0 and I didn't want to allocate the iret_wrapper. >What would the interrupt code have to look like? >Sample code: >_protected_mode_IRQ0_handler: >cli >...do some stuff >movb $0x20,%al >outb %al, $0x20 >sti >iret >Now, what else would have to be added to that code to make it work >without calling _go32_dpmi_allocate_iret_wrapper() on it? Maybe a >pusha, popa, stack switch, ... ? See the Allegro sources. I'm writing an interrupt handling tutorial which will include a library to do just that, and make locking easier by sticking locked stuff into special sections. >On a side note, can I access my pmode variables in a real mode interrupt? >Are there any special considerations I have to take into account (like >making sure the variables are in DOS mem)? Normal C variables, no. What you can do is to allocate some DOS mem and use it as a buffer, like dynamic allocation; pass the realmode pointer down to this realmode interrupt handler. Why are you making a realmode handler, anyway? The handler you pass to set_real_mode_vector_whatever doesn't execute in real mode - you make a protected mode thunk for it. No DJGPP-made code ever runs in real mode (as far as I know)! Regards, ABW -- I have become... Comfortably numb... Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk http://www.hardcafe.co.uk/Alaric/