I have made a patch to make dnet under 64bit kernel.

I made and tested a 64bit dnet driver from original dnet.c,
but it caused to panic the system. I found a problem in
function dnethack().

I show the problem part of the original code below.
I think ddi_regs_map_setup() will corrupt the stack
because io_reg is defined as uint32_t. Under 64bit kernel,
io_regs must be a 64bit valiable, I think.


static int
dnethack(dev_info_t *devinfo)
{
        uchar_t         vendor_info[SROM_SIZE];
        uint32_t        csr;
        uint16_t        deviceid;
        ddi_acc_handle_t handle;
        uint32_t        retval;
        int             secondary;
        ddi_acc_handle_t io_handle;
        uint32_t        io_reg;   <==== bug
#define DNET_PCI_RNUMBER        1

          ................

        /* Now map I/O register */
        if (ddi_regs_map_setup(devinfo, DNET_PCI_RNUMBER,
            (caddr_t *)&io_reg, (offset_t)0, (offset_t)0, &accattr,
            &io_handle) != DDI_SUCCESS) {
                return (DDI_PROBE_FAILURE);
          }



I fixed io_reg as uintptr_t. The patch is:

% diff -c dnet.c dnet.c.org
*** dnet.c      Wed Jun 27 22:09:38 2007
--- dnet.c.org  Wed Jun 27 21:47:55 2007
***************
*** 480,486 ****
        uint32_t        retval;
        int             secondary;
        ddi_acc_handle_t io_handle;
!       uintptr_t       io_reg;

  #define       DNET_PCI_RNUMBER        1

--- 480,486 ----
        uint32_t        retval;
        int             secondary;
        ddi_acc_handle_t io_handle;
!       uint32_t        io_reg;

  #define       DNET_PCI_RNUMBER        1


Then, new 64bit dnet worked fine. Please put back
the fix into opensolaris.

-masa
 
 
This message posted from opensolaris.org

Reply via email to