Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 4 Oct 2002 12:58:19 -0400 From: Allen Leung To: cygwin AT cygwin DOT com Cc: Allen Leung Subject: Re: Bypassing cygwin's signal handling Message-ID: <20021004125818.A310@aleri.com> Reply-To: allen DOT leung AT aleri DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from pechtcha@cs.nyu.edu on Thu, Oct 03, 2002 at 06:27:14PM -0400 On Thu, Oct 03, 2002 at 06:27:14PM -0400, Igor Pechtchanski wrote: > On Thu, 3 Oct 2002, Igor Pechtchanski wrote: > > Allen, > > Actually, the first thing to try should probably be > > #include > #include > > ... > exception_list el; > cygwin_internal(CW_INIT_EXCEPTIONS, &el); > el.handler = your_handler; > ... > > I'm not sure how to clean this up afterwards, but theoretically this > should work... Chris Faylor will hopefully correct me if I'm wrong. > Igor Thanks, Igor, but I couldn't get this working using cygwin_internal(). This looks like a bug to me: winsup/cygwin/external.cc: extern "C" DWORD cygwin_internal(cygwin_getinfo_types t, ...) { va_list arg; ... case CW_INIT_EXCEPTIONS: init_exceptions ((exception_list *) arg); return 0; } I would've written it as: case CW_INIT_EXCEPTIONS: init_exceptions (va_arg(arg, exception_list *)); return 0; Nevertheless, I've managed to setup my own page fault handler by writing directly to %fs, using essentially the same code as in init_exceptions: asm (".equ __win32_except_list,0"); extern exception_list *_win32_except_list asm ("%fs:__win32_except_list"); { exception_list el; el.handler = page_fault_handler; el.prev = _win32_except_list; _win32_except_list = ⪙ /* run my own code under this handler here */ ... } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/