Mail Archives: cygwin/2002/10/04/12:57:51
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 = ⪙
/* 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 -