rem: if (args.teamID >= 0 && args.teamID != team_get_kernel_team_id()) user_debug_thread_deleted(args.teamID, args.thread->id);
add: if (args.original_team_id >= 0 && args.original_team_id != team_get_kernel_team_id()) { user_debug_thread_deleted(args.original_team_id, args.thread->id); }
context: thread_exit2(void *_args){	struct thread_exit_args args;	// copy the arguments over, since the source is probably on the kernel stack we're about to delete	memcpy(&args, _args, sizeof(struct thread_exit_args));	// we can't let the interrupts disabled at this point	enable_interrupts();	TRACE(("thread_exit2, running on death stack 0x%lx\n", args.t->kernel_stack_base));	// delete the old kernel stack area	TRACE(("thread_exit2: deleting old kernel stack id 0x%lx for thread 0x%lx\n",		args.old_kernel_stack, args.thread->id));	delete_area(args.old_kernel_stack);	// remove this thread from all of the global lists	TRACE(("thread_exit2: removing thread 0x%lx from global lists\n", args.thread->id));	disable_interrupts();	GRAB_TEAM_LOCK();	remove_thread_from_team(team_get_kernel_team(), args.thread);	RELEASE_TEAM_LOCK();	GRAB_THREAD_LOCK();	hash_remove(sThreadHash, args.thread);	sUsedThreads--;	RELEASE_THREAD_LOCK();	// restore former thread interrupts (doesn't matter much at this point anyway)	restore_interrupts(args.int_state);	TRACE(("thread_exit2: done removing thread from lists\n"));	if (args.death_sem >= 0)		release_sem_etc(args.death_sem, 1, B_DO_NOT_RESCHEDULE);		// set the next state to be gone. Will return the thread structure to a ready pool upon reschedule	args.thread->next_state = THREAD_STATE_FREE_ON_RESCHED;	// notify the debugger	if (args.teamID >= 0 && args.teamID != team_get_kernel_team_id())		user_debug_thread_deleted(args.teamID, args.thread->id);	// return the death stack and reschedule one last time	put_death_stack_and_reschedule(args.death_stack);	// never get to here	panic("thread_exit2: made it where it shouldn't have!\n");}