NetBSD-Bugs archive

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

kern/46407: iavc driver and i4b parts does not compile an amd64 - 64-bit-Problem



>Number:         46407
>Category:       kern
>Synopsis:       iavc driver and i4b parts does not compile an amd64 - 
>64-bit-Problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 04 08:30:01 +0000 2012
>Originator:     Wolfgang.Stukenbrock%nagler-company.com@localhost
>Release:        NetBSD 5.1.2
>Organization:
Dr. Nagler & Company GmbH
>Environment:
        
        
System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #0: Tue Aug 17 17:28:09 CEST 
2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
        Some 32/64 bit integer/pointer problems in the source of
        i4b and the iavc driver are the reason.
        Theese are easy to fix and get it compiling again - see below.
        It should run on machines with less than 4GB memory.
        (Still not fully tested - sorry. The system comes up and the card
        gets initialized.)

        Accedently the capi-interface uses only 32-Bit values as data pointers.
        So the driver has to enshure that the pointer will fit.
        I've added a KASSERT() that will check at least the pointer (not the
        length ...) for now.

        During sending data to the interface the routine cap_data_b3_req()
        from netisdn/i4b_capi_msgs.c is called by capi_start_tx() from
        netisdn/i4b_capi_l4if.c. There is a loop over all queued mbuf's.
        This seems to be the output interface of the driver and I do not
        know where theese mbufs are allocated and if it is garantied that
        the memory is in the lower 32-bit region.
        If not the contents must be copied to some fresh allocated buffers
        in the correct region and used instead of the orignal ones.

        If the maintainer of the iavc driver or the i4b-stuff can have a look
        at this, it would be nice.
        Thanks in advance.

>How-To-Repeat:
        Try to compile the iavc (and isic) drivers on amd64. It will not work.
>Fix:
        The following patches will get it compiling again.

===================================================================
--- netisdn/i4b_capi.h  2012/05/02 14:47:44     1.1
+++ netisdn/i4b_capi.h  2012/05/02 14:47:59
@@ -119,7 +119,7 @@
 #define I4BCAPI_APPLID 1
 
 extern int capi_ll_attach(capi_softc_t *, const char *, const char *);
-extern int capi_ll_control(capi_softc_t *, int op, int arg);
+extern int capi_ll_control(capi_softc_t *, int op, intptr_t arg);
 extern int capi_ll_detach(capi_softc_t *);
 
 #define CAPI_CTRL_READY     0 /* ctrl ready, value=TRUE/FALSE */
===================================================================
--- netisdn/i4b_capi_llif.c     2012/05/02 15:13:49     1.1
+++ netisdn/i4b_capi_llif.c     2012/05/02 15:14:02
@@ -57,7 +57,7 @@
 */
 
 int
-capi_ll_control(capi_softc_t *sc, int op, int arg)
+capi_ll_control(capi_softc_t *sc, int op, intptr_t arg)
 {
     switch (op) {
     case CAPI_CTRL_READY:
===================================================================
--- netisdn/i4b_capi_msgs.c     2012/05/02 15:17:32     1.1
+++ netisdn/i4b_capi_msgs.c     2012/05/02 15:33:34
@@ -726,7 +726,8 @@
     msg = capimsg_setu16(msg, msgid);
 
     msg = capimsg_setu32(msg, sc->sc_bchan[chan].ncci);
-    msg = capimsg_setu32(msg, (u_int32_t) m_b3->m_data); /* Pointer */
+    KASSERT((((uintptr_t)m_b3->m_data) & ~(uintptr_t)0xffffffff) == 0);
+    msg = capimsg_setu32(msg, (u_int32_t) ((uintptr_t)m_b3->m_data)); /* 
Pointer */
     msg = capimsg_setu16(msg, m_b3->m_len);
     msg = capimsg_setu16(msg, chan);
     msg = capimsg_setu16(msg, 0); /* Flags */
===================================================================
--- dev/ic/iavc.c      2010/05/12 09:44:32     1.2
+++ dev/ic/iavc.c      2012/05/02 14:47:00
@@ -621,7 +621,7 @@
                cardtype, serial, nbch, vers, prot);
        aprint_verbose_dev(&sc->sc_dev, "%s\n", caps);
 
-        capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile);
+        capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (intptr_t) profile);
 
     } else {
        printf("%s: no profile data in info response?\n", 
device_xname(&sc->sc_dev));


>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index