Message-ID: <3E074805.3080304@spam.org> Date: Mon, 23 Dec 2002 18:29:41 +0100 From: Kiwanda User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20020829 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp To: Eli Zaretskii Cc: djgpp AT delorie DOT com Subject: Re: djgpp hw interrupt seg fault References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > On Thu, 19 Dec 2002, Ewout Boks wrote: > > >>I installed a similar handler for the timer hook (using >>_go32_dpmi_set_protected_mode_interrupt_vector() ) and I locked all >>variables and code involved using the go32 lock functions. The handler >>itself does all the necessary pushing and pooing of registers etc. >> >>When I run the code (on Win NT in a DOS box) I get a segmentation fault >>as soon as the handler tries to modify a global variable - data local to >>the handler can be manipulated without problems. > > > Did you lock that global variable as well? > > Thanks for your reply. Yes, I did using the _go32_dpmi and later __dpmi__ functionsto lock variables, code and stack. I did notice that the code behaved differently when I tested it on a system running FreeDOS instead of Win NT. I also read that it is impossible to switch a protected mode stack frame when in the HW ISR handler. The only way to accomplish that would be to use the signal facility and do the switch when back in protected mode. Trouble with that is, if you want to send a process a signal (with 'kill') you need to supply kill with the pid of that process. This PID is also not available to the HW handler. I put it in a variable and locked that variable, but again I get a segmentation fault when the handler tries to read the pid value. One other thing that may cause a problem : I am developing my code under FreeBSD, and use the djgpp port (package, like rpm under Redhat Linux) for FreeBSD. The djgpp port is version 2, but unfortunately uses version 2.7 of the gcc cross compiler, which is really old. I haven't tried to install gcc 3.2 yet, perhaps that would solve this. Also, I think Windows NT isn't 100% compatible with 'real' MS DOS. If you can shed any further light on this, that would be great! Thanks, Ewout ( k i w a n d a @@@@@ b o k s . c o m )