site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On 05 Jan 2008, at 12:00, Robert Bielik wrote: 1) PPC: http://svn.freepascal.org/svn/fpc/trunk/rtl/darwin/ppcgen/ppchnd.inc 2) Intel: http://svn.freepascal.org/svn/fpc/trunk/rtl/darwin/x86/x86hnd.inc Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Is there no way to do something similar in Mac OS X? I.e. just to handle the exception and to move on. You can catch the signal using a Unix signal handler. From there you can either longjmp (not advised for floating point exceptions because then the kernel does not restore the fpu exception mask on ppc; although by default all fpu exceptions are masked on darwin, so unlikely to affect you), or modify the signal context's program counter and return to where ever you want (e.g. a function which in turn raises a C++ exception). You can find the Pascal code I wrote for translating such signals into Pascal run time errors and exceptions (using the "modify the signal context" method) at I've kept the names of the data structures the same as in the original C headers, so it should be fairly straightforward to translate it to C ("grep -r uc_mcontext /usr/include" and go from there to see how those types are defined, but in your program you probably only have to include signal.h). The most important part for you is the stuff at the end of the handlers: there I setup the arguments for the function I'm returning to, and its address. One warning about this: for i386 (Intel 32 bit), passing arguments is not going to work like that in C because the default calling convention there passes everything on the stack (while ours is fastcall, where the first three parameters are passed in registers). You may be able to declare your handler in gcc also as fastcall to work around this, but I don't know by heart how this is done. Or you may simply not pass any parameters at all. This email sent to site_archiver@lists.apple.com
participants (1)
-
Jonas Maebe