summaryrefslogtreecommitdiff
path: root/coroutine/win32/Context.h
diff options
context:
space:
mode:
Diffstat (limited to 'coroutine/win32/Context.h')
-rw-r--r--coroutine/win32/Context.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/coroutine/win32/Context.h b/coroutine/win32/Context.h
index 8dd47696c5..ba6b1fd07b 100644
--- a/coroutine/win32/Context.h
+++ b/coroutine/win32/Context.h
@@ -16,6 +16,7 @@ extern "C" {
#define COROUTINE __declspec(noreturn) void __fastcall
+/* This doesn't include thread information block */
const size_t COROUTINE_REGISTERS = 4;
struct coroutine_context
@@ -40,9 +41,9 @@ static inline void coroutine_initialize(
}
/* Windows Thread Information Block */
- *--context->stack_pointer = 0;
- *--context->stack_pointer = stack_pointer;
- *--context->stack_pointer = (void*)stack_size;
+ *--context->stack_pointer = 0; /* fs:[0] */
+ *--context->stack_pointer = stack_pointer + stack_size; /* fs:[4] */
+ *--context->stack_pointer = (void*)stack_pointer; /* fs:[8] */
*--context->stack_pointer = (void*)start;