rem: dbg_add_command(&dump_port_list, "ports", "Dump a list of all active ports"); dbg_add_command(&dump_port_info, "port", "Dump info about a particular port");
add: add_debugger_command("ports", &dump_port_list, "Dump a list of all active ports"); add_debugger_command("port", &dump_port_info, "Dump info about a particular port");
context: int port_init(kernel_args *ka){	int i;	int sz;	sz = sizeof(struct port_entry) * MAX_PORTS;	// create and initialize semaphore table	port_region = vm_create_anonymous_region(vm_get_kernel_aspace_id(), "port_table", (void **)&ports,		REGION_ADDR_ANY_ADDRESS, sz, REGION_WIRING_WIRED, LOCK_RW|LOCK_KERNEL);	if(port_region < 0) {		panic("unable to allocate kernel port table!\n");	}	memset(ports, 0, sz);	for(i=0; i<MAX_PORTS; i++)		ports[i].id = -1;	// add debugger commands	dbg_add_command(&dump_port_list, "ports", "Dump a list of all active ports");	dbg_add_command(&dump_port_info, "port", "Dump info about a particular port");	ports_active = true;	return 0;}