tech-kern archive

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

Re: Patching wscons_keydesc at runtime



Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:

> > Unfortunately this breaks hpcsh which initializes console very early
> > when malloc is not available, so when you boot with wscons the machine
> > wedges.
> > 
> > I think your change should be reverted for now and a different fix
> > developed.
> 
> Or perhaps it could be just ifdef hpcarm?

What about this change?

Index: sys/dev/hpc/hpckbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/hpc/hpckbd.c,v
retrieving revision 1.31
diff -U4 -r1.31 hpckbd.c
--- sys/dev/hpc/hpckbd.c        12 Jun 2017 09:23:39 -0000      1.31
+++ sys/dev/hpc/hpckbd.c        3 Aug 2017 23:36:47 -0000
@@ -265,15 +265,17 @@
                    const keysym_t *map, int mapsize)
 {
        int i;
        const struct wscons_keydesc *desc;
+#ifdef hpcarm
        static struct wscons_keydesc *ndesc = NULL;
 
        /* 
         * fix keydesc table. Since it is const data, we must 
-        * copy it once before changingg it.
+        * copy it once before changingg it. That does not work
+        * on hpcsh which initialize console before malloc is 
+        * available.
         */
-
        if (ndesc == NULL) {
                size_t sz;
 
                for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++);
@@ -282,14 +284,15 @@
                memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc));
 
                hpckbd_keymapdata.keydesc = ndesc;
        }
+#endif /* hpcarm */
 
        desc = hpckbd_keymapdata.keydesc;
        for (i = 0; desc[i].name != 0; i++) {
                if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
-                       ndesc[i].map = map;
-                       ndesc[i].map_size = mapsize;
+                       desc[i].map = map;
+                       desc[i].map_size = mapsize;
                }
        }
 
        return;



-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index