예제 #1
0
파일: vcore.c 프로젝트: windyuuy/akaros
/* Helper, that actually makes sure a vcore is running.  Call this is you really
 * want vcoreid.  More often, you'll want to call the regular version. */
static void __ensure_vcore_runs(uint32_t vcoreid)
{
    if (vcore_is_preempted(vcoreid)) {
        printd("[vcore]: VC %d changing to VC %d\n", vcore_id(), vcoreid);
        /* Note that at this moment, the vcore could still be mapped (we're
         * racing with __preempt.  If that happens, we'll just fail the
         * sys_change_vcore(), and next time __ensure runs we'll get it. */
        /* We want to recover them from preemption.  Since we know they have
         * notifs disabled, they will need to be directly restarted, so we can
         * skip the other logic and cut straight to the sys_change_vcore() */
        sys_change_vcore(vcoreid, FALSE);
    }
}
예제 #2
0
파일: mhello.c 프로젝트: anandab/akaros
void ghetto_vcore_entry(void)
{
	uint32_t vcoreid = vcore_id();
	static bool first_time = TRUE;

	temp = 0xcafebabe;
	/* vcore_context test (don't need to do this anywhere) */
	assert(in_vcore_context());

	/* old logic was moved to parlib code */
	if (current_uthread) {
		assert(vcoreid == 0);
		run_current_uthread();
	}
	/* unmask notifications once you can let go of the uthread_ctx and it is
	 * okay to clobber the transition stack.
	 * Check Documentation/processes.txt: 4.2.4.  In real code, you should be
	 * popping the tf of whatever user process you want (get off the x-stack) */
	enable_notifs(vcoreid);

/* end: stuff userspace needs to do to handle notifications */

	printf("Hello from vcore_entry in vcore %d with temp addr %p and temp %p\n",
	       vcoreid, &temp, temp);

	#if 0
	/* Test sys change vcore.  Need to manually preempt the pcore vcore4 is
	 * mapped to from the monitor */
	udelay(20000000);
	if (vcoreid == 1) {
		disable_notifs(vcoreid);
		printf("VC1 changing to VC4\n");
		sys_change_vcore(4, TRUE);		/* try both of these manually */
		//sys_change_vcore(4, FALSE);		/* try both of these manually */
		printf("VC1 returned\n");
	}
	udelay(10000000);
	#endif

	vcore_request(1);
	//mcs_barrier_wait(&b,vcore_id());
	udelay(vcoreid * 10000000);
	//exit(0);
	while(1);
}