summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* Regen (FWIW)peter2004-02-214-5/+5
|
* Try and make the compat sigreturn prototypes closer to reality.peter2004-02-211-1/+1
|
* Add a note about the landmine in the middle of struct ia32_sigframe.peter2004-02-211-0/+1
|
* DOH!!! Fix signals for freebsd-4.x/i386 binaries. The ucontext haspeter2004-02-211-1/+1
| | | | different alignments due to the sse fxsave dump area.
* Device megapatch 5/6:phk2004-02-211-4/+4
| | | | | | | | | | | | Remove the unused second argument from udev2dev(). Convert all remaining users of makedev() to use udev2dev(). The semantic difference is that udev2dev() will only locate a pre-existing dev_t, it will not line makedev() create a new one. Apart from the tiny well controlled windown in D_PSEUDO drivers, there should no longer be any "anonymous" dev_t's in the system now, only dev_t's created with make_dev() and make_dev_alias()
* Add BSD compatibility tty ioctls LINUX_TIOCSBRK and LINUX_TIOCCBRK. Thisbms2004-02-192-0/+13
| | | | | | | addition appears to allow VMware 3 Workstation to operate with nmdm(4) as a virtual COM device. Tested by: Guido van Rooij
* Add vector for memmove() (currently aliased to memcpy()) a implementwpaul2004-02-171-0/+20
| | | | ExInterlockedAddLargeStatistic().
* More cleanups/fixes for the AMD Am1771 driver:wpaul2004-02-163-22/+80
| | | | | | | | | | | | | | | | | | | | | - When adding new waiting threads to the waitlist for an object, use INSERT_LIST_TAIL() instead of INSERT_LIST_HEAD() so that new waiters go at the end of the list instead of the beginning. When we wake up a synchronization object, only the first waiter is awakened, and this needs to be the first thread that actually waited on the object. - Correct missing semicolon in INSERT_LIST_TAIL() macro. - Implement lookaside lists correctly. Note that the Am1771 driver uses lookaside lists to manage shared memory (i.e. DMAable) buffers by specifying its own alloc and free routines. The Microsoft documentation says you should avoid doing this, but apparently this did not deter the developers at AMD from doing it anyway. With these changes (which are the result of two straight days of almost non-stop debugging), I think I finally have the object/thread handling semantics implemented correctly. The Am1771 driver no longer crashes unexpectedly during association or bringing the interface up.
* Fix a problem with the way we schedule work on the NDIS worker threads.wpaul2004-02-142-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Am1771 driver will sometimes do the following: - Some thread-> NdisScheduleWorkItem(some work) - Worker thread -> do some work, KeWaitForSingleObject(some event) - Some other thread -> NdisScheduleWorkItem(some other work) When the second call to NdisScheduleWorkItem() occurs, the NDIS worker thread (in our case ndis taskqueue) is suspended in KeWaitForSingleObject() and waiting for an event to be signaled. This is different from when the worker thread is idle and waiting on NdisScheduleWorkItem() to send it more jobs. However, the ndis_sched() function in kern_ndis.c always calls kthread_resume() when queueing a new job. Normally this would be ok, but here this causes KeWaitForSingleObject() to return prematurely, which is not what we want. To fix this, the NDIS threads created by kern_ndis.c maintain a state variable to indicate whether they are running (scanning the job list and executing jobs) or sleeping (blocked on kthread_suspend() in ndis_runq()), and ndis_sched() will only call kthread_resume() if the thread is in the sleeping state. Note that we can't just check to see if the thread is on the run queue: in both cases, the thread is sleeping, but it's sleeping for different reasons. This stops the Am1771 driver from emitting various "NDIS ERROR" messages and fixes some cases where it crashes.
* Correct instance of *timeout that should have been timeout.wpaul2004-02-111-1/+1
| | | | Noticed by: mlaier
* Add yet more bulletproofing. This is to guard against the case thatwpaul2004-02-111-31/+52
| | | | | ndis_init_nic() works one during attach, but fails later. Many things will blow up if ndis_init_nic() fails and we aren't careful.
* Add some bulletproofing: don't allow the ndis_get_info() or ndis_set_info()wpaul2004-02-101-0/+7
| | | | | | | | | | routines to do anything except return error if the miniport adapter context is not set (meaning we either having init'ed the driver yet, or the initialization failed). Also, be sure to NULL out the adapter context along with the miniport characteristics pointers if calling the MiniportInitialize() method fails.
* Remove VFS_STATFS() call which violated the lock order and wasn'tdes2004-02-091-4/+0
| | | | | | | really required anyway. PR: kern/61994 Submitted by: Bjoern Groenvall <bg@sics.se>
* Add stub implementations of KfLowerIrql() and KfRaiseIrql() (both ofwpaul2004-02-091-16/+40
| | | | which are _fastcall).
* Make NdisMMapIoSpace() guard against NULL/uninitialized resource pointers too.wpaul2004-02-081-2/+4
|
* Make NdisMMapIoSpace() handle the case where a device has both memwpaul2004-02-081-3/+5
| | | | and altmem ranges mapped.
* Argh. kthread_suspend() when in P_KTHREAD context, tsleep() when not,wpaul2004-02-071-2/+2
| | | | not the other way around.
* Correct an intance of mtx_pool_lock() that should have been mtx_pool_unlock().wpaul2004-02-071-1/+1
|
* I guess nobody has needed to use the SVR4olator to create devicephk2004-02-071-2/+2
| | | | | | | nodes, or if they did, they're now locked away on the Kurt Gdel memorial home for the numerically confused: Don't cast a kernel pointer (from makedev(9)) to an integer (maj+minor combo).
* Add a whole bunch of new stuff to make the driver for the AMD Am1771/Am1772wpaul2004-02-076-101/+1212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 802.11b chipset work. This chip is present on the SMC2602W version 3 NIC, which is what was used for testing. This driver creates kernel threads (12 of them!) for various purposes, and required the following routines: PsCreateSystemThread() PsTerminateSystemThread() KeInitializeEvent() KeSetEvent() KeResetEvent() KeInitializeMutex() KeReleaseMutex() KeWaitForSingleObject() KeWaitForMultipleObjects() IoGetDeviceProperty() and several more. Also, this driver abuses the fact that NDIS events and timers are actually Windows events and timers, and uses NDIS events with KeWaitForSingleObject(). The NDIS event routines have been rewritten to interface with the ntoskrnl module. Many routines with incorrect prototypes have been cleaned up. Also, this driver puts jobs on the NDIS taskqueue (via NdisScheduleWorkItem()) which block on events, and this interferes with the operation of NdisMAllocateSharedMemoryAsync(), which was also being put on the NDIS taskqueue. To avoid the deadlock, NdisMAllocateSharedMemoryAsync() is now performed in the NDIS SWI thread instead. There's still room for some cleanups here, and I really should implement KeInitializeTimer() and friends.
* Regen.jhb2004-02-064-33/+33
|
* Sync up MP safe flags with global syscalls.master. This includes read(),jhb2004-02-061-29/+29
| | | | | | | | | write(), close(), getpid(), setuid(), getuid(), svr4_sys_pause(), svr4_sys_nice(), svr4_sys_kill(), svr4_sys_pgrpsys(), dup(), pipe(), setgid(), getgid(), svr4_sys_signal(), umask(), getgroups(), setgroups(), svr4_sys_sigprocmask(), svr4_sys_sigsuspend(), svr4_sys_sigaltstack(), svr4_sys_sigaction(), svr4_sys_sigpending(), mprotect(), munmap(), setegid(), seteuid(), setreuid(), setregid().
* Regen.jhb2004-02-044-9/+9
|
* The following compat syscalls are now mpsafe: linux_getrlimit(),jhb2004-02-041-5/+5
| | | | | | | linux_setrlimit(), linux_old_getrlimit(), osf1_getrlimit(), osf1_setrlimit(), svr4_sys_ulimit(), svr4_sys_setrlimit(), svr4_sys_getrlimit(), svr4_sys_setrlimit64(), svr4_sys_getrlimit64(), ibcs2_sysconf(), and ibcs2_ulimit().
* Locking for the per-process resource limits structure.jhb2004-02-046-119/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64
* Correct/improve the implementation of NdisMAllocateSharedMemoryAsync().wpaul2004-02-041-13/+50
| | | | | | | | | | | Since we have a worker thread now, we can actually do the allocation asynchronously in that thread's context. Also, we need to return a status value: if we're unable to queue up the async allocation, we return NDIS_STATUS_FAILURE, otherwise we return NDIS_STATUS_PENDING to indicate the allocation has been queued and will occur later. This replaces the kludge where we just invoked the callback routine right away in the current context.
* Implement support for single packet sends. The Intel Centrino driverwpaul2004-02-032-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | that Asus provides on its CDs has both a MiniportSend() routine and a MiniportSendPackets() function. The Microsoft NDIS docs say that if a driver has both, only the MiniportSendPackets() routine will be used. Although I think I implemented the support correctly, calling the MiniportSend() routine seems to result in no packets going out on the air, even though no error status is returned. The MiniportSendPackets() function does work though, so at least in this case it doesn't matter. In if_ndis.c:ndis_getstate_80211(), if ndis_get_assoc() returns an error, don't bother trying to obtain any other state since the calls may fail, or worse cause the underlying driver to crash. (The above two changes make the Asus-supplied Centrino work.) Also, when calling the OID_802_11_CONFIGURATION OID, remember to initialize the structure lengths correctly. In subr_ndis.c:ndis_open_file(), set the current working directory to rootvnode if we're in a thread that doesn't have a current working directory set.
* Regen.deischen2004-02-034-5/+7
|
* Sync with kern/syscalls.master.deischen2004-02-031-0/+1
|
* Regenpeter2004-01-285-7/+40
|
* Add getitimer swab stubpeter2004-01-281-2/+2
|
* Implement NdisVirtualBufferAddress() and NdisVirtualBufferAddressSafe().wpaul2004-01-271-0/+21
| | | | The RealTek 8180 driver seems to need this.
* Reorganize the timer code a little and implement NdisInitializeTimer()wpaul2004-01-263-17/+96
| | | | | | | | | | | and NdisCancelTimer(). NdisInitializeTimer() doesn't accept an NDIS miniport context argument, so we have to derive it from the timer function context (which is supposed to be the adapter private context). NdisCancelTimer is now an alias for NdisMCancelTimer(). Also add stubs for NdisMRegisterDevice() and NdisMDeregisterDevice(). These are no-ops for now, but will likely get fleshed in once I start working on the Am1771/Am1772 wireless driver.
* Avoid possible panic on shutdown: if there are still some deviceswpaul2004-01-261-1/+20
| | | | | | attached when shutting down, kill our kthreads, but don't destroy the mutex pool and uma zone resources since the driver shutdown routine may need them later.
* Add structures and definitions for task offload (TCP/IP checksum,wpaul2004-01-211-0/+141
| | | | IPSec, TCP large send).
* Make sure to trap failures correctly in ndis_get_info() and ndis_set_info().wpaul2004-01-211-0/+6
|
* Reduce gratuitous includes: don't include jail.h if it's not needed.rwatson2004-01-211-1/+0
| | | | | | | Presumably, at some point, you had to include jail.h if you included proc.h, but that is no longer required. Result of: self injury involving adding something to struct prison
* Add WDM major/minor #defines.wpaul2004-01-191-0/+7
|
* Implement IofCompleteRequest() and IoIsWdmVersionAvailable().wpaul2004-01-191-3/+32
| | | | | Correct IofCallDriver(): it's fastcall, not stdcall. Add vector to vsprintf().
* Implement atoi() and atol(). Some drivers appear to need these. Notewpaul2004-01-191-0/+18
| | | | that like most C library routines, these appear to be _cdecl in Windows.
* Eliminate some code duplication: since ndis_runq() and ndis_intq() werewpaul2004-01-191-78/+47
| | | | | basically the same function, compact them into a single loop which can be used for both threads.
* Convert from using taskqueue_swi to using private kernel threads. Thewpaul2004-01-183-16/+347
| | | | | | | | | | problem with using taskqueue_swi is that some of the things we defer into threads might block for up to several seconds. This is an unfriendly thing to do to taskqueue_swi, since it is assumed the taskqueue threads will execute fairly quickly once a task is submitted. Reorganized the locking in if_ndis.c in the process. Cleaned up ndis_write_cfg() and ndis_decode_parm() a little.
* The ndis_kspin_lock type is called KSPIN_LOCK in MS-Windows.obrien2004-01-162-2/+23
| | | | | | | | | | | | | | | | | | | | According to the Windows DDK header files, KSPIN_LOCK is defined like this: typedef ULONG_PTR KSPIN_LOCK; From basetsd.h (SDK, Feb. 2003): typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; The keyword __int3264 specifies an integral type that has the following properties: + It is 32-bit on 32-bit platforms + It is 64-bit on 64-bit platforms + It is 32-bit on the wire for backward compatibility. It gets truncated on the sending side and extended appropriately (signed or unsigned) on the receiving side. Thus register_t seems the proper mapping onto FreeBSD for spin locks.
* The definition for __stdcall logically belongs in pe_var.h, butwpaul2004-01-153-4/+9
| | | | | | | | the definitions for NDIS_BUS_SPACE_IO and NDIS_BUS_SPACE_MEM logically belong in hal_var.h. At least, that's my story, and I'm sticking to it. Also, remove definition of __stdcall from if_ndis.c now that it's pulled in from pe_var.h.
* Create NDIS_BUS_SPACE_{IO,MEM} to abstract MD BUS_SPACE macros.obrien2004-01-153-20/+24
| | | | Provide appropriate definitions for i386 and AMD64.
* Implement NdisCopyFromPacketToPacket() and NdisCopyFromPacketToPacketSafe().wpaul2004-01-151-0/+110
| | | | | I only have one driver that references this routine (for the 3Com 3cR990) and it never gets called, but just in case, here it is.
* VOP_GETATTR() wants the vnode passed to it to be locked. Insteadtruckman2004-01-141-13/+1
| | | | | | | | of adding the code to lock and unlock the vnodes and taking care to avoid deadlock, simplify linux_emul_convpath() by comparing the vnode pointers directly instead of comparing their va_fsid and va_fileid attributes. This allows the removal of the calls to VOP_GETATTR().
* mp_ncpus is always defined now, so no need to do an #ifdef SMP inwpaul2004-01-141-5/+1
| | | | ndis_cpu_cnt().
* AMD64 has a single MS-Win calling convention, so provide an empty __stdcall.obrien2004-01-136-14/+14
| | | | Centralize the definition to make it easier to change.
* Use 'vm_offset_t' rather than 'u_int32_t'.obrien2004-01-131-2/+2
| | | | | Tested on: AMD64 Reviewed by: wpaul
OpenPOWER on IntegriCloud