1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-28 17:51:48 -07:00
emacs/mps/code/ssw3i3mv.c
Richard Brooksby 4c51d72b56 Partial merge of branch/2012-07-23/cet-transform, excluding cet-specific parts.
Copied from Perforce
 Change: 179309
 ServerID: perforce.ravenbrook.com
2012-09-06 17:17:18 +01:00

35 lines
1 KiB
C
Executable file

/* ssw3mv.c: STACK SCANNING FOR WIN32 WITH MICROSOFT C
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
*
* This scans the stack and fixes the registers which may contain roots.
* See <design/thread-manager/>.
*/
#include "mpm.h"
#include <setjmp.h>
SRCID(ssw3mv, "$Id$");
Res StackScan(ScanState ss, Addr *stackBot)
{
jmp_buf jb;
/* We rely on the fact that Microsoft C's setjmp stores the callee-save
registers in the jmp_buf. */
(void)setjmp(jb);
/* These checks will just serve to warn us at compile-time if the
setjmp.h header changes to indicate that the registers we want aren't
saved any more. */
AVER(sizeof(((_JUMP_BUFFER *)jb)->Edi) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->Esi) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->Ebx) == sizeof(Addr));
AVER(offsetof(_JUMP_BUFFER, Edi) == offsetof(_JUMP_BUFFER, Ebx) + 4);
AVER(offsetof(_JUMP_BUFFER, Esi) == offsetof(_JUMP_BUFFER, Ebx) + 8);
return StackScanInner(ss, stackBot, (Addr *)&((_JUMP_BUFFER *)jb)->Ebx, 3);
}