Still haven't found a stack diagram of what Linux hands over to a signal handler. What I've managed to piece together, possibly accurately, is this (offsets indicate dwords, multiply by 4 for byte offset):
Offset Contents Example 0 return addr 0x0fffe420 1 signal number 0xb (11=segfault) 2 GS (?) 0 (start of interrupted task's registers) 3 FS (?) 0 4 ES (?) 0x7b 5 DS (?) 0x7b 6 EDI 0x08088000 7 ESI 0 8 EBP 0 9 ESP 0xbffffcbc 10 EBX 2 11 EDX 0xc 12 ECX 0x10 13 EAX 0xa 14 ? 0xe 15 ? 4 16 addr that faulted 0x08048131 (rep scasb) 17 CS (?) 0x73 18 eflags 0x00010206 19 ESP 0xbffffcbc 20 SS 0x7b
The signal number is also provided in EAX. All the above registers, including the flags and return address, can be modified by the handler. Very ugly and nonportable, but magical in its possibilities.
My brilliant idea of speeding up I/O using memory protection and signal handling failed. I still believe it has possibilities, but I need to find a way to profile what's going on.
last updated 2009-12-18 16:40:46. served from tektonic.jcomeau.com