-
Notifications
You must be signed in to change notification settings - Fork 4
I78 user state #140
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
base: master
Are you sure you want to change the base?
I78 user state #140
Conversation
… to pass a 64bit val from set() to bind(); initialized more of the invocation buf, this is likely at the wrong place
…k for the state frame to stay below 4KiB
…ew thread state address if the frame was changed while the EC was loaded
… to pass a 64bit val from set() to bind(); initialized more of the invocation buf, this is likely at the wrong place
…k for the state frame to stay below 4KiB
…ew thread state address if the frame was changed while the EC was loaded
|
Creating pthreads works again. However, not all of the allocated kernel objects are deleted after the thread has finished. |
…n in EC::setFlagsSuspend
kubanrob
left a comment
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.
Looks good, compiles, haven't tested it ... I added some comments for nitpicking.
| { | ||
| MLOG_INFO(mlog::ec, "EC setEntryPoint", DVARhex(rip)); | ||
| threadState.rip = rip; | ||
| if (!state) return; |
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.
This might need a return value if it can fail.
| if (state) { | ||
| state->threadState.fs_base = fs; | ||
| state->threadState.gs_base = gs; | ||
| } |
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.
We might want to return an error code to our unsuspecting user.
| void ExecutionContext::handleTrap() | ||
| { | ||
| auto ctx = &threadState; | ||
| auto ctx = &state->threadState; |
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.
Are we sure that state != nullptr?
| getLocalPlace().setCR3(info.table); // without reload if not changed | ||
| } | ||
| // Reload the address space and thread state address if they have changed | ||
| getLocalPlace().setCR3(page_table); // without reload if not changed |
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.
We should be very careful never to set CR3 to nullptr. Maybe assert page_table != nullptr or at least use the default/fallback system PML4 as a "null" value.
Store state of execution contexts in user accessible memory frames. This includes the CPU and FPU registers. The objective is to enable easier access to suspended threads for user-mode trap handlers and thread management.
Integration into the musl pthreads support code is still pending.