summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/ndis/kern_windrv.c11
-rw-r--r--sys/compat/ndis/subr_hal.c6
-rw-r--r--sys/dev/if_ndis/if_ndis_pccard.c3
3 files changed, 16 insertions, 4 deletions
diff --git a/sys/compat/ndis/kern_windrv.c b/sys/compat/ndis/kern_windrv.c
index 11a5824..afaf638 100644
--- a/sys/compat/ndis/kern_windrv.c
+++ b/sys/compat/ndis/kern_windrv.c
@@ -307,6 +307,8 @@ windrv_unload(mod, img, len)
return(0);
}
+#define WINDRV_LOADED htonl(0x42534F44)
+
/*
* Loader routine for actual Windows driver modules, ultimately
* calls the driver's DriverEntry() routine.
@@ -327,12 +329,17 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
struct drvdb_ent *new;
struct driver_object *drv;
int status;
+ uint32_t *ptr;
/*
* First step: try to relocate and dynalink the executable
* driver image.
*/
+ ptr = (uint32_t *)(img + 8);
+ if (*ptr == WINDRV_LOADED)
+ goto skipreloc;
+
/* Perform text relocation */
if (pe_relocate(img))
return(ENOEXEC);
@@ -357,6 +364,10 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
return(ENOEXEC);
}
+ *ptr = WINDRV_LOADED;
+
+skipreloc:
+
/* Next step: find the driver entry point. */
pe_get_optional_header(img, &opt_hdr);
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c
index 96ecd37..c6508ed 100644
--- a/sys/compat/ndis/subr_hal.c
+++ b/sys/compat/ndis/subr_hal.c
@@ -394,9 +394,9 @@ image_patch_table hal_functbl[] = {
IMPORT_SFUNC(READ_PORT_ULONG, 1),
IMPORT_SFUNC(READ_PORT_USHORT, 1),
IMPORT_SFUNC(READ_PORT_UCHAR, 1),
- IMPORT_SFUNC(READ_PORT_BUFFER_ULONG, 2),
- IMPORT_SFUNC(READ_PORT_BUFFER_USHORT, 2),
- IMPORT_SFUNC(READ_PORT_BUFFER_UCHAR, 2),
+ IMPORT_SFUNC(READ_PORT_BUFFER_ULONG, 3),
+ IMPORT_SFUNC(READ_PORT_BUFFER_USHORT, 3),
+ IMPORT_SFUNC(READ_PORT_BUFFER_UCHAR, 3),
IMPORT_FFUNC(KfAcquireSpinLock, 1),
IMPORT_FFUNC(KfReleaseSpinLock, 1),
IMPORT_SFUNC(KeGetCurrentIrql, 0),
diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c
index c67941a..1963ff8 100644
--- a/sys/dev/if_ndis/if_ndis_pccard.c
+++ b/sys/dev/if_ndis/if_ndis_pccard.c
@@ -185,7 +185,8 @@ ndis_attach_pccard(dev)
db = windrv_match((matchfuncptr)ndis_devcompare, dev);
if (db == NULL)
return (ENXIO);
-
+ sc->ndis_dobj = db->windrv_object;
+ sc->ndis_regvals = db->windrv_regvals;
resource_list_init(&sc->ndis_rl);
sc->ndis_io_rid = 0;
OpenPOWER on IntegriCloud