summaryrefslogtreecommitdiff
path: root/coroutine/win64/Context.h
diff options
context:
space:
mode:
Diffstat (limited to 'coroutine/win64/Context.h')
-rw-r--r--coroutine/win64/Context.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/coroutine/win64/Context.h b/coroutine/win64/Context.h
index 6bf2dc5b35..23b21b5c1c 100644
--- a/coroutine/win64/Context.h
+++ b/coroutine/win64/Context.h
@@ -1,16 +1,22 @@
+#ifndef COROUTINE_WIN64_CONTEXT_H
+#define COROUTINE_WIN64_CONTEXT_H 1
+
/*
* This file is part of the "Coroutine" project and released under the MIT License.
*
* Created by Samuel Williams on 10/5/2018.
- * Copyright, 2018, by Samuel Williams. All rights reserved.
+ * Copyright, 2018, by Samuel Williams.
*/
#pragma once
#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
#include <string.h>
#define COROUTINE __declspec(noreturn) void
+#define COROUTINE_DECL void
enum {
COROUTINE_REGISTERS = 8,
@@ -20,11 +26,12 @@ enum {
struct coroutine_context
{
void **stack_pointer;
+ void *argument;
};
typedef void(* coroutine_start)(struct coroutine_context *from, struct coroutine_context *self);
-void coroutine_trampoline();
+void coroutine_trampoline(void);
static inline void coroutine_initialize_main(struct coroutine_context * context) {
context->stack_pointer = NULL;
@@ -47,7 +54,7 @@ static inline void coroutine_initialize(
/* Return address */
*--context->stack_pointer = 0;
- *--context->stack_pointer = (void*)start;
+ *--context->stack_pointer = (void*)(uintptr_t)start;
*--context->stack_pointer = (void*)coroutine_trampoline;
/* Windows Thread Information Block */
@@ -65,3 +72,5 @@ struct coroutine_context * coroutine_transfer(struct coroutine_context * current
static inline void coroutine_destroy(struct coroutine_context * context)
{
}
+
+#endif /* COROUTINE_WIN64_CONTEXT_H */