aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
Commit message (Collapse)AuthorAgeFilesLines
...
* Provide npx_get_fsave(9) and npx_set_fsave(9) functions to obtain andKonstantin Belousov2015-06-293-58/+103
| | | | | | | | | | | | | | | | | | | | | | restore the FPU state from the format of machine FSAVE area. The intended use is for ABI emulators to provide FSAVE-formatted FPU state to usermode requiring it, while kernel could use FXSAVE due to XMM/XSAVE. The core functionality to convert from/to FXSAVE format is shared with the fill_fpregs_xmm() and set_fpregs_xmm(). Move the later functions to npx.c and rename them to npx_fill_fpregs_xmm() and npx_set_fpregs_xmm(). They differ from nptx_get/set_fsave(9) since our mcontext contains padding to be zeroed or ignored. fill_fpregs() and set_fpregs() could be converted to use the new interface, but there are small differences to handle. Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=284926
* Move CS_SECURE() and EFL_SECURE() macros to the machine/frame.h. TheyKonstantin Belousov2015-06-292-3/+8
| | | | | | | | | | are useful for most implementations of sendsig(). Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=284925
* Add a comment about too strong semantic of atomic_load_acq() on x86.Konstantin Belousov2015-06-291-0/+9
| | | | | | | | Submitted by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=284922
* Add x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests toKonstantin Belousov2015-06-291-2/+51
| | | | | | | | | | | | | | | | obtain the thread %fs and %gs bases. Add x86 PT_SETFSBASE and PT_SETGSBASE requests to set the bases from debuggers. The set requests, similarly to the sysarch({I386,AMD64}_SET_FSBASE), override the corresponding segment registers. The main purpose of the operations is to retrieve and modify the tcb address for debuggee. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=284919
* Reduce code duplication. Add helper fill_based_sd(9) which creates aKonstantin Belousov2015-06-292-23/+22
| | | | | | | | | | based user data descriptor covering whole VA. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=284918
* Remove unneeded data dependency, currently imposed byKonstantin Belousov2015-06-282-49/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | atomic_load_acq(9), on it source, for x86. Right now, atomic_load_acq() on x86 is sequentially consistent with other atomics, code ensures this by doing store/load barrier by performing locked nop on the source. Provide separate primitive __storeload_barrier(), which is implemented as the locked nop done on a cpu-private variable, and put __storeload_barrier() before load, to keep seq_cst semantic but avoid introducing false dependency on the no-modification of the source for its later use. Note that seq_cst property of x86 atomic_load_acq() is not documented and not carried by atomics implementations on other architectures, although some kernel code relies on the behaviour. This commit does not intend to change this. Reviewed by: alc Discussed with: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=284901
* Replace struct filedesc argument in getvnode with struct threadMateusz Guzik2015-06-161-4/+2
| | | | | | | This is is a step towards removal of spurious arguments. Notes: svn path=/head/; revision=284446
* Report the values of x86 segment registers to remote debuggers.John Baldwin2015-06-123-2/+17
| | | | | | | | | | | While here, also report %eflags from the i386 trapframe. Differential Revision: https://reviews.freebsd.org/D2743 Reviewed by: kib Obtained from: 1 month Notes: svn path=/head/; revision=284325
* Ensure that the upper 16 bits of segment registers manually saved inJohn Baldwin2015-06-122-15/+30
| | | | | | | | | | | | | | trapframes are cleared by explicitly pushing a zero and then moving the segment register into the low 16 bits. Certain Intel processors treat a push of a segment register as a move of the segment register into the low 16 bits leaving the upper 16 bits of the word in the stack unchanged. Reviewed by: kib MFC after: 1 month Notes: svn path=/head/; revision=284324
* Allow DTrace to be compiled-in to the kernel.Ruslan Bukin2015-06-101-0/+17
| | | | | | | | | | | This will require for AArch64 as we dont have modules yet. Sponsored by: HEIF5 Sponsored by: ARM Ltd. Differential Revision: https://reviews.freebsd.org/D1997 Notes: svn path=/head/; revision=284227
* Implement lockless resource limits.Mateusz Guzik2015-06-103-24/+8
| | | | | | | | | | | | | Use the same scheme implemented to manage credentials. Code needing to look at process's credentials (as opposed to thred's) is provided with *_proc variants of relevant functions. Places which possibly had to take the proc lock anyway still use the proc pointer to access limits. Notes: svn path=/head/; revision=284215
* Generalised support for copy-on-write structures shared by threads.Mateusz Guzik2015-06-101-2/+2
| | | | | | | | | | | | Thread credentials are maintained as follows: each thread has a pointer to creds and a reference on them. The pointer is compared with proc's creds on userspace<->kernel boundary and updated if needed. This patch introduces a counter which can be compared instead, so that more structures can use this scheme without adding more comparisons on the boundary. Notes: svn path=/head/; revision=284214
* Account for superpage mappings that are created by pmap_copy().Alan Cox2015-06-091-0/+1
| | | | Notes: svn path=/head/; revision=284181
* Merge r283870 from amd64:Dimitry Andric2015-06-081-6/+2
| | | | | | | | | | | | | | | | | Remove unneeded NULL checks in trap_fatal(). Since td_name is an array member of struct thread, it can never be NULL, so the check can be removed. In addition, curproc can never be NULL, so remove the if statement, and splice the two printfs() together. While here, remove the u_long cast, and use the correct printf format specifier for curproc->p_pid. Requested by: jhb MFC after: 3 days Notes: svn path=/head/; revision=284167
* Retire VM_FREEPOOL_CACHE as the next step in eliminating PG_CACHE pages.Alan Cox2015-06-081-3/+2
| | | | | | | | | Differential Revision: https://reviews.freebsd.org/D2712 Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=284147
* Update print_INTEL_TLB() by the tag values from the Intel SDMKonstantin Belousov2015-06-062-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rev. 55. The modern CPUs cache and TLB descriptions looked quite questionable without the update, e.g. Haswell i7 4770S reported: Data TLB: 4 KB pages, 4-way set associative, 64 entries L2 cache: 256 kbytes, 8-way associative, 64 bytes/line After the update, the report is: Data TLB: 1 GByte pages, 4-way set associative, 4 entries Data TLB: 4 KB pages, 4-way set associative, 64 entries Instruction TLB: 2M/4M pages, fully associative, 8 entries Instruction TLB: 4KByte pages, 8-way set associative, 64 entries 64-Byte prefetching Shared 2nd-Level TLB: 4 KByte/2MByte pages, 8-way associative, 1024 entries L2 cache: 256 kbytes, 8-way associative, 64 bytes/line Some tags were apparently removed from the table 3-21, Vol. 2A. Keep them around, but add a comment stating the removal. Update the format line for cpu_stdext_feature according to the bits from the SDM rev.55. It appears that Haswells do not store %cs and %ds values in the FPU save area. Store content of the %ecx register from the CPUID leaf 0x7 subleaf 0 as cpu_stdext_feature2 and print defined bits from it, again acording to SDM rev. 55. Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=284104
* When I merged the lemul branch I missied kib@'s r282708 commit.Dmitry Chagin2015-05-251-9/+0
| | | | | | | | | | This is not the final fix as I need properly cleanup thread resources before other threads suicide. Tested by: Ruslan Makhmatkhanov Notes: svn path=/head/; revision=283544
* Regen for r283492.Dmitry Chagin2015-05-245-8/+20
| | | | Notes: svn path=/head/; revision=283493
* Implement Linux specific syncfs() system call.Dmitry Chagin2015-05-242-2/+1
| | | | Notes: svn path=/head/; revision=283492
* Regen for r283488.Dmitry Chagin2015-05-245-10/+69
| | | | Notes: svn path=/head/; revision=283489
* Implement recvmmsg() and sendmmsg() system calls.Dmitry Chagin2015-05-242-4/+6
| | | | Notes: svn path=/head/; revision=283488
* Reduce duplication between MD Linux code by moving msg relatedDmitry Chagin2015-05-241-16/+0
| | | | | | | struct definitions out into the compat/linux/linux_socket.h Notes: svn path=/head/; revision=283487
* Regen for r283484.Dmitry Chagin2015-05-245-7/+7
| | | | Notes: svn path=/head/; revision=283486
* Implement epoll_pwait() system call.Dmitry Chagin2015-05-242-2/+1
| | | | Notes: svn path=/head/; revision=283484
* Regen for r283480.Dmitry Chagin2015-05-245-8/+35
| | | | Notes: svn path=/head/; revision=283482
* Add utimensat() system call.Dmitry Chagin2015-05-242-2/+2
| | | | | | | | The patch developed by Jilles Tjoelker and Andrew Wilcox and adopted for lemul branch by me. Notes: svn path=/head/; revision=283480
* The kernel sends signals to the processes via ABI specific sv_sendsig method.Dmitry Chagin2015-05-241-8/+0
| | | | | | | | | | | Native ABI do not need signal conversion, only emulators may want this. Usually emulators implements its own sv_sendsig method. For now only ibcs2 emulator does not have own sv_sendsig implementation and depends on native sendsig() method. So, remove any extra attempts to convert signal numbers from native sendsig() methods except from i386 where ibsc2 is living. Notes: svn path=/head/; revision=283479
* Rework signal code to allow using it by other modules, like linprocfs:Dmitry Chagin2015-05-244-94/+17
| | | | | | | | | | | | | | | | | | | | 1. Linux sigset always 64 bit on all platforms. In order to move Linux sigset code to the linux_common module define it as 64 bit int. Move Linux sigset manipulation routines to the MI path. 2. Move Linux signal number definitions to the MI path. In general, they are the same on all platforms except for a few signals. 3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion tables to avoid conversion errors. 4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside of allowed on Linux signal numbers. PR: 197216 Notes: svn path=/head/; revision=283474
* According to Linux man sigaltstack(3) shall return EINVAL if the ssDmitry Chagin2015-05-242-26/+0
| | | | | | | | | | | | | | | | argument is not a null pointer, and the ss_flags member pointed to by ss contains flags other than SS_DISABLE. However, in fact, Linux also allows SS_ONSTACK flag which is simply ignored. For buggy apps (at least mono) ignore other than SS_DISABLE flags as a Linux do. While here move MI part of sigaltstack code to the appropriate place. Reported by: abi at abinet dot ru Notes: svn path=/head/; revision=283471
* Regen for r283467.Dmitry Chagin2015-05-244-5/+7
| | | | Notes: svn path=/head/; revision=283468
* Call nosys in case when the incorrect syscall number is specified.Dmitry Chagin2015-05-242-1/+4
| | | | | | | Reported by: trinity Notes: svn path=/head/; revision=283467
* Regen for r283465.Dmitry Chagin2015-05-245-7/+34
| | | | Notes: svn path=/head/; revision=283466
* Add preliminary fallocate system call implementationDmitry Chagin2015-05-242-3/+2
| | | | | | | | | | to emulate posix_fallocate() function. Differential Revision: https://reviews.freebsd.org/D1523 Reviewed by: emaste Notes: svn path=/head/; revision=283465
* Regen for r283451.Dmitry Chagin2015-05-245-8/+40
| | | | Notes: svn path=/head/; revision=283452
* Implement ppoll() system call.Dmitry Chagin2015-05-242-2/+2
| | | | | | | | Differential Revision: https://reviews.freebsd.org/D1105 Reviewed by: trasz Notes: svn path=/head/; revision=283451
* Regen for r283444.Dmitry Chagin2015-05-245-10/+39
| | | | Notes: svn path=/head/; revision=283445
* Implement eventfd system call.Dmitry Chagin2015-05-242-4/+2
| | | | | | | | Differential Revision: https://reviews.freebsd.org/D1094 In collaboration with: Jilles Tjoelker Notes: svn path=/head/; revision=283444
* Put the correct value for the abi_nfdbits parameter of kern_select() forDmitry Chagin2015-05-241-0/+1
| | | | | | | | | | all supported Linuxulators. Differential Revision: https://reviews.freebsd.org/D1093 Reviewed by: trasz Notes: svn path=/head/; revision=283443
* Regen for r283441.Dmitry Chagin2015-05-245-19/+129
| | | | Notes: svn path=/head/; revision=283442
* Implement epoll family system calls. This is a tiny wrapperDmitry Chagin2015-05-242-9/+8
| | | | | | | | | | | | | | | around kqueue() to implement epoll subset of functionality. The kqueue user data are 32bit on i386 which is not enough for epoll user data, so we keep user data in the proc emuldata. Initial patch developed by rdivacky@ in 2007, then extended by Yuri Victorovich @ r255672 and finished by me in collaboration with mjg@ and jillies@. Differential Revision: https://reviews.freebsd.org/D1092 Notes: svn path=/head/; revision=283441
* To avoid code duplication move open/fcntl definitions to the MIDmitry Chagin2015-05-241-36/+1
| | | | | | | | | | header file. Differential Revision: https://reviews.freebsd.org/D1087 Reviewed by: trasz Notes: svn path=/head/; revision=283437
* Use the BSD_TO_LINUX_SIGNAL() wherever there is no needDmitry Chagin2015-05-241-6/+2
| | | | | | | | | to check the ABI as it is known. Differential Revision: https://reviews.freebsd.org/D1086 Notes: svn path=/head/; revision=283436
* Being exported through vdso the note.Linux section used by glibcDmitry Chagin2015-05-241-2/+2
| | | | | | | | | | | | to determine the kernel version (this saves one uname call). Temporarily disable the export of a note.Linux section until I figured out how to change the kernel version in the note.Linux on the fly. Differential Revision: https://reviews.freebsd.org/D1081 Reviewed by: trasz Notes: svn path=/head/; revision=283432
* Add AT_RANDOM and AT_EXECFN auxiliary vector entries which are used byDmitry Chagin2015-05-242-1/+27
| | | | | | | | | glibc. At list since glibc version 2.16 using AT_RANDOM is mandatory. Differential Revision: https://reviews.freebsd.org/D1080 Notes: svn path=/head/; revision=283431
* Regen for r283428.Dmitry Chagin2015-05-245-10/+5
| | | | Notes: svn path=/head/; revision=283429
* Change linux faccessat syscall definition to match actual linux one.Dmitry Chagin2015-05-241-1/+2
| | | | | | | | | | | | | The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented within the glibc wrapper function for faccessat(). If either of these flags are specified, then the wrapper function employs fstatat() to determine access permissions. Differential Revision: https://reviews.freebsd.org/D1078 Reviewed by: trasz Notes: svn path=/head/; revision=283428
* Introduce a new module linux_common.ko which is intended for theDmitry Chagin2015-05-242-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | following primary purposes: 1. Remove the dependency of linsysfs and linprocfs modules from linux.ko, which will be architecture specific on amd64. 2. Incorporate into linux_common.ko general code for platforms on which we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit). 3. Move malloc(9) declaration to linux_common.ko, to enable getting memory usage statistics properly. Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko. Temporarily remove dtrace garbage from linux_mib.c and linux_util.c Differential Revision: https://reviews.freebsd.org/D1072 In collaboration with: Vassilis Laganakos. Reviewed by: trasz Notes: svn path=/head/; revision=283421
* x86_64 Linux do not use multiplexing on ipc system calls.Dmitry Chagin2015-05-241-0/+10
| | | | | | | | | | | Move struct ipc_perm definition to the MD path as it differs for 64 and 32 bit platform. Differential Revision: https://reviews.freebsd.org/D1068 Reviewed by: trasz Notes: svn path=/head/; revision=283416
* Remove stale comment about a signal trampoline whichDmitry Chagin2015-05-241-1/+0
| | | | | | | | | | is moved to the shared page at r219609. Differential Revision: https://reviews.freebsd.org/D1063 Reviewed by: trasz Notes: svn path=/head/; revision=283411
* Put linux_platform into the vdso to avoid copying it onto the stack atDmitry Chagin2015-05-241-4/+4
| | | | | | | | | | every exec. Differential Revision: https://reviews.freebsd.org/D1062 Reviewed by: trasz Notes: svn path=/head/; revision=283410