Date: Thu, 19 Dec 2002 22:24:53 +0100 From: Ewout Boks Organization: Boks Embedded Systems 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 Subject: djgpp hw interrupt seg fault Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 34 Message-ID: <3e02386f$0$88849$e4fe514c@news.xs4all.nl> NNTP-Posting-Host: 213.84.165.48 X-Trace: 1040332911 news.xs4all.nl 88849 213.84.165.48:1037 X-Complaints-To: abuse AT xs4all DOT nl To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com hi, I am trying to port some generic software to the 80386 and use DJGPP as the compiler for this. My problem is this: I am trying to hook onto the timer interrupt and install a handler that increments a counter and, if necessary, swaps the stack frame (FYI the generic software is the Micro/C OS-II RTOS by Jean Labrosse ). So, I read the DJGPP HW Interrupt FAQ and discovered that the timer interrupt hook is basically a software interrupt (int $0x1c ). I have two other SW interrupt handlers in my code and they work fine. 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. Also I noticed that the stack frame seemed different from the other software interrupts. I have no idea what is happening. Does anybody know the cause of this or knows about similar things? Thanks, Ewout Boks (kiwanda <---@---> b . o . k . s .. c . o . m