diff options
Diffstat (limited to 'coroutine/win64')
| -rw-r--r-- | coroutine/win64/Context.S | 2 | ||||
| -rw-r--r-- | coroutine/win64/Context.asm | 2 | ||||
| -rw-r--r-- | coroutine/win64/Context.h | 15 |
3 files changed, 14 insertions, 5 deletions
diff --git a/coroutine/win64/Context.S b/coroutine/win64/Context.S index 4b16e0ce8c..e0ee38e006 100644 --- a/coroutine/win64/Context.S +++ b/coroutine/win64/Context.S @@ -2,7 +2,7 @@ ## This file is part of the "Coroutine" project and released under the MIT License. ## ## Created by Samuel Williams on 4/11/2018. -## Copyright, 2018, by Samuel Williams. All rights reserved. +## Copyright, 2018, by Samuel Williams. ## .text diff --git a/coroutine/win64/Context.asm b/coroutine/win64/Context.asm index 59673ffa3e..8c4dea1c93 100644 --- a/coroutine/win64/Context.asm +++ b/coroutine/win64/Context.asm @@ -2,7 +2,7 @@ ;; 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. ;; .code 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 */ |
