rem: dbg_add_command(&dump_sem_list, "sems", "Dump a list of all active semaphores"); dbg_add_command(&dump_sem_info, "sem", "Dump info about a particular semaphore");
add: add_debugger_command("sems", &dump_sem_list, "Dump a list of all active semaphores"); add_debugger_command("sem", &dump_sem_info, "Dump info about a particular semaphore");
context: int sem_init(kernel_args *ka){	int i;	dprintf("sem_init: entry\n");	// create and initialize semaphore table	sem_region = vm_create_anonymous_region(vm_get_kernel_aspace_id(), "sem_table", (void **)&sems,		REGION_ADDR_ANY_ADDRESS, sizeof(struct sem_entry) * MAX_SEMS, REGION_WIRING_WIRED, LOCK_RW|LOCK_KERNEL);	if(sem_region < 0) {		panic("unable to allocate semaphore table!\n");	}	memset(sems, 0, sizeof(struct sem_entry) * MAX_SEMS);	for(i=0; i<MAX_SEMS; i++)		sems[i].id = -1;	// add debugger commands	dbg_add_command(&dump_sem_list, "sems", "Dump a list of all active semaphores");	dbg_add_command(&dump_sem_info, "sem", "Dump info about a particular semaphore");	dprintf("sem_init: exit\n");	sems_active = true;	return 0;}