svn commit: r290434 - head/sys/powerpc/powerpc

Justin Hibbits jhibbits at FreeBSD.org
Fri Nov 6 04:56:54 UTC 2015


Author: jhibbits
Date: Fri Nov  6 04:56:52 2015
New Revision: 290434
URL: https://svnweb.freebsd.org/changeset/base/290434

Log:
  Write 2- and 4-byte aligned values as single writes in ddb(4)
  
  On the mpc85xx SoC family, writes to any part of a word in the CCSR affect the
  full word.  This prevents single-byte writes from taking the desired effect.
  
  Code copied directly from ARM.

Modified:
  head/sys/powerpc/powerpc/db_interface.c

Modified: head/sys/powerpc/powerpc/db_interface.c
==============================================================================
--- head/sys/powerpc/powerpc/db_interface.c	Fri Nov  6 04:45:29 2015	(r290433)
+++ head/sys/powerpc/powerpc/db_interface.c	Fri Nov  6 04:56:52 2015	(r290434)
@@ -67,8 +67,14 @@ db_write_bytes(vm_offset_t addr, size_t 
 		dst = (char *)addr;
 		cnt = size;
 
-		while (cnt-- > 0)
-			*dst++ = *data++;
+		if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0)
+			*((int*)dst) = *((int*)data);
+		else
+		if (size == 2 && (addr & 1) == 0 && ((uintptr_t)data & 1) == 0)
+			*((short*)dst) = *((short*)data);
+		else
+			while (cnt-- > 0)
+				*dst++ = *data++;
 		kdb_cpu_sync_icache((void *)addr, size);
 	}
 	(void)kdb_jmpbuf(prev_jb);


More information about the svn-src-head mailing list