1 /* $NetBSD: nbcompat.c,v 1.9 2008/01/07 19:10:58 rittera Exp $ */
4 * Implementations of some FreeBSD functions on NetBSD to make things
9 __KERNEL_RCSID(0, "$NetBSD: nbcompat.c,v 1.9 2008/01/07 19:10:58 rittera Exp $");
11 #include <sys/param.h>
12 #include <sys/systm.h>
13 #include <sys/kernel.h>
14 #include <sys/kthread.h>
17 #include <sys/unistd.h>
18 #include <sys/types.h>
19 #include <sys/errno.h>
23 #include <machine/stdarg.h>
27 /* note: this is also defined in ntoskrnl_var.h, but I didn't want to include
30 #define NDIS_KSTACK_PAGES 8
33 bus_space_handle_t res_handle
;
34 bus_space_tag_t res_tag
;
40 bus_release_resource(device_t dev
, int type
, int rid
,
41 struct ndis_resource
*r
)
45 bus_space_unmap(r
->res_tag
, r
->res_handle
, r
->res_size
);
48 bus_space_unmap(r
->res_tag
, r
->res_handle
, r
->res_size
);
51 printf("error: bus_release_resource()");
58 mtx_lock(struct mtx
*mutex
)
66 mtx_unlock(struct mtx
*mutex
)
72 device_is_attached(device_t dev
)
74 /* Sure, it's attached? */
78 /* I took this from sys/kern/kern_kthread.c (in the NetBSD source tree).
79 * The only difference is the kernel stack size
83 * Fork a kernel thread. Any process can request this to be done.
84 * The VM space and limits, etc. will be shared with proc0.
87 ndis_kthread_create(void (*func
)(void *), void *arg
,
88 struct proc
**newpp
, void *stack
, size_t stacksize
, const char *name
)
93 error
= kthread_create(PRI_NONE
, 0, NULL
, func
, arg
, &l
, "%s", name
);
94 if (__predict_false(error
!= 0))