Skip to content

Apple Adventure#1

Closed
RandyGaul wants to merge 4 commits intoedubart:mainfrom
RandyGaul:randy_apple_adventure
Closed

Apple Adventure#1
RandyGaul wants to merge 4 commits intoedubart:mainfrom
RandyGaul:randy_apple_adventure

Conversation

@RandyGaul
Copy link
Copy Markdown
Contributor

Getting things to work on Apple, at least a little bit

Weirdly if _XOPEN_SOURCE is not defined near the top of the file, then the entire ucontext fallback fails. I think this define is affecting various includes on apple, so it's defined near the very tip top of everything
@RandyGaul
Copy link
Copy Markdown
Contributor Author

Weirdly if _XOPEN_SOURCE is not defined near the top of the file, then the entire ucontext fallback fails. I think this define is affecting various includes on apple, so it's defined near the very tip top of everything

@RandyGaul
Copy link
Copy Markdown
Contributor Author

I found three nice links with a ton of info on this topic.

Search for the keyword COCO_STACKADJUST.

@RandyGaul RandyGaul changed the title Randy apple adventure Apple Adventure Jan 16, 2021
Comment thread minicoro.h
"movq %r13, %rdi\n\t"
#if defined(__APPLE__)
"sub $8, %rsp\n\t"
#endif
Copy link
Copy Markdown
Owner

@edubart edubart Jan 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offsetting here will probably make the dummy return address endup in the wrong place. The dummy return address assists debugging as the last function in the backtrace when you put a breakpoint inside a coroutine. The offset should be really on _mco_makectx to overcome this, just like other platform ifdefs offsets there.

Comment thread tests/mt-example.c
#define MINICORO_IMPL
#include "minicoro.h"
#define C89THREAD_IMPLEMENTATION
#include "thirdparty/c89thread.h"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I am trying to support the c89thread (from David Reid the author of miniaudio) so I don't wish to change the library here, I told him the issue there about the Mac OS compilation and he fixed, and the library has been updated in a recent commit.

@edubart
Copy link
Copy Markdown
Owner

edubart commented Jan 16, 2021

I found three nice links with a ton of info on this topic.

Search for the keyword COCO_STACKADJUST.

Thanks for helping out, researching this and getting minicoro running on Mac OS! From what we have read we need to offset then by 8 bytes and we should be fine on Mac.

@edubart edubart self-requested a review January 16, 2021 23:02
@edubart
Copy link
Copy Markdown
Owner

edubart commented Jan 16, 2021

Thanks @RandyGaul I went ahead and made the changes on my side in a8f3698
so I will close this.

@edubart edubart closed this Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants