vmm: Add vthread_join()
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 13 Sep 2017 17:31:41 +0000 (13:31 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 15 Sep 2017 13:31:24 +0000 (09:31 -0400)
commitbd1e8a185b04d207ec78e1b6e32b3a5d9f8abbe6
treec1fb52dbe67b2a6ab77819339920d98014c653b0
parent62ea33e1c93bc9d6e339ea12485546e99f40a507
vmm: Add vthread_join()

The main idea is surprisingly easy - the controller needs to call
uth_2ls_thread_exit(), which is what normal threads call when they exit.
This is normally hidden by the 2LS.

A vthread can exit by making a vmcall, then the controller exits on its
behalf.  The joiner actually joins on the controller (which is a uthread),
instead of the guest_thread.

The slightly tricky part was getting the uthreads to be reinitialized
properly, and noting that the join exit callback is called from vcore
context.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/vmm/include/vmm/vthread.h
user/vmm/sched.c
user/vmm/vthread.c