add: add_debugger_command("unreal", &make_all_threads_unreal, "set all realtime priority threads to normal priority");
context: thread_init(kernel_args *args){	uint32 i;	TRACE(("thread_init: entry\n"));	// create the thread hash table	sThreadHash = hash_init(15, offsetof(struct thread, all_next),		&thread_struct_compare, &thread_struct_hash);	// zero out the dead thread structure q	memset(&dead_q, 0, sizeof(dead_q));	// allocate snooze sem	sSnoozeSem = create_sem(0, "snooze sem");	if (sSnoozeSem < 0) {		panic("error creating snooze sem\n");		return sSnoozeSem;	}	if (arch_thread_init(args) < B_OK)		panic("arch_thread_init() failed!\n");	// skip all thread IDs including B_SYSTEM_TEAM, which is reserved	sNextThreadID = B_SYSTEM_TEAM + 1;	// create an idle thread for each cpu	for (i = 0; i < args->num_cpus; i++) {		struct thread *thread;		area_info info;		char name[64];		sprintf(name, "idle thread %lu", i + 1);		thread = create_thread_struct(name,			i == 0 ? team_get_kernel_team_id() : -1);		if (thread == NULL) {			panic("error creating idle thread struct\n");			return B_NO_MEMORY;		}		thread->team = team_get_kernel_team();		thread->priority = B_IDLE_PRIORITY;		thread->state = B_THREAD_RUNNING;		thread->next_state = B_THREAD_READY;		sprintf(name, "idle thread %lu kstack", i + 1);		thread->kernel_stack_area = find_area(name);		if (get_area_info(thread->kernel_stack_area, &info) != B_OK)			panic("error finding idle kstack area\n");		thread->kernel_stack_base = (addr_t)info.address;		hash_insert(sThreadHash, thread);		insert_thread_into_team(thread->team, thread);		sIdleThreads[i] = thread;		if (i == 0)			arch_thread_set_current_thread(thread);		thread->cpu = &cpu[i];	}	sUsedThreads = args->num_cpus;	// create a set of death stacks	sNumDeathStacks = smp_get_num_cpus();	if (sNumDeathStacks > 8 * sizeof(sDeathStackBitmap)) {		// clamp values for really beefy machines		sNumDeathStacks = 8 * sizeof(sDeathStackBitmap);	}	sDeathStackBitmap = 0;	sDeathStacks = (struct death_stack *)malloc(sNumDeathStacks * sizeof(struct death_stack));	if (sDeathStacks == NULL) {		panic("error creating death stacks\n");		return B_NO_MEMORY;	}	{		char temp[64];		for (i = 0; i < sNumDeathStacks; i++) {			sprintf(temp, "death stack %lu", i);			sDeathStacks[i].area = create_area(temp, (void **)&sDeathStacks[i].address,				B_ANY_KERNEL_ADDRESS, KERNEL_STACK_SIZE, B_FULL_LOCK,				B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_STACK_AREA);			if (sDeathStacks[i].area < 0) {				panic("error creating death stacks\n");				return sDeathStacks[i].area;			}			sDeathStacks[i].in_use = false;		}	}	sDeathStackSem = create_sem(sNumDeathStacks, "death stack availability");	// set up some debugger commands	add_debugger_command("threads", &dump_thread_list, "list all threads");	add_debugger_command("ready", &dump_thread_list, "list all ready threads");	add_debugger_command("running", &dump_thread_list, "list all running threads");	add_debugger_command("waiting", &dump_thread_list, "list all waiting threads (optionally for a specific semaphore)");	add_debugger_command("thread", &dump_thread_info, "list info about a particular thread");	add_debugger_command("next_q", &dump_next_thread_in_q, "dump the next thread in the queue of last thread viewed");	add_debugger_command("next_all", &dump_next_thread_in_all_list, "dump the next thread in the global list of the last thread viewed");	add_debugger_command("next_team", &dump_next_thread_in_team, "dump the next thread in the team of the last thread viewed");	return B_OK;}