Index: kernel/arch/mips32/src/debugger.c
===================================================================
--- kernel/arch/mips32/src/debugger.c	(revision f4c2b6a104d4ab9ce057413b12ff1efedcba0fcd)
+++ kernel/arch/mips32/src/debugger.c	(revision 1e1e5e1f552946adaf5576371c0d6cd57ecfd5a9)
@@ -34,4 +34,5 @@
 
 #include <arch/debugger.h>
+#include <arch/barrier.h>
 #include <memstr.h>
 #include <console/kconsole.h>
@@ -73,5 +74,6 @@
 static cmd_info_t addbkpt_info = {
 	.name = "addbkpt",
-	.description = "addbkpt <&symbol> - new bkpoint. Break on J/Branch insts unsupported.",
+	.description = "addbkpt <&symbol> - new bkpoint. Break on J/Branch "
+	    "insts unsupported.",
 	.func = cmd_add_breakpoint,
 	.argc = 1,
@@ -85,5 +87,6 @@
 static cmd_info_t addbkpte_info = {
 	.name = "addbkpte",
-	.description = "addebkpte <&symbol> <&func> - new bkpoint. Call func(or Nothing if 0).",
+	.description = "addebkpte <&symbol> <&func> - new bkpoint. Call "
+	    "func(or Nothing if 0).",
 	.func = cmd_add_breakpoint,
 	.argc = 2,
@@ -94,5 +97,5 @@
 	uint32_t andmask;
 	uint32_t value;
-}jmpinstr[] = {
+} jmpinstr[] = {
 	{0xf3ff0000, 0x41000000}, /* BCzF */
 	{0xf3ff0000, 0x41020000}, /* BCzFL */
@@ -118,5 +121,5 @@
 	{0xfc000000, 0x0c000000}, /* JAL */
 	{0xfc1f07ff, 0x00000009}, /* JALR */
-	{0,0} /* EndOfTable */
+	{0, 0} /* EndOfTable */
 };
 
@@ -130,5 +133,5 @@
 	int i;
 
-	for (i=0;jmpinstr[i].andmask;i++) {
+	for (i = 0; jmpinstr[i].andmask; i++) {
 		if ((instr & jmpinstr[i].andmask) == jmpinstr[i].value)
 			return true;
@@ -158,7 +161,9 @@
 			spinlock_unlock(&bkpoints_lock);
 			return 0;
-		} else if (breakpoints[i].address == (uintptr_t)argv->intval + sizeof(unative_t) || \
-			   breakpoints[i].address == (uintptr_t)argv->intval - sizeof(unative_t)) {
-			printf("Adjacent breakpoints not supported, conflict with %d.\n", i);
+		} else if (breakpoints[i].address == (uintptr_t)argv->intval +
+		    sizeof(unative_t) || breakpoints[i].address ==
+		    (uintptr_t)argv->intval - sizeof(unative_t)) {
+			printf("Adjacent breakpoints not supported, conflict "
+			    "with %d.\n", i);
 			spinlock_unlock(&bkpoints_lock);
 			return 0;
@@ -167,5 +172,5 @@
 	}
 
-	for (i=0; i<BKPOINTS_MAX; i++)
+	for (i = 0; i < BKPOINTS_MAX; i++)
 		if (!breakpoints[i].address) {
 			cur = &breakpoints[i];
@@ -186,5 +191,5 @@
 	} else { /* We are add extended */
 		cur->flags = BKPOINT_FUNCCALL;
-		cur->bkfunc = 	(void (*)(void *, istate_t *)) argv[1].intval;
+		cur->bkfunc = (void (*)(void *, istate_t *)) argv[1].intval;
 	}
 	if (is_jump(cur->instruction))
@@ -194,4 +199,5 @@
 	/* Set breakpoint */
 	*((unative_t *)cur->address) = 0x0d;
+	smc_coherence(cur->address);
 
 	spinlock_unlock(&bkpoint_lock);
@@ -200,6 +206,4 @@
 	return 1;
 }
-
-
 
 /** Remove breakpoint from table */
@@ -230,5 +234,7 @@
 	}
 	((uint32_t *)cur->address)[0] = cur->instruction;
+	smc_coherence(((uint32_t *)cur->address)[0]);
 	((uint32_t *)cur->address)[1] = cur->nextinstruction;
+	smc_coherence(((uint32_t *)cur->address)[1]);
 
 	cur->address = NULL;
@@ -253,9 +259,9 @@
 			
 			printf("%-2u %-5d %#10zx %-6s %-7s %-8s %s\n", i,
-				breakpoints[i].counter, breakpoints[i].address,
-				((breakpoints[i].flags & BKPOINT_INPROG) ? "true" : "false"),
-				((breakpoints[i].flags & BKPOINT_ONESHOT) ? "true" : "false"),
-				((breakpoints[i].flags & BKPOINT_FUNCCALL) ? "true" : "false"),
-				symbol);
+			    breakpoints[i].counter, breakpoints[i].address,
+			    ((breakpoints[i].flags & BKPOINT_INPROG) ? "true" :
+			    "false"), ((breakpoints[i].flags & BKPOINT_ONESHOT)
+			    ? "true" : "false"), ((breakpoints[i].flags &
+			    BKPOINT_FUNCCALL) ? "true" : "false"), symbol);
 		}
 	return 1;
@@ -267,5 +273,5 @@
 	int i;
 
-	for (i=0; i<BKPOINTS_MAX; i++)
+	for (i = 0; i < BKPOINTS_MAX; i++)
 		breakpoints[i].address = NULL;
 	
@@ -306,14 +312,14 @@
 
 	spinlock_lock(&bkpoint_lock);
-	for (i=0; i<BKPOINTS_MAX; i++) {
+	for (i = 0; i < BKPOINTS_MAX; i++) {
 		/* Normal breakpoint */
-		if (fireaddr == breakpoints[i].address \
-		    && !(breakpoints[i].flags & BKPOINT_REINST)) {
+		if (fireaddr == breakpoints[i].address &&
+		    !(breakpoints[i].flags & BKPOINT_REINST)) {
 			cur = &breakpoints[i];
 			break;
 		}
 		/* Reinst only breakpoint */
-		if ((breakpoints[i].flags & BKPOINT_REINST) \
-		    && (fireaddr == breakpoints[i].address + sizeof(unative_t))) {
+		if ((breakpoints[i].flags & BKPOINT_REINST) &&
+		    (fireaddr == breakpoints[i].address + sizeof(unative_t))) {
 			cur = &breakpoints[i];
 			break;
@@ -324,6 +330,8 @@
 			/* Set breakpoint on first instruction */
 			((uint32_t *)cur->address)[0] = 0x0d;
+			smc_coherence(((uint32_t *)cur->address)[0]);
 			/* Return back the second */
 			((uint32_t *)cur->address)[1] = cur->nextinstruction;
+			smc_coherence(((uint32_t *)cur->address)[1]);
 			cur->flags &= ~BKPOINT_REINST;
 			spinlock_unlock(&bkpoint_lock);
@@ -334,9 +342,10 @@
 		
 		if (!(cur->flags & BKPOINT_FUNCCALL))
-			printf("***Breakpoint %d: %p in %s.\n", i, 
-			       fireaddr, get_symtab_entry(istate->epc));
+			printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
+			    get_symtab_entry(istate->epc));
 
 		/* Return first instruction back */
 		((uint32_t *)cur->address)[0] = cur->instruction;
+		smc_coherence(cur->address);
 
 		if (! (cur->flags & BKPOINT_ONESHOT)) {
