www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/04/12:57:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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 <allen DOT leung AT aleri DOT com>
To: cygwin AT cygwin DOT com
Cc: Allen Leung <allen DOT leung AT aleri DOT com>
Subject: Re: Bypassing cygwin's signal handling
Message-ID: <20021004125818.A310@aleri.com>
Reply-To: allen DOT leung AT aleri DOT com
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0210031746330 DOT 13573-100000 AT slinky DOT cs DOT nyu DOT edu> <Pine DOT GSO DOT 4 DOT 44 DOT 0210031807570 DOT 13573-100000 AT slinky DOT cs DOT nyu DOT edu>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5.1i
In-Reply-To: <Pine.GSO.4.44.0210031807570.13573-100000@slinky.cs.nyu.edu>; 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 <exceptions.h>
> #include <sys/cygwin.h>
> 
> ...
> 	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 = &el;
   /* 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019