Beispiel #1
0
Res StackScan(ScanState ss, Addr *stackBot)
{
  jmp_buf jb;
  void *stackTop = &jb;

  /* .assume.stack: This implementation assumes that the stack grows
   * downwards, so that the address of the jmp_buf is the limit of the
   * part of the stack that needs to be scanned. (StackScanInner makes
   * the same assumption.)
   */
  AVER(stackTop < (void *)stackBot);

  (void)setjmp(jb);

  return StackScanInner(ss, stackBot, stackTop, sizeof jb / sizeof(Addr*));
}
Beispiel #2
0
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);
}