aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux/linux_sysvec.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r232143:Konstantin Belousov2012-03-061-4/+4
| | | | | | | Do not write to the user address directly, use suword(). Notes: svn path=/stable/8/; revision=232597
* MFC r219405:Dmitry Chagin2011-06-081-4/+2
| | | | | | | | | | | | | | | | | | Extend struct sysvec with new method sv_schedtail, which is used for an explicit process at fork trampoline path instead of eventhadler(schedtail) invocation for each child process. Remove eventhandler(schedtail) code and change linux ABI to use newly added sysvec method. While here replace explicit comparing of module sysentvec structure with the newly created process sysentvec to detect the linux ABI. MFC r219421: Remove bogus since r219405 check of the Linux ABI. Notes: svn path=/stable/8/; revision=222846
* MFC r218658, r218668:Dmitry Chagin2011-03-021-1/+1
| | | | | | | Sort include files in the alphabetical order. Notes: svn path=/stable/8/; revision=219198
* MFC r208453:Konstantin Belousov2010-11-031-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorganize syscall entry and leave handling. Implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and PL_FLAG_EXEC. The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are changed to use syscallenter()/syscallret(). MIPS and arm are not converted and use the mostly unchanged syscall() implementation. MFC r208514: Change ia64' struct syscall_args definition so that args is a pointer to the arguments array instead of array itself. MFC r208566: Allow to use syscallname(9) outside subr_trap.c. MFC r209258 (by rpaulo): Make DTrace syscall provider work again by including opt_kdtrace.h here. MFC r209313: Only enable kdtrace hook in the LINT on the architectures that implement it. MFC r209697: Obey sv_syscallnames bounds in syscallname(). NOTE: The KBI of the struct sysentvec is changed, new required members sv_set_syscall_retval, sv_fetch_syscall_args and sv_syscallnames are added. The sv_prepsyscall field is now ignored. Third-party modules using the struct sysentvec must be modified and recompiled, we believe that only ABI emulators are affected. No such out-of-tree modules are known. In-tree modules that are affected by the change were converted to depend on exact version of the kernel, see r214421. Notes: svn path=/stable/8/; revision=214755
* MFC r213716:Konstantin Belousov2010-10-271-1/+1
| | | | | | | | | | | | | | | Add macro DECLARE_MODULE_TIED to denote a module as requiring the kernel of exactly the same __FreeBSD_version as the headers module was compiled against. Mark our in-tree ABI emulators with DECLARE_MODULE_TIED. The modules use kernel interfaces that the Release Engineering Team feel are not stable enough to guarantee they will not change during the life cycle of a STABLE branch. In particular, the layout of struct sysentvec is declared to be not part of the STABLE KBI. Notes: svn path=/stable/8/; revision=214421
* MFC r198507:Konstantin Belousov2009-12-191-12/+6
| | | | | | | | | | | | | | | | | Use kern_sigprocmask() instead of direct manipulation of td_sigmask to reschedule newly blocked signals. MFC r198590: Trapsignal() calls kern_sigprocmask() when delivering catched signal with proc lock held. MFC r198670: For trapsignal() and postsig(), kern_sigprocmask() is called with both process lock and curproc->p_sigacts->ps_mtx locked. Prevent lock recursion on ps_mtx in reschedule_signals(). Notes: svn path=/stable/8/; revision=200722
* MFC r196512:Bjoern A. Zeeb2009-08-271-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix handling of .note.ABI-tag section for GNU systems [1]. Handle GNU/Linux according to LSB Core Specification 4.0, Chapter 11. Object Format, 11.8. ABI note tag. Also check the first word of desc, not only name, according to glibc abi-tags specification to distinguish between Linux and kFreeBSD. Add explicit handling for Debian GNU/kFreeBSD, which runs on our kernels as well [2]. In {amd64,i386}/trap.c, when checking osrel of the current process, also check the ABI to not change the signal behaviour for Linux binary processes, now that we save an osrel version for all three from the lists above in struct proc [2]. These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD and Linux binaries on the same machine again for at least i386 and amd64, and no longer break kFreeBSD which was detected as GNU(/Linux). PR: kern/135468 Submitted by: dchagin [1] (initial patch) Suggested by: kib [2] Tested by: Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD Reviewed by: kib Approved by: re (kensmith) Notes: svn path=/stable/8/; revision=196601
* Do not export AT_CLKTCK when emulating Linux kernel priorDmitry Chagin2009-05-101-1/+11
| | | | | | | | | | | | | | | | | to 2.4.0, as it has appeared in the 2.4.0-rc7 first time. Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), glibc falls back to the hard-coded CLK_TCK value when aux entry is not present. Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value. For older applications/libc's which depends on hard-coded CLK_TCK value user should set compat.linux.osrelease less than 2.4.0. Approved by: kib (mentor) Notes: svn path=/head/; revision=191973
* Rework r189362, r191883.Dmitry Chagin2009-05-101-1/+2
| | | | | | | | | | | | The frequency of the statistics clock is given by stathz. Use stathz if it is available, otherwise use hz. Pointed out by: bde Approved by: kib (mentor) Notes: svn path=/head/; revision=191966
* Move the per-prison Linux MIB from a private one-off pointer to the newJamie Gritton2009-05-071-0/+2
| | | | | | | | | | | | OSD-based jail extensions. This allows the Linux MIB to accessed via jail_set and jail_get, and serves as a demonstration of adding jail support to a module. Reviewed by: dchagin, kib Approved by: bz (mentor) Notes: svn path=/head/; revision=191896
* Move extern variable definitions to the header file.Dmitry Chagin2009-05-021-3/+1
| | | | | | | | Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=191741
* Reimplement futexes.Dmitry Chagin2009-05-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Old implemention used Giant to protect the kernel data structures, but at the same time called malloc(M_WAITOK), that could cause the calling thread to sleep and lost Giant protection. User-visible result was the missed wakeup. New implementation uses one sx lock per futex. The sx protects the futex structures and allows to sleep while copyin or copyout are performed. Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation is requested and either caller specified futexes are equial or second futex already exists. This is acceptable since the situation can only occur from the application error, and glibc falls back to old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=191719
* Fix KBI breakage by r190520 which affects older linux.ko binaries:Dmitry Chagin2009-04-051-2/+2
| | | | | | | | | | | | | | | | | 1) Move the new field (brand_note) to the end of the Brandinfo structure. 2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer is valid. 3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old modules won't have the flag set, so the new field brand_note would be ignored. Suggested by: jhb Reviewed by: jhb Approved by: kib (mentor) MFC after: 6 days Notes: svn path=/head/; revision=190708
* Implement new way of branding ELF binaries by looking to aDmitry Chagin2009-03-131-2/+14
| | | | | | | | | | | | | | | ".note.ABI-tag" section. The search order of a brand is changed, now first of all the ".note.ABI-tag" is looked through. Move code which fetch osreldate for ELF binary to check_note() handler. PR: 118473 Approved by: kib (mentor) Notes: svn path=/head/; revision=189771
* A better fix for handling different FPU initial control words for differentJohn Baldwin2009-03-051-7/+3
| | | | | | | | | | | | | | | | | | | ABIs: - Store the FPU initial control word in the pcb for each thread. - When first using the FPU, load the initial control word after restoring the clean state if it is not the standard control word. - Provide a correct control word for Linux/i386 binaries under FreeBSD/amd64. - Adjust the control word returned for fpugetregs()/npxgetregs() when a thread hasn't used the FPU yet to reflect the real initial control word for the current ABI. - The Linux/i386 ABI for FreeBSD/i386 now properly sets the right control word instead of trashing whatever the current state of the FPU is. Reviewed by: bde Notes: svn path=/head/; revision=189423
* Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries whichDmitry Chagin2009-03-041-5/+161
| | | | | | | | | | | | | | | | | are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" from some programs at start, among them are top and pkill. Do the assignment of the vector entries in elf_linux_fixup() as it is done in glibc. Fix some minor style issues. Submitted by: Marcin Cieslak <saper at SYSTEM PL> Approved by: kib (mentor) MFC after: 1 week Notes: svn path=/head/; revision=189362
* Remove obsolete AT_DEBUG stuff. It never should have been committedWarner Losh2008-12-171-2/+0
| | | | | | | | | in the first place, let alone migrated to linux emulation. Reviewed by: peter, rdivacky Notes: svn path=/head/; revision=186211
* Add sv_flags field to struct sysentvec with intention to provide descriptionKonstantin Belousov2008-11-221-2/+4
| | | | | | | | | | | of the ABI of the currently executing image. Change some places to test the flags instead of explicit comparing with address of known sysentvec structures to determine ABI features. Discussed with: dchagin, imp, jhb, peter Notes: svn path=/head/; revision=185169
* Correctly fill siginfo for the signals delivered by linux tkill/tgkill.Konstantin Belousov2008-10-191-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | It is required for async cancellation to work. Fix PROC_LOCK leak in linux_tgkill when signal delivery attempt is made to not linux process. Do not call em_find(p, ...) with p unlocked. Move common code for linux_tkill() and linux_tgkill() into linux_do_tkill(). Change linux siginfo_t definition to match actual linux one. Extend uid fields to 4 bytes from 2. The extension does not change structure layout and is binary compatible with previous definition, because i386 is little endian, and each uid field has 2 byte padding after it. Reported by: Nicolas Joly <njoly pasteur fr> Submitted by: dchangin MFC after: 1 month Notes: svn path=/head/; revision=184058
* Change the static struct sysentvec and struct Elf_Brandinfo initializersKonstantin Belousov2008-09-241-74/+76
| | | | | | | | | | | | | | to the C99 style. At least, it is easier to read sysent definitions that way, and search for the actual instances of sigcode etc. Explicitely initialize sysentvec.sv_maxssiz that was missed in most sysvecs. No objection from: jhb MFC after: 1 month Notes: svn path=/head/; revision=183322
* Implement the linux syscallsKonstantin Belousov2008-04-081-1/+1
| | | | | | | | | | | | openat, mkdirat, mknodat, fchownat, futimesat, fstatat, unlinkat, renameat, linkat, symlinkat, readlinkat, fchmodat, faccessat. Submitted by: rdivacky Sponsored by: Google Summer of Code 2007 Tested by: pho Notes: svn path=/head/; revision=177997
* Add the support for the AT_FDCWD and fd-relative name lookups to theKonstantin Belousov2008-03-311-0/+1
| | | | | | | | | | | | namei(9). Based on the submission by rdivacky, sponsored by Google Summer of Code 2007 Reviewed by: rwatson, rdivacky Tested by: pho Notes: svn path=/head/; revision=177785
* Since version 4.3, gcc changed its behaviour concerning the i386/amd64Konstantin Belousov2008-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | | ABI and the direction flag, that is it now assumes that the direction flag is cleared at the entry of a function and it doesn't clear once more if needed. This new behaviour conforms to the i386/amd64 ABI. Modify the signal handler frame setup code to clear the DF {e,r}flags bit on the amd64/i386 for the signal handlers. jhb@ noted that it might break old apps if they assumed DF == 1 would be preserved in the signal handlers, but that such apps should be rare and that older versions of gcc would not generate such apps. Submitted by: Aurelien Jarno <aurelien aurel32 net> PR: 121422 Reviewed by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=177145
* Remove kernel support for M:N threading.Jeff Roberson2008-03-121-2/+1
| | | | | | | | | | | While the KSE project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the kse library was never developed to its full potential. Backwards compatibility will be provided via libmap.conf for dynamically linked binaries and static binaries will be broken. Notes: svn path=/head/; revision=177091
* Fill in cr2 in the signal context from ksi->ksi_addr.Konstantin Belousov2007-09-201-0/+2
| | | | | | | | | | | | | Together with the sys/i386/i386/trap.c rev. 1.306 it fixes the PR. Submitted by: rdivacky Suggested by: jhb Sponsored by: Google Summer of Code 2007 PR: kern/77710 Approved by: re (kensmith) Notes: svn path=/head/; revision=172255
* MFP4: Turn emul_lock into a mutex.Jung-uk Kim2007-04-021-2/+2
| | | | | | | Submitted by: rdivacky Notes: svn path=/head/; revision=168275
* Change futex lock from mutex to sx. Make futex_get atomic (protected by theAlexander Leidinger2006-09-091-3/+3
| | | | | | | | | | | futex lock). Sponsored by: Google SoC 2006 Submitted by: rdivacky Suggested by: jhb Notes: svn path=/head/; revision=162182
* Move some stuff into headers where they belong.Alexander Leidinger2006-08-171-5/+1
| | | | | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal Notes: svn path=/head/; revision=161419
* Add the linux 2.6.x stuff (not used by default!):Alexander Leidinger2006-08-151-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - TLS - complete - pid/tid mangling - complete - thread area - complete - futexes - complete with issues - clone() extension - complete with some possible minor issues - mq*/timer*/clock* stuff - complete but untested and the mq* stuff is disabled when not build as part of the kernel with native FreeBSD mq* support (module support for this will come later) Tested with: - linux-firefox - works, tested - linux-opera - works, tested - linux-realplay - doesnt work, issue with futexes - linux-skype - doesnt work, issue with futexes - linux-rt2-demo - works, tested - linux-acroread - doesnt work, unknown reason (coredump) and sometimes issue with futexes - various unix utilities in linux-base-gentoo3 and linux-base-fc4: everything tried worked On amd64 not everything is supported like on i386, the catchup is planned for later when the remaining bugs in the new functions are fixed. To test this new stuff, you have to run sysctl compat.linux.osrelease=2.6.16 to switch back use sysctl compat.linux.osrelease=2.4.2 Don't switch while running a linux program, strange things may or may not happen. Sponsored by: Google SoC 2006 Submitted by: rdivacky Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild Notes: svn path=/head/; revision=161310
* Add some more errno mappings (bsd -> linux) and a comment about the status..Alexander Leidinger2006-08-101-1/+6
| | | | | | | Submitted by: "Intron" <mag@intron.ac> Notes: svn path=/head/; revision=161204
* Enhance the Linux emulation layer to make MegaRAID SAS managements tool happy.Doug Ambrisko2006-05-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add back in a scheme to emulate old type major/minor numbers via hooks into stat, linprocfs to return major/minors that Linux app's expect. Currently only /dev/null is always registered. Drivers can register via the Linux type shim similar to the ioctl shim but by using linux_device_register_handler/linux_device_unregister_handler functions. The structure is: struct linux_device_handler { char *bsd_driver_name; char *linux_driver_name; char *bsd_device_name; char *linux_device_name; int linux_major; int linux_minor; int linux_char_device; }; Linprocfs uses this to display the major number of the driver. The soon to be available linsysfs will use it to fill in the driver name. Linux_stat uses it to translate the major/minor into Linux type values. Note major numbers are dynamically assigned via passing in a -1 for the major number so we don't need to keep track of them. This is somewhat needed due to us switching to our devfs. MegaCli will not run until I add in the linsysfs and mfi Linux compat changes. Sponsored by: IronPort Systems Notes: svn path=/head/; revision=158311
* regen after COMPAT_43 removalAlexander Leidinger2006-03-181-7/+0
| | | | Notes: svn path=/head/; revision=156843
* Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structureMaxim Sobolev2005-12-261-0/+2
| | | | | | | | | | | | | with flags bitfield and set BI_CAN_EXEC_DYN flag for all brands that usually allow executing elf dynamic binaries (aka shared libraries). When it is requested to execute ET_DYN elf image check if this flag is on after we know the elf brand allowing execution if so. PR: kern/87615 Submitted by: Marcin Koziej <creep@desk.pl> Notes: svn path=/head/; revision=153741
* Remove linux_mib_destroy() (which I actually added in between 5.0 and 5.1)John Baldwin2005-12-151-1/+0
| | | | | | | | | | | | which existed to cleanup the linux_osname mutex. Now that MTX_SYSINIT() has grown a SYSUNINIT to destroy mutexes on unload, the extra destroy here was redundant and resulted in panics in debug kernels. MFC after: 1 week Reported by: Goran Gajic ggajic at afrodita dot rcub dot bg dot ac dot yu Notes: svn path=/head/; revision=153448
* The signal code is now an int rather than a long, so update debug printfs.John Baldwin2005-10-141-2/+2
| | | | Notes: svn path=/head/; revision=151343
* 1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, mostDavid Xu2005-10-141-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64 Notes: svn path=/head/; revision=151316
* Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.cJohn Baldwin2005-07-291-3/+0
| | | | | | | | so that they aren't duplicated 3 times and are also in the same file as the code that depends on the SYSVIPC modules. Notes: svn path=/head/; revision=148540
* Use linux_emul_convpath() rather than linux_emul_find() asJohn Baldwin2005-02-071-7/+6
| | | | | | | linux_emul_find() is going away. Notes: svn path=/head/; revision=141469
* When running Linux binaries, set up the initial FPU state as LinuxDavid Schultz2005-02-061-0/+7
| | | | | | | | | would. PR: 28966 Notes: svn path=/head/; revision=141407
* o Split out kernel part of execve(2) syscall into two parts: one thatMaxim Sobolev2005-01-291-4/+4
| | | | | | | | | | | | | | copies arguments into the kernel space and one that operates completely in the kernel space; o use kernel-only version of execve(2) to kill another stackgap in linuxlator/i386. Obtained from: DragonFlyBSD (partially) MFC after: 2 weeks Notes: svn path=/head/; revision=140992
* Axe the semblance of support for PECOFF and Linux a.out core dumps.David Schultz2004-11-271-52/+2
| | | | Notes: svn path=/head/; revision=138126
* Maintain the broken state of backwards compatibilty for a.out (andDavid Schultz2004-11-201-2/+3
| | | | | | | | | | PECOFF!) core dumps. None of the old versions of gdb I tried were able to read a.out core dumps before or after this change. Reviewed by: arch@ Notes: svn path=/head/; revision=137921
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPPoul-Henning Kamp2004-07-151-1/+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". Notes: svn path=/head/; revision=132199
* Change the types of vn_rdwr_inchunks()'s len and aresid arguments toTim J. Robbins2004-06-051-1/+1
| | | | | | | | | 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. Notes: svn path=/head/; revision=130101
* Make sigaltstack as per-threaded, because per-process sigaltstack stateDavid Xu2004-01-031-2/+2
| | | | | | | | | | | | | | is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Notes: svn path=/head/; revision=124113
* Make sigaltstack as per-threaded, because per-process sigaltstack stateDavid Xu2004-01-031-9/+9
| | | | | | | | | | | | | | | | is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Reviewed by: deischen, dfr Notes: svn path=/head/; revision=124092
* Sorted includes. Removed duplicates exposed by this.Bruce Evans2003-12-291-12/+9
| | | | Notes: svn path=/head/; revision=123956
* Add an additional field to the elf brandinfo structure to supportPeter Wemm2003-12-231-2/+4
| | | | | | | | quicker exec-time replacement of the elf interpreter on an emulation environment where an entire /compat/* tree isn't really warranted. Notes: svn path=/head/; revision=123742
* Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bitPeter Wemm2003-09-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | systems where the data/stack/etc limits are too big for a 32 bit process. Move the 5 or so identical instances of ELF_RTLD_ADDR() into imgact_elf.c. Supply an ia32_fixlimits function. Export the clip/default values to sysctl under the compat.ia32 heirarchy. Have mmap(0, ...) respect the current p->p_limits[RLIMIT_DATA].rlim_max value rather than the sysctl tweakable variable. This allows mmap to place mappings at sensible locations when limits have been reduced. Have the imgact_elf.c ld-elf.so.1 placement algorithm use the same method as mmap(0, ...) now does. Note that we cannot remove all references to the sysctl tweakable maxdsiz etc variables because /etc/login.conf specifies a datasize of 'unlimited'. And that causes exec etc to fail since it can no longer find space to mmap things. Notes: svn path=/head/; revision=120422
* Rename P_THREADED to P_SA. P_SA means a process is using schedulerDavid Xu2003-06-151-1/+1
| | | | | | | activations. Notes: svn path=/head/; revision=116361