summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-092-3/+4
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* Add missing dependencies on the SYSVIPC modules.jhb2005-07-291-0/+6
|
* Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.cjhb2005-07-291-0/+4
| | | | | so that they aren't duplicated 3 times and are also in the same file as the code that depends on the SYSVIPC modules.
* Regen.jhb2005-07-138-172/+172
|
* Make a pass through all the compat ABIs sychronizing the MP safe flagsjhb2005-07-132-164/+164
| | | | | | | with the master syscall table as well as marking several ABI wrapper functions safe. MFC after: 1 week
* Regen.jhb2005-07-134-28/+26
|
* - Stop hardcoding #define's for options and use the appropriatejhb2005-07-133-22/+7
| | | | | | | opt_foo.h headers instead. - Hook up the IPC SVR4 syscalls. MFC after: 3 days
* Wrap the ia64-specific freebsd32_mmap_partial() hack in Giant for nowjhb2005-07-131-1/+6
| | | | | | | | since it calls into VFS and VM. This makes the freebsd32_mmap() routine MP safe and the extra Giants here can be revisited later. Glanced at by: marcel MFC after: 3 days
* Add Giant around linux_getcwd_common() in linux_getcwd().jhb2005-07-091-0/+2
| | | | Approved by: re (scottl)
* Add missing locking to linux_connect() so that it can be marked MP safe:jhb2005-07-091-8/+15
| | | | | | | | | - Conditionally grab Giant around the EISCONN hack at the end based on debug.mpsafenet. - Protect access to so_emuldata via SOCK_LOCK. Reviewed by: rwatson Approved by: re (scottl)
* Use implicit type cast for ->k_lock to fix compilation of ndisrik2005-07-081-3/+3
| | | | | | | | | | | as a part of the GENERIC kernel with INVARIANT* and WITNESS* turned off. (For non GENERIC kernel KTR and MUTEX_PROFILING should be also off). Submitted by: Eygene A. Ryabinkin <rea at rea dot mbslab dot kiae dot ru> Approved by: re (scottl) PR: 81767
* Lock Giant in svr4_add_socket() so that the various svr4_*stat() callsjhb2005-07-071-0/+6
| | | | | | | can be marked MP safe as this is the only part of them that is not already MP safe. Approved by: re (scottl)
* Remove an unused syscallarg() macro leftover from this code's origins injhb2005-07-071-2/+0
| | | | | | NetBSD. Approved by: re (scottl)
* Rototill this file so that it actually compiles. It doesn't do anythingjhb2005-07-071-144/+135
| | | | | | | | | in the build still due to some #undef's in svr4.h, but if you hack around that and add some missing entries to syscalls.master, then this file will now compile. The changes involved proc -> thread, using FreeBSD syscall names instead of NetBSD, and axeing syscallarg() and retval arguments. Approved by: re (scottl)
* Fix the computation of uptime for linux_sysinfo(). Before it was returningjhb2005-07-071-15/+3
| | | | | | the uptime in seconds mod 60 which wasn't very useful. Approved by: re (scottl)
* Regenerate.jhb2005-07-074-8/+24
| | | | Approved by: re (scottl)
* - Add two new system calls: preadv() and pwritev() which are like readv()jhb2005-07-072-2/+37
| | | | | | | | | | | | | | | | | and writev() except that they take an additional offset argument and do not change the current file position. In SAT speak: preadv:readv::pread:read and pwritev:writev::pwrite:write. - Try to reduce code duplication some by merging most of the old kern_foov() and dofilefoo() functions into new dofilefoo() functions that are called by kern_foov() and kern_pfoov(). The non-v functions now all generate a simple uio on the stack from the passed in arguments and then call kern_foov(). For example, read() now just builds a uio and calls kern_readv() and pwrite() just builds a uio and calls kern_pwritev(). PR: kern/80362 Submitted by: Marc Olzheim marcolz at stack dot nl (1) Approved by: re (scottl) MFC after: 1 week
* Jumbo-commit to enhance 32 bit application support on 64 bit kernels.peter2005-06-301-0/+141
| | | | | | | | | | | | | | | | | | | | | | | | This is good enough to be able to run a RELENG_4 gdb binary against a RELENG_4 application, along with various other tools (eg: 4.x gcore). We use this at work. ia32_reg.[ch]: handle the 32 bit register file format, used by ptrace, procfs and core dumps. procfs_*regs.c: vary the format of proc/XXX/*regs depending on the client and target application. procfs_map.c: Don't print a 64 bit value to 32 bit consumers, or their sscanf fails. They expect an unsigned long. imgact_elf.c: produce a valid 32 bit coredump for 32 bit apps. sys_process.c: handle 32 bit consumers debugging 32 bit targets. Note that 64 bit consumers can still debug 32 bit targets. IA64 has got stubs for ia32_reg.c. Known limitations: a 5.x/6.x gdb uses get/setcontext(), which isn't implemented in the 32/64 wrapper yet. We also make a tiny patch to gdb pacify it over conflicting formats of ld-elf.so.1. Approved by: re
* - Change the commented out freebsd32_xxx() example to use kern_xxx() alongjhb2005-06-292-39/+5
| | | | | | | | | with a single copyin() + translate and translate + copyout() rather than using the stackgap. - Remove implementation of the stackgap for freebsd32 since it is no longer used for that compat ABI. Approved by: re (scottl)
* Correct the amount of data to allocate in these local copies ofjhb2005-06-241-1/+2
| | | | | | | | | exec_copyin_strings() to catch up to rev 1.266 of kern_exec.c. This fixes panics on amd64 with compat binaries since exec_free_args() was freeing more memory than these functions were allocating and the mismatch could cause memory to be freed out from under other concurrent execs. Approved by: re (scottl)
* Actually only protect mount-point if security.jail.enforce_statfs is set to 2.pjd2005-06-231-3/+0
| | | | | | | If we don't return statistics about requested file systems, system tools may not work correctly or at all. Approved by: re (scottl)
* Do not allocate memory based on not-checked argument from userland.pjd2005-06-111-6/+2
| | | | | | | | | | | It can be used to panic the kernel by giving too big value. Fix it by moving allocation and size verification into kern_getfsstat(). This even simplifies kern_getfsstat() consumers, but destroys symmetry - memory is allocated inside kern_getfsstat(), but has to be freed by the caller. Found by: FreeBSD Kernel Stress Test Suite: http://www.holm.cc/stress/ Reported by: Peter Holm <peter@holm.cc>
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-102-6/+6
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Rename sysctl security.jail.getfsstatroot_only to security.jail.enforce_statfspjd2005-06-091-2/+3
| | | | | | | | | | | | | | | and extend its functionality: value policy 0 show all mount-points without any restrictions 1 show only mount-points below jail's chroot and show only part of the mount-point's path (if jail's chroot directory is /jails/foo and mount-point is /jails/foo/usr/home only /usr/home will be shown) 2 show only mount-point where jail's chroot directory is placed. Default value is 2. Discussed with: rwatson
* Avoid code duplication in serval places by introducing universalpjd2005-06-091-22/+19
| | | | | | kern_getfsstat() function. Obtained from: jhb
* Properly convert FreeBSD priority values into Linux values in thesobomax2005-06-081-0/+13
| | | | | | | getpriority(2) syscall. PR: kern/81951 Submitted by: Andriy Gapon <avg@icyb.net.ua>
* Wrap copyin/copyout for kevent so the 32bit wrapper does not haveps2005-06-031-49/+66
| | | | | | | | | to malloc nchanges * sizeof(struct kevent) AND/OR nevents * sizeof(struct kevent) on every syscall. Glanced at by: peter, jmg Obtained from: Yahoo! MFC after: 2 weeks
* Rebuild generated system call definition files following the addition ofrwatson2005-05-308-714/+716
| | | | | | | the audit event field to the syscalls.master file format. Submitted by: wsalamon Obtained from: TrustedBSD Project
* Introduce a new field in the syscalls.master file format to hold therwatson2005-05-302-819/+997
| | | | | | | | | | | | | audit event identifier associated with each system call, which will be stored by makesyscalls.sh in the sy_auevent field of struct sysent. For now, default the audit identifier on all system calls to AUE_NULL, but in the near future, other BSM event identifiers will be used. The mapping of system calls to event identifiers is many:one due to multiple system calls that map to the same end functionality across compatibility wrappers, ABI wrappers, etc. Submitted by: wsalamon Obtained from: TrustedBSD Project
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-293-6/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Remove (now) unused argument 'td' from bsd_to_linux_statfs().pjd2005-05-271-4/+3
|
* Copyout to userland if kern_sigaction succeedsps2005-05-241-2/+2
|
* The code is under '#ifdef not_that_way', but anyway:pjd2005-05-221-0/+3
| | | | - Add missing prison_check_mount() check.
* If we need to hide fsid, kern_statfs()/kern_fstatfs() will do it for us,pjd2005-05-221-7/+2
| | | | | | | | | so do not duplicate the code in cvtstatfs(). Note, that we now need to clear fsid in freebsd4_getfsstat(). This moves all security related checks from functions like cvtstatfs() and will allow to add more security related stuff (like statfs(2), etc. protection for jails) a bit easier.
* Missed kern_windrv.c in the last checkin.wpaul2005-05-201-0/+14
|
* Deal with a few bootstrap issues:wpaul2005-05-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't call KeFlushQueuedDpcs() during bootstrap (cold == 1), since the flush operation sleeps to wait for completion, and we can't sleep here (clowns will eat us). On an i386 SMP system, if we're loaded/probed/attached during bootstrap, smp_rendezvous() won't run us anywhere except CPU 0 (since the other CPUs aren't launched until later), which means we won't be able to set up the GDTs anywhere except CPU 0. To deal with this case, ctxsw_utow() now checks to see if the TID for the current processor has been properly initialized and sets up the GTD for the current CPU if not. Lastly, in if_ndis.c:ndis_shutdown(), do an ndis_stop() to insure we really halt the NIC and stop interrupts from happening. Note that loading a driver during bootstrap is, unfortunately, kind of a hit or miss sort of proposition. In Windows, the expectation is that by the time a given driver's MiniportInitialize() method is called, the system is already in 'multiuser' state, i.e. it's up and running enough to support all the stuff specified in the NDIS API, which includes the underlying OS-supplied facilities it implicitly depends on, such as having all CPUs running, having the DPC queues initialized, WorkItem threads running, etc. But in UNIX, a lot of that stuff won't work during bootstrap. This causes a problem since we need to call MiniportInitialize() at least once during ndis_attach() in order to find out what kind of NIC we have and learn its station address. What this means is that some cards just plain won't work right if you try to pre-load the driver along with the kernel: they'll only be probed/attach correctly if the driver is kldloaded _after_ the system has reached multiuser. I can't really think of a way around this that would still preserve the ability to use an NDIS device for diskless booting.
* In ndis_halt_nic(), invalidate the miniportadapterctx early to try andwpaul2005-05-201-4/+1
| | | | | | | | | prevent anything from making calls to the NIC while it's being shut down. This is yet another attempt to stop things like mdnsd from trying to poke at the card while it's not properly initialized and panicking the system. Also, remove unneeded debug message from if_ndis.c.
* Fix some of the things I broke so that the SMC2602W (AMD Am1772) driverwpaul2005-05-193-32/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | works again. This driver uses NdisScheduleWorkItem(), and we have to take special steps to insure that its workitems don't collide with any of the other workitems used by the NDISulator. In particular, if one of the driver's work jobs blocks, it can prevent NdisMAllocateSharedMemoryAsync() from completing when expected. The original hack to fix this was to have NdisMAllocateSharedMemoryAsync() defer its work to the DPC queue instead of the general task queue. To fix it now, I decided to add some additional workitem threads. (There's supposed to be a pool of worker threads in Windows anyway.) Currently, there are 4. There should be at least 2. One is reserved for the legacy ExQueueWorkItem() API, while the others are used in round-robin by the IoQueueWorkItem() API. NdisMAllocateSharedMemoryAsync() uses the latter API while NdisScheduleWorkItem() uses the former, so the deadlock is avoided. Fixed NdisMRegisterDevice()/NdisMDeregisterDevice() to work a little more sensibly with the new driver_object/device_object framework. It doesn't really register a working user-mode interface, but the existing code was completely wrong for the new framework. Fixed a couple of bugs dealing with the cancellation of events and DPCs. When cancelling an event that's still on the timer queue (i.e. hasn't expired yet), reset dh_inserted in its dispatch header to FALSE. Previously, it was left set to TRUE, which would make a cancelled timer appear to have not been cancelled. Also, when removing a DPC from a queue, reset its list pointers, otherwise a cancelled DPC might mistakenly be treated as still pending. Lastly, fix the behavior of ntoskrnl_wakeup() when dealing with objects that have nobody waiting on them: sync event objects get their signalled state reset to FALSE, but notification objects should still be set to TRUE.
* Remove harmless bit of leftover debug code.wpaul2005-05-161-2/+0
|
* Correct some problems with workitem usage. NdisScheduleWorkItem() doeswpaul2005-05-162-4/+35
| | | | | not use exactly the same workitem sturcture as ExQueueWorkItem() like I originally thought it did.
* Add support for NdisMEthIndicateReceive() and MiniportTransferData().wpaul2005-05-152-10/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Ralink RT2500 driver uses this API instead of NdisMIndicateReceivePacket(). Drivers use NdisMEthIndicateReceive() when they know they support 802.3 media and expect to hand their packets only protocols that want to deal with that particular media type. With this API, the driver does not manage its own NDIS_PACKET/NDIS_BUFFER structures. Instead, it lets bound protocols have a peek at the data, and then they supply an NDIS_PACKET/NDIS_BUFFER combo to the miniport driver, into which it copies the packet data. Drivers use NdisMIndicateReceivePacket() to allow their packets to be read by any protocol, not just those bound to 802.3 media devices. To make this work, we need an internal pool of NDIS_PACKETS for receives. Currently, we check to see if the driver exports a MiniportTransferData() method in its characteristics structure, and only allocate the pool for drivers that have this method. This should allow the RT2500 driver to work correctly, though I still have to fix ndiscvt(8) to parse its .inf file properly. Also, change kern_ndis.c:ndis_halt_nic() to reap timers before acquiring NDIS_LOCK(), since the reaping process might entail sleeping briefly (and we can't sleep with a lock held).
* More fixes for multibus drivers. When calling out to the matchwpaul2005-05-082-2/+2
| | | | | function in if_ndis_pci.c and if_ndis_pccard.c, provide the bustype too so the stubs can ignore devlists that don't concern them.
* Fix support for Windows drivers that support both PCI and PCMCIA devices atwpaul2005-05-082-3/+14
| | | | | | | | | | | | | the same time. Fix if_ndis_pccard.c so that it sets sc->ndis_dobj and sc->ndis_regvals. Correct IMPORT_SFUNC() macros for the READ_PORT_BUFFER_xxx() routines, which take 3 arguments, not 2. This fixes it so that the Windows driver for my Cisco Aironet 340 PCMCIA card works again. (Yes, I know the an(4) driver supports this card natively, but it's the only PCMCIA device I have with a Windows XP driver.)
* Correct the patch table entries for the 64-bit intrinsic mathwpaul2005-05-081-6/+6
| | | | | | | | | | | | | | | routines (_alldiv(), _allmul(), _alludiv(), _aullmul(), etc...) that use the _stdcall calling convention. These routines all take two arguments, but the arguments are 64 bits wide. On the i386 this means they each consume two 32-bit slots on the stack. Consequently, when we specify the argument count in the IMPORT_SFUNC() macro, we have to lie and claim there are 4 arguments instead of two. This will cause the resulting i386 assembly wrapper to push the right number of longwords onto the stack. This fixes a crash I discovered with the RealTek 8180 driver, which uses these routines a lot during initialization.
* Cast 64 bit quantity to uintmax_t to print it with %jx. This iswpaul2005-05-051-1/+1
| | | | | | technically a no-op since uintmax_t is uint64_t on all currently supported architectures, but we should use an explicit cast instead of depending on this obscure coincidence.
* Use %jx instead of %qx to silence compiler warning on amd64.wpaul2005-05-051-1/+1
|
* Avoid sleeping with mutex held in kern_ndis.c.wpaul2005-05-053-35/+32
| | | | | | | | | | | | | | | Remove unused fields from ndis_miniport_block. Fix a bug in KeFlushQueuedDpcs() (we weren't calculating the kq pointer correctly). In if_ndis.c, clear the IFF_RUNNING flag before calling ndis_halt_nic(). Add some guards in kern_ndis.c to avoid letting anyone invoke ndis_get_info() or ndis_set_info() if the NIC isn't fully initialized. Apparently, mdnsd will sometimes try to invoke the ndis_ioctl() routine at exactly the wrong moment (to futz with its multicast filters) when the interface comes up, and can trigger a crash unless we guard against it.
* Remove extranaous free() of ASCII filename from NdisOpenFile().wpaul2005-05-051-1/+0
| | | | | | | | | | | | | | Oh, one additional change I forgot to mention in the last commit: NdisOpenFile() was broken in the case for firmware files that were pre-loaded as modules. When searching for the module in NdisOpenFile(), we would match against a symbol name, which would contain the string we were looking for, then save a pointer to the linker file handle. Later, in NdisMapFile(), we would refer to the filename hung off this handle when trying to find the starting address symbol. Only problem is, this filename is different from the embedded symbol name we're searching for, so the mapping would fail. I found this problem while testing the AirGo driver, which requires a small firmware file.
* This commit makes a bunch of changes, some big, some not so big.wpaul2005-05-057-447/+896
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove the old task threads from kern_ndis.c and reimplement them in subr_ntoskrnl.c, in order to more properly emulate the Windows DPC API. Each CPU gets its own DPC queue/thread, and each queue can have low, medium and high importance DPCs. New APIs implemented: KeSetTargetProcessorDpc(), KeSetImportanceDpc() and KeFlushQueuedDpcs(). (This is the biggest change.) - Fix a bug in NdisMInitializeTimer(): the k_dpc pointer in the nmt_timer embedded in the ndis_miniport_timer struct must be set to point to the DPC, also embedded in the struct. Failing to do this breaks dequeueing of DPCs submitted via timers, and in turn breaks cancelling timers. - Fix a bug in KeCancelTimer(): if the timer is interted in the timer queue (i.e. the timeout callback is still pending), we have to both untimeout() the timer _and_ call KeRemoveQueueDpc() to nuke the DPC that might be pending. Failing to do this breaks cancellation of periodic timers, which always appear to be inserted in the timer queue. - Make use of the nmt_nexttimer field in ndis_miniport_timer: keep a queue of pending timers and cancel them all in ndis_halt_nic(), prior to calling MiniportHalt(). Also call KeFlushQueuedDpcs() to make sure any DPCs queued by the timers have expired. - Modify NdisMAllocateSharedMemory() and NdisMFreeSharedMemory() to keep track of both the virtual and physical addresses of the shared memory buffers that get handed out. The AirGo MIMO driver appears to have a bug in it: for one of the segments is allocates, it returns the wrong virtual address. This would confuse NdisMFreeSharedMemory() and cause a crash. Why it doesn't crash Windows too I have no idea (from reading the documentation for NdisMFreeSharedMemory(), it appears to be a violation of the API). - Implement strstr(), strchr() and MmIsAddressValid(). - Implement IoAllocateWorkItem(), IoFreeWorkItem(), IoQueueWorkItem() and ExQueueWorkItem(). (This is the second biggest change.) - Make NdisScheduleWorkItem() call ExQueueWorkItem(). (Note that the ExQueueWorkItem() API is deprecated by Microsoft, but NDIS still uses it, since NdisScheduleWorkItem() is incompatible with the IoXXXWorkItem() API.) - Change if_ndis.c to use the NdisScheduleWorkItem() interface for scheduling tasks. With all these changes and fixes, the AirGo MIMO driver for the Belkin F5D8010 Pre-N card now works. Special thanks to Paul Robinson (paul dawt robinson at pwermedia dawt net) for the loan of a card for testing.
* - Pass the ISOPEN flag to namei so filesystems will know we're about tojeff2005-04-271-1/+1
| | | | open them or otherwise access the data.
OpenPOWER on IntegriCloud