[Gambas-user] Issue 226 in gambas: SIGSEGV handler overwritten (for too long)

gambas at ...2524... gambas at ...2524...
Thu Mar 29 18:07:31 CEST 2012


Comment #2 on issue 226 by x1F3O3X7x at ...626...: SIGSEGV handler overwritten  
(for too long)
http://code.google.com/p/gambas/issues/detail?id=226

I'm developing a xbox emulator in C.

The xbox is a 32 bit x86 system and hence xbox code can be ran natively on  
x86 emulation hosts.

Xbox hardware and kernel access is emulated by catching SIGSEGV errors (on  
umemory access and HLT instructions). Stepping must be done sometimes which  
requires an additional SIGTRAP handler. Additionally, on 64 bit systems,  
the host CPU is brought into 32 bit mode using a SIGSEGV handler.

The emulator is a .dll on windows and a .so on linux. This has various  
benefits.

I wrote a debugger to debug the emulator in gambas which is working great.
The debugger GUI will present the developer with a list of executables.  
When the developer wants to start the application gambas calls a function  
exported by the emulator. Now the emulation is running in the background  
and the debugger GUI can still work.
However, all gambas memory access must go through my own functions once  
emulation has started. Otherwise the gambas signal handler will stop  
hardware emulation which will crash the application.
Using my own functions for the memory access is not optimal though.

I'm currently planning to write an unsafe-memory component for gambas. Is  
there a template component I could use to get started?

Also, what do you mean by "Which library does install a SIGSEGV handler  
without calling previously installed error handler?" ?
I should also mention that it's not possible for my SIGSEGV handler to call  
any other signal handler because the TLS segment register in glibc (fs) is  
modified. Furthermore the processor might be in 32 bit mode during handler  
execution.





More information about the User mailing list