-
Notifications
You must be signed in to change notification settings - Fork 24
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
Proposal: Async-like way in handling user process #1
Labels
enhancement
New feature or request
Comments
Hi! Glad to see your excellent project! I've made some attempts on this topic: Hope it helps! Thanks! |
@wangrunji0408 Thank you! That's exactly what I would like to implement! |
osblog wrote a new article on this! https://os.phil-opp.com/async-await/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In xv6, code path for trapping into user-space and back is really confusing. Typically this is done with:
forkret()
->usertrap()
-> making syscalls, etc. ->usertrapret()
I've encountered the issue of RAII. As we call
usertrap
inforkret
, any object created inforkret
won't be dropped asusertrap
won't return.Previously I thought this could been done by introducing a
return_to
function, in which RISC-V return address registerra
is rewritten with the address of that function. For example,Therefore, object can be correctly dropped before jumping to usertrap. However, there're many issues with that.
After that, I propose to use a
k_thread()
function to represent full code path for trapping into and returning from user-space.And the scheduler just schedules those
k_thread
s, which solves the RAII issue.Furthermore, I would like to have this issue solved with
async-std
crate, which supports no-std environment.The text was updated successfully, but these errors were encountered: