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.

49 lines
999 B

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. algndjmp.c
  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. #include "algndjmp.h"
  16. //
  17. // Don't EVER copy jmp_buf when returning from longjmp, because at the time
  18. // when it returns from longjmp, stack variable PS_AlignedJmpBuf maybe is
  19. // totaly trashed!
  20. //
  21. // Don't EVER try to call setjmp in this function, because that will change
  22. // the stack when setjmp is called, hence return address and stack pointer
  23. // registers etc.
  24. //
  25. void
  26. PS_CopyJmpBuf(
  27. IN int iSetjmpRetVal,
  28. OUT jmp_buf envDest,
  29. IN jmp_buf envSrc
  30. )
  31. {
  32. if (!iSetjmpRetVal)
  33. {
  34. (void)memcpy(envDest, envSrc, sizeof(jmp_buf));
  35. }
  36. }