Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. algndjmp.h
  6. Abstract:
  7. This file wraps around setjmp/longjmp functions to fix up alignment
  8. problems created by UFL memory management.
  9. Author:
  10. Larry Zhu (LZhu) 11-Apr-2001 Created
  11. Environment:
  12. User Mode -Win32
  13. Revision History:
  14. --*/
  15. #ifndef _ALGNDJMP_H_
  16. #define _ALGNDJMP_H_
  17. #include <setjmp.h>
  18. #define IN
  19. #define OUT
  20. #ifndef _M_IX86
  21. void
  22. PS_CopyJmpBuf(
  23. IN int iSetjmpRetVal,
  24. OUT jmp_buf envDest,
  25. IN jmp_buf envSrc
  26. );
  27. #define DEFINE_ALIGN_SETJMP_VAR jmp_buf PS_AlignedJmpBuf; int iSetjmpRetVal
  28. #define SETJMP(x) (iSetjmpRetVal = setjmp(PS_AlignedJmpBuf), (void)PS_CopyJmpBuf(iSetjmpRetVal, (x), PS_AlignedJmpBuf), iSetjmpRetVal)
  29. #define LONGJMP(x,y) do { (void)memcpy(PS_AlignedJmpBuf, (x), sizeof(jmp_buf)); (void)longjmp(PS_AlignedJmpBuf, (y)); } while (0)
  30. #else
  31. #define DEFINE_ALIGN_SETJMP_VAR
  32. #define SETJMP(x) setjmp(x)
  33. #define LONGJMP(x,y) longjmp((x), (y))
  34. #endif
  35. #endif // #ifndef _ALGNDJMP_H_