aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux
Commit message (Collapse)AuthorAgeFilesLines
* Somewhere between 2.6.23 and 2.6.27, Linux added SOCK_CLOEXEC andDmitry Chagin2009-05-161-0/+1
| | | | | | | | | | | | | SOCK_NONBLOCK flags, that allow to save fcntl() calls. Implement a variation of the socket() syscall which takes a flags in addition to the type argument. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=192206
* 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
* To avoid excessive code duplication move MI definitions to the MIDmitry Chagin2009-05-071-8/+0
| | | | | | | | | | header file. As it is defined in Linux. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=191876
* 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-042-5/+165
| | | | | | | | | | | | | | | | | 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
* Adapt linux emulation to use cv for vfork wait.Konstantin Belousov2009-02-181-2/+2
| | | | | | | | Submitted by: Takahiro Kurosawa <takahiro.kurosawa gmail com> PR: kern/131506 Notes: svn path=/head/; revision=188750
* Change some movl's to mov's. Newer GAS no longer accept 'movl' instructionsDavid E. O'Brien2009-01-311-2/+2
| | | | | | | | | for moving between a segment register and a 32-bit memory location. Looked at by: jhb Notes: svn path=/head/; revision=187948
* 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
* Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64.Konstantin Belousov2008-11-291-0/+16
| | | | | | | | | | | Change types used in the linux' struct msghdr and struct cmsghdr definitions to the properly-sized architecture-specific types. Move ancillary data handler from linux_sendit() to linux_sendmsg(). Submitted by: dchagin Notes: svn path=/head/; revision=185442
* 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
* In the robust futexes list head, futex_offset shall be signed,Konstantin Belousov2008-11-161-1/+1
| | | | | | | | | and glibc actually supplies negative offsets. Change l_ulong to l_long. Submitted by: dchagin Notes: svn path=/head/; revision=185002
* Several cleanups related to pipe(2).Ed Schouten2008-11-111-15/+5
| | | | | | | | | | | | | | | | | | | | | - Use `fildes[2]' instead of `*fildes' to make more clear that pipe(2) fills an array with two descriptors. - Remove EFAULT from the manual page. Because of the current calling convention, pipe(2) raises a segmentation fault when an invalid address is passed. - Introduce kern_pipe() to make it easier for binary emulations to implement pipe(2). - Make Linux binary emulation use kern_pipe(), which means we don't have to recover td_retval after calling the FreeBSD system call. Approved by: rdivacky Discussed on: arch Notes: svn path=/head/; revision=184849
* Regenerate system call tables for r184789.Ed Schouten2008-11-093-5/+11
| | | | Notes: svn path=/head/; revision=184790
* Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.Ed Schouten2008-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Looking at our source code history, it seems the uname(), getdomainname() and setdomainname() system calls got deprecated somewhere after FreeBSD 1.1, but they have never been phased out properly. Because we don't have a COMPAT_FREEBSD1, just use COMPAT_FREEBSD4. Also fix the Linuxolator to build without the setdomainname() routine by just making it call userland_sysctl on kern.domainname. Also replace the setdomainname()'s implementation to use this approach, because we're duplicating code with sysctl_domainname(). I wasn't able to keep these three routines working in our COMPAT_FREEBSD32, because that would require yet another keyword for syscalls.master (COMPAT4+NOPROTO). Because this routine is probably unused already, this won't be a problem in practice. If it turns out to be a problem, we'll just restore this functionality. Reviewed by: rdivacky, kib Notes: svn path=/head/; revision=184789
* Correctly fill siginfo for the signals delivered by linux tkill/tgkill.Konstantin Belousov2008-10-192-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Make robust futexes work on linux32/amd64. Use PTRIN to readKonstantin Belousov2008-10-141-0/+11
| | | | | | | | | | | user-mode pointers. Change types used in the structures definitions to properly-sized architecture-specific types. Submitted by: dchagin MFC after: 1 week Notes: svn path=/head/; revision=183871
* 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
* Segment registers are stored in the uc_mcontext member of the structKonstantin Belousov2008-09-072-1/+3
| | | | | | | | | | | | l_ucontext. To restore the registers content, trampoline needs to dereference uc_mcontext instead of taking some undefined values from l_ucontext. Submitted by: Dmitry Chagin <dchagin@> MFC after: 1 week Notes: svn path=/head/; revision=182849
* Regen.Roman Divacky2008-05-133-7/+10
| | | | | | | Approved by: kib (mentor) Notes: svn path=/head/; revision=178977
* Implement robust futexes. Most of the code is modelled afterRoman Divacky2008-05-132-4/+4
| | | | | | | | | | | | | | what Linux does. This is because robust futexes are mostly userspace thing which we cannot alter. Two syscalls maintain pointer to userspace list and when process exits a routine walks this list waking up processes sleeping on futexes from that list. Reviewed by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=178976
* Implement linux_truncate64() syscall.Roman Divacky2008-04-231-1/+0
| | | | | | | | Tested by: Aline de Freitas <aline@riseup.net> Approved by: kib (mentor) Notes: svn path=/head/; revision=178439
* Regenerate.Jung-uk Kim2008-04-163-4/+46
| | | | Notes: svn path=/head/; revision=178258
* Add stubs for syscalls introduced in Linux 2.6.17 kernel.Jung-uk Kim2008-04-162-0/+12
| | | | | | | | | Some GNU libc version started using them before 2.6.17 was officially out. MFC after: 3 days Notes: svn path=/head/; revision=178257
* RegenerateKonstantin Belousov2008-04-083-41/+73
| | | | Notes: svn path=/head/; revision=177999
* Implement the linux syscallsKonstantin Belousov2008-04-084-28/+25
| | | | | | | | | | | | 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
* Regen.Roman Divacky2008-03-163-4/+12
| | | | Notes: svn path=/head/; revision=177258
* Implement sched_setaffinity and get_setaffinity usingRoman Divacky2008-03-161-1/+2
| | | | | | | | | | real cpu affinity setting primitives. Reviewed by: jeff Approved by: kib (mentor) Notes: svn path=/head/; revision=177257
* 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
* Fix Linux mmap with MAP_GROWSDOWN flag.Jung-uk Kim2008-02-111-14/+15
| | | | | | | | | | Reported by: Andriy Gapon (avg at icyb dot net dot ua) Tested by: Andriy Gapon (avg at icyb dot net dot ua) Pointyhat: me MFC after: 3 days Notes: svn path=/head/; revision=176193
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inAttilio Rao2008-01-131-2/+1
| | | | | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com> Notes: svn path=/head/; revision=175294
* vn_lock() is currently only used with the 'curthread' passed as argument.Attilio Rao2008-01-101-1/+1
| | | | | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com> Notes: svn path=/head/; revision=175202
* Implement read_default_ldt in linux_modify_ldt(). It copies out zeroedKonstantin Belousov2007-11-261-0/+9
| | | | | | | | | | | descriptor, like real Linux does. Tested by: Yuriy Tsibizov <yuriy.tsibizov at gmail com> Submitted by: rdivacky MFC after: 1 week Notes: svn path=/head/; revision=173937
* Fix for the panic("vm_thread_new: kstack allocation failed") andKonstantin Belousov2007-11-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | silent NULL pointer dereference in the i386 and sparc64 pmap_pinit() when the kmem_alloc_nofault() failed to allocate address space. Both functions now return error instead of panicing or dereferencing NULL. As consequence, vmspace_exec() and vmspace_unshare() returns the errno int. struct vmspace arg was added to vm_forkproc() to avoid dealing with failed allocation when most of the fork1() job is already done. The kernel stack for the thread is now set up in the thread_alloc(), that itself may return NULL. Also, allocation of the first process thread is performed in the fork1() to properly deal with stack allocation failure. proc_linkup() is separated into proc_linkup() called from fork1(), and proc_linkup0(), that is used to set up the kernel process (was known as swapper). In collaboration with: Peter Holm Reviewed by: jhb Notes: svn path=/head/; revision=173361
* 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
* regen.David Malone2007-09-183-3/+3
| | | | | | | Approved by: re (kensmith) Notes: svn path=/head/; revision=172221
* The kernel version of Linux statfs64 is actually supposed to takeDavid Malone2007-09-183-1/+15
| | | | | | | | | | | | | | | | 3 arguments, but we had forgotten the second argument. Also make the Linux statfs64 struct depend on the architecture because it has an extra 4 bytes padding on amd64 compared to i386. The three argument fix is from David Taylor, the struct statfs64 stuff is my fault. With this patch I can install i386 Linux matlab on an amd64 machine. Submitted by: David Taylor <davidt_at_yadt.co.uk> Approved by: re (kensmith) Notes: svn path=/head/; revision=172220
* - Move all of the PS_ flags into either p_flag or td_flags.Jeff Roberson2007-09-171-2/+2
| | | | | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith) Notes: svn path=/head/; revision=172207
* Regenerate.Konstantin Belousov2007-08-283-4/+19
| | | | | | | Approved by: re (kensmith) Notes: svn path=/head/; revision=171999
* Implement fake linux sched_getaffinity() syscall to enable java to workKonstantin Belousov2007-08-281-1/+2
| | | | | | | | | | | | | with Linux 2.6 emulation. This shall be reimplemented once FreeBSD gets native scheduler affinity syscalls. Submitted by: rdivacky Reviewed by: jkim Sponsored by: Google Summer of Code 2007 Approved by: re (kensmith) Notes: svn path=/head/; revision=171998
* i386_set_ioperm, i386_get_ldt and i386_set_ldt are now MPSAFEAttilio Rao2007-07-201-6/+0
| | | | | | | | | | | (Giant/sched_lock free) so remove unuseful Giant cruft. Approved by: jeff Approved by: re Sponsorized by: NGX Italy (http://www.ngx.it) Notes: svn path=/head/; revision=171515
* Don't add the 'pad' argument to the mmap/truncate/etc syscalls.Peter Wemm2007-07-041-2/+0
| | | | | | | | Submitted by: kensmith Approved by: re (kensmith) Notes: svn path=/head/; revision=171216
* Commit 14/14 of sched_lock decomposition.Jeff Roberson2007-06-051-6/+6
| | | | | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each) Notes: svn path=/head/; revision=170307