VMM: add two vthread functions.
authorRonald G. Minnich <rminnich@gmail.com>
Wed, 7 Sep 2016 16:15:53 +0000 (09:15 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 7 Sep 2016 16:37:40 +0000 (12:37 -0400)
commitc7c388e82aea5b1f37028641a0b67f8ce049cdfb
tree8ee702bf82fac9d0617b71dd3743d78b2cf7c0c2
parent741c47c853d91bd95916dde5bab3455ee44efef5
VMM: add two vthread functions.

The intent of these functions it to give users a familiar
API (pthreads).  I just had the experience of running the
naming by a non-Akaros person and the reaction was really
positive to the pthreads similarity.

Here's a usage example:

struct virtual_machine vm[1];

static volatile int count;

static void vmcall(void *a)
{
while (count < 1000000) {
__asm__ __volatile__("vmcall\n\t");
count++;
}
count++;
while (1);
}

int main(int argc, char **argv)
{

vthread_attr_init(vm, 0);
vthread_create(vm, 0, (uint64_t) vmcall, NULL);

while(count < 2) {
}

return 0;
}

Change-Id: I3e72d8a0efd89482d2f9856daccb7945f7ae1c92
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
[minor formatting]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/vmm/include/vmm/sched.h
user/vmm/include/vmm/vmm.h
user/vmm/vthread.c [new file with mode: 0644]