summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* I missed two pieces of the commit to this file. Robert has alreadydwmalone2004-07-181-1/+1
| | | | added one, this adds the other.
* Remove 'sg' argument to linux_sendto_hdrincl, which is what I think wasrwatson2004-07-181-1/+1
| | | | intended. This fixes the build, but might require revision.
* Add a kern_setsockopt and kern_getsockopt which can read the optiondwmalone2004-07-171-65/+19
| | | | | | values from either user land or from the kernel. Use them for [gs]etsockopt and to clean up some calls to [gs]etsockopt in the Linux emulation code that uses the stackgap.
* /usr/libexec/ld-elf.so.1 -> /libexec/ld-elf32.so.1obrien2004-07-161-1/+1
|
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-0/+1
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* Regenpeter2004-07-144-9/+4
|
* Unmapped syscalls should be NOPROTO so that we don't get a duplicatepeter2004-07-141-1/+1
| | | | prototype. (kldunloadf in this case)
* Give kldunload a -f(orce) argument.phk2004-07-134-5/+13
| | | | | | | | | | | | | | | | | Add a MOD_QUIESCE event for modules. This should return error (EBUSY) of the module is in use. MOD_UNLOAD should now only fail if it is impossible (as opposed to inconvenient) to unload the module. Valid reasons are memory references into the module which cannot be tracked down and eliminated. When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is not given, MOD_QUIESCE failing will also prevent the unload. For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as success. Document that modules should return EOPNOTSUPP for unknown events.
* Add kldunloadf() system call. Stay tuned for follwing commit messages.phk2004-07-131-2/+3
|
* Make NdisReadPcmciaAttributeMemory() and NdisWritePcmciaAttributeMemory()wpaul2004-07-113-9/+16
| | | | | | | | | | | | | | | | | | | | | | | actually work. Make the PCI and PCCARD attachments provide a bus_get_resource_list() method so that resource listing for PCCARD works. PCCARD does not have a bus_get_resource_list() method (yet), so I faked up the resource list management in if_ndis_pccard.c, and added bus_get_resource_list() methods to both if_ndis_pccard.c and if_ndis_pci.c. The one in the PCI attechment just hands off to the PCI bus code. The difference is transparent to the NDIS resource handler code. Fixed ndis_open_file() so that opening files which live on NFS filesystems work: pass an actual ucred structure to VOP_GETATTR() (NFS explodes if the ucred structure is NOCRED). Make NdisMMapIoSpace() handle mapping of PCMCIA attribute memory resources correctly. Turn subr_ndis.c:my_strcasecmp() into ndis_strcasecmp() and export it so that if_ndis_pccard.c can use it, and junk the other copy of my_strcasecmp() from if_ndis_pccard.c.
* Update for the KDB framework:marcel2004-07-101-2/+3
| | | | | | o Call kdb_enter() instead of Debugger(). While here, remove a redundant return.
* Clean up and wash struct iovec and struct uio handling.phk2004-07-102-52/+19
| | | | | | | | | | | | Add copyiniov() which copies a struct iovec array in from userland into a malloc'ed struct iovec. Caller frees. Change uiofromiov() to malloc the uio (caller frees) and name it copyinuio() which is more appropriate. Add cloneuio() which returns a malloc'ed copy. Caller frees. Use them throughout.
* Use a couple of regular kernel entry points, rather than COMPAT_43phk2004-07-081-4/+12
| | | | entry points.
* Fix two problems:wpaul2004-07-072-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In subr_ndis.c:ndis_allocate_sharemem(), create the busdma tags used for shared memory allocations with a lowaddr of 0x3E7FFFFF. This forces the buffers to be mapped to physical/bus addresses within the first 1GB of physical memory. It seems that at least one card (Linksys Instant Wireless PCI V2.7) depends on this behavior. I don't know if this is a hardware restriction, or if the NDIS driver for this card is truncating the addresses itself, but using physical/bus addresses beyong the 1GB limit causes initialization failures. - Create am NDIS_INITIALIZED() macro in if_ndisvar.h and use it in if_ndis.c to test whether the device has been initialized rather than checking for the presence of the IFF_UP flag in if_flags. While debugging the previous problem, I noticed that bringing up the device would always produce failures from ndis_setmulti(). It turns out that the following steps now occur during device initialization: - IFF_UP flag is set in if_flags - ifp->if_ioctl() called with SIOCSIFADDR (which we don't handle) - ifp->if_ioctl() called with SIOCADDMULTI - ifp->if_ioctl() called with SIOCADDMULTI (again) - ifp->if_ioctl() called with SIOCADDMULTI (yet again) - ifp->if_ioctl() called with SIOCSIFFLAGS Setting the receive filter and multicast filters can only be done when the underlying NDIS driver has been initialized, which is done by ifp->if_init(). However, we don't call ifp->if_init() until ifp->if_ioctl() is called with SIOCSIFFLAGS and IFF_UP has been set. It appears that now, the network stack tries to add multicast addresses to interface's filter before those steps occur. Normally, ndis_setmulti() would trap this condition by checking for the IFF_UP flag, but the network code has in fact set this flag already, so ndis_setmulti() is fooled into thinking the interface has been initialized when it really hasn't. It turns out this is usually harmless because the ifp->if_init() routine (in this case ndis_init()) will set up the multicast filter when it initializes the hardware anyway, and the underlying routines (ndis_get_info()/ndis_set_info()) know that the driver/NIC haven't been initialized yet, but you end up spurious error messages on the console all the time. Something tells me this new behavior isn't really correct. I think the intention was to fix it so that ifp->if_init() is only called once when we ifconfig an interface up, but the end result seems a little bogus: the change of the IFF_UP flag should be propagated down to the driver before calling any other ioctl() that might actually require the hardware to be up and running.
* Implement SNDCTL_DSP_SETDUPLEX. This may fix sound apps which want tonetchild2004-07-022-0/+5
| | | | | | use full duplex mode. Approved by: matk
* Change the thread ID (thr_id_t) used for 1:1 threading from being amarcel2004-07-021-4/+4
| | | | | | | | | | | | | | | | | | | | pointer to the corresponding struct thread to the thread ID (lwpid_t) assigned to that thread. The primary reason for this change is that libthr now internally uses the same ID as the debugger and the kernel when referencing to a kernel thread. This allows us to implement the support for debugging without additional translations and/or mappings. To preserve the ABI, the 1:1 threading syscalls, including the umtx locking API have not been changed to work on a lwpid_t. Instead the 1:1 threading syscalls operate on long and the umtx locking API has not been changed except for the contested bit. Previously this was the least significant bit. Now it's the most significant bit. Since the contested bit should not be tested by userland, this change is not expected to be visible. Just to be sure, UMTX_CONTESTED has been removed from <sys/umtx.h>. Reviewed by: mtm@ ABI preservation tested on: i386, ia64
* Regen.marcel2004-07-024-4/+4
|
* Cast variable-sized (based on platform) quantities before printing out.obrien2004-06-241-2/+2
|
* Include <sys/mutex.h> and its prerequisite <sys/lock.h> instead ofbde2004-06-231-2/+4
| | | | | | | depending on namespace pollution in <sys/vnode.h> for the definition of GIANT_REQUIRED. Sorted includes.
* Mark linux_emul_convpath() as GIANT_REQUIRED.rwatson2004-06-221-0/+2
|
* Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES.phk2004-06-212-0/+6
|
* Add stub for Linux SOUND_MIXER_READ_RECMASK, required by some Linux soundbms2004-06-182-0/+5
| | | | | | | applications. PR: misc/27471 Submitted by: Gavin Atkinson (with cleanups)
* Add a stub for the Linux SOUND_MIXER_INFO ioctl (even though we don'tbms2004-06-182-0/+5
| | | | | | | | actually implement it), as some applications, such as RealProducer, expect to be able to use it. PR: kern/65971 Submitted by: Matt Wright
* Linux applications expect to be able to call SIOCGIFCONF with anbms2004-06-181-0/+14
| | | | | | | | | | NULL ifc.ifc_buf pointer, to determine the expected buffer size. The submitted fix only takes account of interfaces with an AF_INET address configured. This could no doubt be improved. PR: kern/45753 Submitted by: Jacques Garrigue (with cleanups)
* Fix the VT_SETMODE/CDROMIOCTOCENTRY problem correctly.bms2004-06-181-15/+17
| | | | Reviewed by: tjr
* Fix two attempts to use an unchecked NULL pointer provided from thebms2004-06-181-7/+10
| | | | | | userland, for the CDIOREADTOCENTRY and VT_SETMODE cases respectively. Noticed by: tjr
* Second half of the dev_t cleanup.phk2004-06-176-12/+12
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* Add support for more linux ioctls.phk2004-06-142-2/+117
| | | | | | | | I've had this sitting in my tree for a long time and I can't seem to find who sent it to me in the first place, apologies to whoever is missing out on a Contributed by: line here. I belive it works as it should.
* Socket MAC labels so_label and so_peerlabel are now protected byrwatson2004-06-131-0/+4
| | | | | | | | | | | | | SOCK_LOCK(so): - Hold socket lock over calls to MAC entry points reading or manipulating socket labels. - Assert socket lock in MAC entry point implementations. - When externalizing the socket label, first make a thread-local copy while holding the socket lock, then release the socket lock to externalize to userspace.
* Deorbit COMPAT_SUNOS.phk2004-06-112-2/+2
| | | | | We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither a sparc32 port nor a SunOS4.x compatibility desire these days.
* Add another 5.2.1 source compatibility tweak: acquire Giant before callingwpaul2004-06-072-0/+6
| | | | kthread_exit() if FreeBSD_version is old enough.
* Change the types of vn_rdwr_inchunks()'s len and aresid arguments totjr2004-06-051-2/+2
| | | | | | size_t and size_t *, respectively. Update callers for the new interface. This is a better fix for overflows that occurred when dumping segments larger than 2GB to core files.
* Take advantage of the dev sysctl tree.des2004-06-042-0/+20
| | | | Approved by: wpaul
* Grrr. Really check subr_ndis.c in this time. (fixed my_strcasecmp())wpaul2004-06-041-13/+19
|
* Explicitly #include <sys/module.h> instead of depending on <sys/kernel.h>wpaul2004-06-011-0/+1
| | | | to do it for us.
* Fix build with ndisulator: Add prototype for my_strcasecmp().wpaul2004-05-291-0/+1
|
* In subr_ndis.c, when searching for keys in our make-pretend registry,wpaul2004-05-291-2/+21
| | | | | | | | | | | | | | | | | | | | | make the key name matching case-insensitive. There are some drivers and .inf files that have mismatched cases, e.g. the driver will look for "AdhocBand" whereas the .inf file specifies a registry key to be created called "AdHocBand." The mismatch is probably a typo that went undetected (so much for QA), but since Windows seems to be case-insensitive, we should be too. In if_ndis.c, initialize rates and channels correctly so that specify frequences correctly when trying to set channels in the 5Ghz band, and so that 802.11b rates show up for some a/b/g cards (which otherwise appear to have no 802.11b modes). Also, when setting OID_802_11_CONFIGURATION in ndis_80211_setstate(), provide default values for the beacon interval, ATIM window and dwelltime. The Atheros "Aries" driver will crash if you try to select ad-hoc mode and leave the beacon interval set to 0: it blindly uses this value and does a division by 0 in the interrupt handler, causing an integer divide trap.
* Small timer cleanups:wpaul2004-04-301-24/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Use the dh_inserted member of the dispatch header in the Windows timer structure to indicate that the timer has been "inserted into the timer queue" (i.e. armed via timeout()). Use this as the value to return to the caller in KeCancelTimer(). Previously, I was using callout_pending(), but you can't use that with timeout()/untimeout() without creating a potential race condition. - Make ntoskrnl_init_timer() just a wrapper around ntoskrnl_init_timer_ex() (reduces some code duplication). - Drop Giant when entering if_ndis.c:ndis_tick() and subr_ntorkrnl.c:ntoskrnl_timercall(). At the moment, I'm forced to use system callwheel via timeout()/untimeout() to handle timers rather than the callout API (struct callout is too big to fit inside the Windows struct KTIMER, so I'm kind of hosed). Unfortunately, all the callouts in the callwhere are not marked as MPSAFE, so when one of them fires, it implicitly acquires Giant before invoking the callback routine (and releases it when it returns). I don't need to hold Giant, but there's no way to stop the callout code from acquiring it as long as I'm using timeout()/untimeout(), so for now we cheat by just dropping Giant right away (and re-acquiring it right before the routine returns so keep the callout code happy). At some point, I will need to solve this better, but for now this should be a suitable workaround.
* Fix build for non-COMPAT_FREEBSD4 configurations. Make the FreeBSD 4marcel2004-04-241-0/+10
| | | | statfs functions conditional upon the option.
* Ok, _really_ fix the Intel 2100B Centrino deadlock problems this time.wpaul2004-04-221-12/+27
| | | | | | | | | | | | | | | | (I hope.) My original instinct to make ndis_return_packet() asynchronous was correct. Making ndis_rxeof() submit packets to the stack asynchronously fixes one recursive spinlock acquisition, but it's also possible for it to happen via the ndis_txeof() path too. So: - In if_ndis.c, revert ndis_rxeof() to its old behavior (and don't bother putting ndis_rxeof_serial() back since we don't need it anymore). - In kern_ndis.c, make ndis_return_packet() submit the call to the MiniportReturnPacket() function to the "ndis swi" thread so that it always happens in another context no matter who calls it.
* Correct the AT_DISPATCH_LEVEL() macro to match earlier changes.wpaul2004-04-201-1/+1
|
* Try to handle recursive attempts to raise IRQL to DISPATCH_LEVEL betterwpaul2004-04-191-1/+9
| | | | (among other things).
* In ntoskrnl_unlock_dpc(), use atomic_store instead of atomic_cmpsetwpaul2004-04-181-2/+2
| | | | | | to give up the spinlock. Suggested by: bde
* - Use memory barrier with atomic operations in ntoskrnl_lock_dpc() andwpaul2004-04-165-56/+21
| | | | | | | | | | | | | | ntoskrnl_unlocl_dpc(). - hal_raise_irql(), hal_lower_irql() and hal_irql() didn't work right on SMP (priority inheritance makes things... interesting). For now, use only two states: DISPATCH_LEVEL (PI_REALTIME) and PASSIVE_LEVEL (everything else). Tested on a dual PIII box. - Use ndis_thsuspend() in ndis_sleep() instead of tsleep(). (I added ndis_thsuspend() and ndis_thresume() to replace kthread_suspend() and kthread_resume(); the former will preserve a thread's priority when it wakes up, the latter will not.) - Change use of tsleep() in ndis_stop_thread() to prevent priority change on wakeup.
* Check in structure definitions for the FreeBSD-3.x signal syscall stuff.peter2004-04-141-0/+43
| | | | Nothing uses these yet, but I dont want to lose them.
* Regenpeter2004-04-144-40/+49
|
* Catch up to the not-so-recent statfs(2) changes.peter2004-04-143-18/+49
|
* Continue my efforts to imitate Windows as closely as possible bywpaul2004-04-148-156/+421
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attempting to duplicate Windows spinlocks. Windows spinlocks differ from FreeBSD spinlocks in the way they block preemption. FreeBSD spinlocks use critical_enter(), which masks off _all_ interrupts. This prevents any other threads from being scheduled, but it also prevents ISRs from running. In Windows, preemption is achieved by raising the processor IRQL to DISPATCH_LEVEL, which prevents other threads from preempting you, but does _not_ prevent device ISRs from running. (This is essentially what Solaris calls dispatcher locks.) The Windows spinlock itself (kspin_lock) is just an integer value which is atomically set when you acquire the lock and atomically cleared when you release it. FreeBSD doesn't have IRQ levels, so we have to cheat a little by using thread priorities: normal thread priority is PASSIVE_LEVEL, lowest interrupt thread priority is DISPATCH_LEVEL, highest thread priority is DEVICE_LEVEL (PI_REALTIME) and critical_enter() is HIGH_LEVEL. In practice, only PASSIVE_LEVEL and DISPATCH_LEVEL matter to us. The immediate benefit of all this is that I no longer have to rely on a mutex pool. Now, I'm sure many people will be seized by the urge to criticize me for doing an end run around our own spinlock implementation, but it makes more sense to do it this way. Well, it does to me anyway. Overview of the changes: - Properly implement hal_lock(), hal_unlock(), hal_irql(), hal_raise_irql() and hal_lower_irql() so that they more closely resemble their Windows counterparts. The IRQL is determined by thread priority. - Make ntoskrnl_lock_dpc() and ntoskrnl_unlock_dpc() do what they do in Windows, which is to atomically set/clear the lock value. These routines are designed to be called from DISPATCH_LEVEL, and are actually half of the work involved in acquiring/releasing spinlocks. - Add FASTCALL1(), FASTCALL2() and FASTCALL3() macros/wrappers that allow us to call a _fastcall function in spite of the fact that our version of gcc doesn't support __attribute__((__fastcall__)) yet. The macros take 1, 2 or 3 arguments, respectively. We need to call hal_lock(), hal_unlock() etc... ourselves, but can't really invoke the function directly. I could have just made the underlying functions native routines and put _fastcall wrappers around them for the benefit of Windows binaries, but that would create needless bloat. - Remove ndis_mtxpool and all references to it. We don't need it anymore. - Re-implement the NdisSpinLock routines so that they use hal_lock() and friends like they do in Windows. - Use the new spinlock methods for handling lookaside lists and linked list updates in place of the mutex locks that were there before. - Remove mutex locking from ndis_isr() and ndis_intrhand() since they're already called with ndis_intrmtx held in if_ndis.c. - Put ndis_destroy_lock() code under explicit #ifdef notdef/#endif. It turns out there are some drivers which stupidly free the memory in which their spinlocks reside before calling ndis_destroy_lock() on them (touch-after-free bug). The ADMtek wireless driver is guilty of this faux pas. (Why this doesn't clobber Windows I have no idea.) - Make NdisDprAcquireSpinLock() and NdisDprReleaseSpinLock() into real functions instead of aliasing them to NdisAcaquireSpinLock() and NdisReleaseSpinLock(). The Dpr routines use KeAcquireSpinLockAtDpcLevel() level and KeReleaseSpinLockFromDpcLevel(), which acquires the lock without twiddling the IRQL. - In ndis_linksts_done(), do _not_ call ndis_80211_getstate(). Some drivers may call the status/status done callbacks as the result of setting an OID: ndis_80211_getstate() gets OIDs, which means we might cause the driver to recursively access some of its internal structures unexpectedly. The ndis_ticktask() routine will call ndis_80211_getstate() for us eventually anyway. - Fix the channel setting code a little in ndis_80211_setstate(), and initialize the channel to IEEE80211_CHAN_ANYC. (The Microsoft spec says you're not supposed to twiddle the channel in BSS mode; I may need to enforce this later.) This fixes the problems I was having with the ADMtek adm8211 driver: we were setting the channel to a non-standard default, which would cause it to fail to associate in BSS mode. - Use hal_raise_irql() to raise our IRQL to DISPATCH_LEVEL when calling certain miniport routines, per the Microsoft documentation. I think that's everything. Hopefully, other than fixing the ADMtek driver, there should be no apparent change in behavior.
* In ndis_convert_res(), initialize the head of our temporary listwpaul2004-04-071-1/+2
| | | | | | | before calling BUS_GET_RESOURCE_LIST(). Previously, the list head would only be initialized if BUS_GET_RESOURCE_LIST() succeeded; it needs to be initialized unconditionally so that the list cleanup code won't trip over potential stack garbage.
OpenPOWER on IntegriCloud