Author: nwhitehorn
Date: Tue Jun 15 22:01:38 2010
New Revision: 209222
URL: http://svn.freebsd.org/changeset/base/209222

Log:
  Modify the console mouse pointer drawing routine to use single-byte writes
  instead of 4-byte ones. Because the mouse pointer can start part way
  through a character cell, 4-byte memory operations are not necessarily
  aligned, triggering a fatal alignment exception when the console pointer
  was moved on PowerPC G5 systems.
  
  MFC after:    3 days

Modified:
  head/sys/powerpc/ofw/ofw_syscons.c

Modified: head/sys/powerpc/ofw/ofw_syscons.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_syscons.c  Tue Jun 15 21:58:40 2010        
(r209221)
+++ head/sys/powerpc/ofw/ofw_syscons.c  Tue Jun 15 22:01:38 2010        
(r209222)
@@ -856,16 +856,11 @@ ofwfb_putm8(video_adapter_t *adp, int x,
 {
        struct ofwfb_softc *sc;
        int i, j, k;
-       uint32_t *addr;
+       uint8_t *addr;
        u_char fg, bg;
-       union {
-               uint32_t l[2];
-               uint8_t  c[8];
-       } ch;
-
 
        sc = (struct ofwfb_softc *)adp;
-       addr = (u_int32_t *)((int)sc->sc_addr
+       addr = (u_int8_t *)((int)sc->sc_addr
                + (y + sc->sc_ymargin)*sc->sc_stride
                + x + sc->sc_xmargin);
 
@@ -874,12 +869,6 @@ ofwfb_putm8(video_adapter_t *adp, int x,
 
        for (i = 0; i < size && i+y < sc->sc_height - 2*sc->sc_ymargin; i++) {
                /*
-                * Use the current values for the line
-                */
-               ch.l[0] = addr[0];
-               ch.l[1] = addr[1];
-
-               /*
                 * Calculate 2 x 4-chars at a time, and then
                 * write these out.
                 */
@@ -888,12 +877,10 @@ ofwfb_putm8(video_adapter_t *adp, int x,
                                continue;
 
                        if (pixel_image[i] & (1 << k))
-                               ch.c[j] = (ch.c[j] == fg) ? bg : fg;
+                               addr[j] = (addr[j] == fg) ? bg : fg;
                }
 
-               addr[0] = ch.l[0];
-               addr[1] = ch.l[1];
-               addr += (sc->sc_stride / sizeof(u_int32_t));
+               addr += (sc->sc_stride / sizeof(u_int8_t));
        }
 
        return (0);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to