rem: switch (slot) { case 0: asm("movl %0, %%dr0" : : "r"(address)); break; case 1: asm("movl %0, %%dr1" : : "r"(address)); break; case 2: asm("movl %0, %%dr2" : : "r"(address)); break; case 3: asm("movl %0, %%dr3" : : "r"(address)); break; }
context: set_breakpoint(void *address, uint32 type, uint32 length){	if (!address)		return B_BAD_VALUE;	struct thread *thread = thread_get_current_thread();	status_t error = B_OK;	cpu_status state = disable_interrupts();	GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);	arch_team_debug_info &info = thread->team->debug_info.arch_info;	// check, if there is already a breakpoint at that address	bool alreadySet = false;	for (int32 i = 0; i < X86_BREAKPOINT_COUNT; i++) {		if (info.breakpoints[i].address == address			&& info.breakpoints[i].type == type) {			alreadySet = true;			break;		}	}	if (!alreadySet) {		// find a free slot		int32 slot = -1;		for (int32 i = 0; i < X86_BREAKPOINT_COUNT; i++) {			if (!info.breakpoints[i].address) {				slot = i;				break;			}		}		// init the breakpoint		if (slot >= 0) {			info.breakpoints[slot].address = address;			info.breakpoints[slot].type = type;			info.breakpoints[slot].length = length;			info.dr7 |= (length << sDR7Len[slot])				| (type << sDR7RW[slot])				| (1 << sDR7L[slot]);			// set the respective debug address register (DR0-DR3)			switch (slot) {				case 0: asm("movl %0, %%dr0" : : "r"(address)); break;				case 1: asm("movl %0, %%dr1" : : "r"(address)); break;				case 2: asm("movl %0, %%dr2" : : "r"(address)); break;				case 3: asm("movl %0, %%dr3" : : "r"(address)); break;			}		} else {			if (type == X86_INSTRUCTION_BREAKPOINT)				error = B_NO_MORE_BREAKPOINTS;			else				error = B_NO_MORE_WATCHPOINTS;		}	}	RELEASE_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);	restore_interrupts(state);	return error;}