switch_x64_msvc.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * this is the internal transfer function.
  3. *
  4. * HISTORY
  5. * 24-Nov-02 Christian Tismer <tismer@tismer.com>
  6. * needed to add another magic constant to insure
  7. * that f in slp_eval_frame(PyFrameObject *f)
  8. * STACK_REFPLUS will probably be 1 in most cases.
  9. * gets included into the saved stack area.
  10. * 26-Sep-02 Christian Tismer <tismer@tismer.com>
  11. * again as a result of virtualized stack access,
  12. * the compiler used less registers. Needed to
  13. * explicit mention registers in order to get them saved.
  14. * Thanks to Jeff Senn for pointing this out and help.
  15. * 17-Sep-02 Christian Tismer <tismer@tismer.com>
  16. * after virtualizing stack save/restore, the
  17. * stack size shrunk a bit. Needed to introduce
  18. * an adjustment STACK_MAGIC per platform.
  19. * 15-Sep-02 Gerd Woetzel <gerd.woetzel@GMD.DE>
  20. * slightly changed framework for sparc
  21. * 01-Mar-02 Christian Tismer <tismer@tismer.com>
  22. * Initial final version after lots of iterations for i386.
  23. */
  24. /* Avoid alloca redefined warning on mingw64 */
  25. #ifndef alloca
  26. #define alloca _alloca
  27. #endif
  28. #define STACK_REFPLUS 1
  29. #define STACK_MAGIC 0
  30. /* Use the generic support for an external assembly language slp_switch function. */
  31. #define EXTERNAL_ASM
  32. #ifdef SLP_EVAL
  33. /* This always uses the external masm assembly file. */
  34. #endif
  35. /*
  36. * further self-processing support
  37. */
  38. /* we have IsBadReadPtr available, so we can peek at objects */
  39. /*
  40. #define STACKLESS_SPY
  41. #ifdef IMPLEMENT_STACKLESSMODULE
  42. #include "Windows.h"
  43. #define CANNOT_READ_MEM(p, bytes) IsBadReadPtr(p, bytes)
  44. static int IS_ON_STACK(void*p)
  45. {
  46. int stackref;
  47. intptr_t stackbase = ((intptr_t)&stackref) & 0xfffff000;
  48. return (intptr_t)p >= stackbase && (intptr_t)p < stackbase + 0x00100000;
  49. }
  50. #endif
  51. */