NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/50038: udl (DisplayLink GX-DVI_U2B) alignment fault on earmv6hf NETWALKER



On 11/14/16 18:31, MOCHIDA Shuji wrote:


Now it's been shown that device/strongly ordered memory is the reason I think we should commit your diff...


--- udl.c.ORIG	2016-10-19 05:17:37.000000000 +0900
+++ udl.c	2016-11-15 02:59:21.000000000 +0900
@@ -187,8 +187,14 @@
  static inline void
  udl_cmd_add_2(struct udl_softc *sc, uint16_t val)
  {
+	uint8_t *p = sc->sc_cmd_buf;
- be16enc(sc->sc_cmd_buf, val);
+	if (ALIGNED_POINTER(p, uint16_t))
+		be16enc(p, val);
+	else {
+		*p++ = (val >> 8) & 0xff;
+		*p = val & 0xff;
+	}
  	sc->sc_cmd_buf += 2;
  }
@@ -203,8 +209,16 @@
  static inline void
  udl_cmd_add_4(struct udl_softc *sc, uint32_t val)
  {
+	uint8_t *p = sc->sc_cmd_buf;
- be32enc(sc->sc_cmd_buf, val);
+	if (ALIGNED_POINTER(p, uint32_t))
+		be32enc(p, val);
+	else {
+		*p++ = (val >> 24) & 0xff;
+		*p++ = (val >> 16) & 0xff;
+		*p++ = (val >> 8) & 0xff;
+		*p = val & 0xff;
+	}
  	sc->sc_cmd_buf += 4;
  }
-mochid


Nick


Home | Main Index | Thread Index | Old Index