-
Notifications
You must be signed in to change notification settings - Fork 581
i#5383: macOS a64 client threads and private TLS #7300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ndrewh
wants to merge
17
commits into
DynamoRIO:master
Choose a base branch
from
ndrewh:i5383-macos-a64-tls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
93bccab
i#5383: macOS a64 client threads and private TLS
ndrewh 1bbc27a
fix
ndrewh 4539c1f
clang-format
ndrewh a23266c
fix ifdef in dynamorio_clone_macos
ndrewh 9830068
fix x86 macos build, comments
ndrewh 0d395f1
clean
ndrewh b6fac84
remove unrelated changes for separate PR
ndrewh 98c7585
Merge remote-tracking branch 'origin/master' into i5383-macos-a64-tls
ndrewh bc09471
drsyscall does not support macOS+arm64
ndrewh ab0e21b
comment about freeing the thread record
ndrewh dbebfbb
un-move new_bsdthread_setup
ndrewh 37338da
x86_code.c -> asm_aux.c
ndrewh fba79ba
update
ndrewh 5ad0094
im having a skill issue
ndrewh 482a3da
fix
ndrewh 2950456
fix macOS ARM64 mach syscalls
ndrewh 6fdb283
a64: Move thread_set_tsd from library call to syscall
ndrewh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
/* Copyright (c) 2001 Hewlett-Packard Company */ | ||
|
||
/* | ||
* x86_code.c - auxiliary C routines to assembly routines in x86.asm | ||
* asm_aux.c - auxiliary C routines to assembly routines in x86.asm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*/ | ||
#include "../globals.h" | ||
#include "../fragment.h" | ||
|
@@ -325,11 +325,11 @@ new_thread_setup(priv_mcontext_t *mc) | |
ASSERT_NOT_REACHED(); | ||
} | ||
|
||
# if defined(MACOS) && defined(X86) | ||
/* Called from new_bsdthread_intercept for targeting a bsd thread user function. | ||
# if defined(MACOS) && (defined(X86) || defined(AARCH64)) | ||
/* Called from new_bsdthread_intercept (asm) for targeting a bsd thread user function. | ||
* new_bsdthread_intercept stored the arg to the user thread func in | ||
* mc->xax. We're on the app stack -- but this is a temporary solution. | ||
* i#1403 covers intercepting in an earlier and better manner. | ||
* mc->xax (X86) or mc->r9 (ARM64). We're on the app stack -- but this | ||
* is a temporary solution. i#1403 covers intercepting in an earlier and better manner. | ||
*/ | ||
void | ||
new_bsdthread_setup(priv_mcontext_t *mc) | ||
|
@@ -341,7 +341,11 @@ new_bsdthread_setup(priv_mcontext_t *mc) | |
*/ | ||
ENTERING_DR(); | ||
|
||
# if defined(X86) | ||
crec = (void *)mc->xax; /* placed there by new_bsdthread_intercept */ | ||
# elif defined(AARCH64) | ||
crec = (void *)mc->r9; /* placed there by new_bsdthread_intercept */ | ||
# endif | ||
func_arg = (void *)get_clone_record_thread_arg(crec); | ||
LOG(GLOBAL, LOG_INTERP, 1, | ||
"new_thread_setup: thread " TIDFMT ", dstack " PFX " clone record " PFX "\n", | ||
|
@@ -352,13 +356,16 @@ new_bsdthread_setup(priv_mcontext_t *mc) | |
dcontext = get_thread_private_dcontext(); | ||
ASSERT(dcontext != NULL); | ||
crec = NULL; /* now freed */ | ||
thread_starting(dcontext); | ||
|
||
dynamo_thread_under_dynamo(dcontext); | ||
|
||
/* We assume that the only state that matters is the arg to the function. */ | ||
# ifdef X64 | ||
# if defined(X86) && defined(X64) | ||
mc->rdi = (reg_t)func_arg; | ||
# else | ||
# elif defined(X86) | ||
*(reg_t *)(mc->xsp + sizeof(reg_t)) = (reg_t)func_arg; | ||
# elif defined(AARCH64) | ||
mc->r0 = (reg_t)func_arg; | ||
# endif | ||
|
||
call_switch_stack(dcontext, dcontext->dstack, (void (*)(void *))d_r_dispatch, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I had thoughts about renaming this file in the past.