aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux/linux.h
Commit message (Collapse)AuthorAgeFilesLines
* linux(4): Deduplicate mmap2Dmitry Chagin2023-09-051-0/+2
| | | | | | | To help porting the Linux emulation layer to a new platforms start using Linux names for conditional builds instead of architecture-specific ifdefs. MFC after: 1 week
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* linux(4): Add elf_hwcap2 to x86Dmitry Chagin2023-07-281-1/+1
| | | | | | | | | On x86 Linux via AT_HWCAP2 the user controlled (by tunables) processor capabilities are exposed. Reviewed by: Differential Revision: https://reviews.freebsd.org/D41165 MFC after: 2 weeks
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* linux(4): Make struct stat64 to match Linux actual oneDmitry Chagin2023-04-281-6/+5
|
* linux(4): Move dev_t type declaration under /compat/linuxDmitry Chagin2023-04-281-1/+0
| | | | | As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer on all platforms. Move it into the MI linux.h under /compat/linux.
* linux(4): Make struct newstat to match actual Linux oneDmitry Chagin2023-04-281-4/+2
| | | | In the struct stat the st_dev, st_rdev are unsigned long.
* linux(4): Rename obsolete old struct l_stat to struct l_old_statDmitry Chagin2023-04-281-1/+2
|
* linux(4): Fix LINUX_AT_COUNT commentsDmitry Chagin2023-04-221-1/+1
| | | | | Differential Revision: https://reviews.freebsd.org/D39645 MFC after: 1 month
* linux(4): Deduplicate linux_copyout_auxargs()Dmitry Chagin2023-04-221-1/+1
| | | | | | | | Export default MINSIGSTKSZ value for the x86 until we do not preserve AVX registers in the signal context. Differential Revision: https://reviews.freebsd.org/D39644 MFC after: 1 month
* linux(4): Reduce code duplication between MD filesDmitry Chagin2023-03-041-33/+0
| | | | | | | Move struct ifnet definitions under compat/linux. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38791
* linux(4): Add coredump support to i386.Dmitry Chagin2023-02-021-0/+28
| | | | MFC after: 1 week
* linux(4): Deduplicate MI futex structures.Dmitry Chagin2023-02-011-11/+0
| | | | MFC after: 1 week
* linux(4): Reduce duplication between MD parts of the LinuxulatorDmitry Chagin2022-05-301-5/+0
| | | | | | | Move sigprocmask actions defines under compat/linux, they are identical across all Linux architectures. MFC after: 2 weeks
* linux(4): Handle 64-bit SO_TIMESTAMP for 32-bit binariesDmitry Chagin2022-05-281-0/+5
| | | | | | | | | | | | To solve y2k38 problem in the recvmsg syscall the new SO_TIMESTAMP constant were added on v5.1 Linux kernel. So, old 32-bit binaries that knows only 32-bit time_t uses the old value of the constant, and binaries that knows 64-bit time_t uses the new constant. To determine what size of time_t type is expected by the user-space, store requested value (SO_TIMESTAMP) in the process emuldata structure. MFC after: 2 weeks
* linux(4): Rework the definition of struct siginfo to match Linux actual oneDmitry Chagin2022-05-151-68/+2
| | | | | | | | | | | | Rework the defintion of struct siginfo so that the array padding struct siginfo to SI_MAX_SIZE can be placed in a union along side of the rest of the struct siginfo members. The result is that we no longer need the __ARCH_SI_PREAMBLE_SIZE or SI_PAD_SIZE definitions. Move struct siginfo definition under /compat/linux to reduce MD part. To avoid headers polution include linux_siginfo.h in the MD linux.h MFC after: 2 weeks
* linux(4): Move sigframe definitions to separate headersDmitry Chagin2022-05-151-92/+0
| | | | | | | | The signal trampoine-related definitions are used only in the MD part of code, wherefore moved from everywhere used linux.h to separate MD headers. MFC after: 2 weeks
* linux(4): Cleanup signal trampolinesDmitry Chagin2022-05-151-4/+0
| | | | | | | | | | | | | | | | | | This is the first stage of a signal trampolines refactoring. From trampolines retired emulation of the 'call' instruction, which is replaced by direct call of a signal handler. The signal handler address is in the register. The previous trampoline implemenatation used semi-Linux-way to call a signal handler via the 'jmp' instruction. Wherefore the trampoline emulated a 'call' instruction to into the stack the return address for signal handler's 'ret' instruction. Wherefore handmade DWARD annotations was used. While here rephrased and removed excessive comments. MFC after: 2 weeks
* linux: implement sigaltstack(2) on arm64Edward Tomasz Napierala2021-07-271-1/+1
| | | | | | | | ... by making it machine-independent. Reviewed By: dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31286
* linux(4); Almost complete the vDSO.Dmitry Chagin2021-07-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vDSO (virtual dynamic shared object) is a small shared library that the kernel maps R/O into the address space of all Linux processes on image activation. The vDSO is a fully formed ELF image, shared by all processes with the same ABI, has no process private data. The primary purpose of the vDSO: - non-executable stack, signal trampolines not copied to the stack; - signal trampolines unwind, mandatory for the NPTL; - to avoid contex-switch overhead frequently used system calls can be implemented in the vDSO: for now gettimeofday, clock_gettime. The first two have been implemented, so add the implementation of system calls. System calls implemenation based on a native timekeeping code with some limitations: - ifunc can't be used, as vDSO r/o mapped to the process VA and rtld can't relocate symbols; - reading HPET memory is not implemented for now (TODO). In case on any error vDSO system calls fallback to the kernel system calls. For unimplemented vDSO system calls added prototypes which call corresponding kernel system call. Tested by: trasz (arm64) Differential revision: https://reviews.freebsd.org/D30900 MFC after: 2 weeks
* linux(4): Retire a now unused include.Dmitry Chagin2021-06-221-1/+0
| | | | MFC after: 2 weeks
* linux(4): Rework Linux ppoll system call.Dmitry Chagin2021-06-221-21/+0
| | | | | | | | | | | | | | | | | | For now the Linux emulation layer uses in kernel ppoll(2) without conversion of user supplied fd 'events', and does not convert the kernel supplied fd 'revents'. At least POLLRDHUP is handled by FreeBSD differently than by Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's unlike FreeBSD, which does more strictly check and fails. Rework the Linux ppoll, using kern_poll and converting 'events' and 'revents' values. While here, move poll events defines to the MI part of code as they mostly identical on all arches except arm. Differential Revision: https://reviews.freebsd.org/D30716 MFC after: 2 weeks
* linux(4): add struct timespec64 definition and conversion routine forDmitry Chagin2021-06-071-0/+7
| | | | | | future use. MFC after: 2 weeks
* linux(4); Retire unnecessary __packed attribute from some struct'sDmitry Chagin2021-05-311-1/+1
| | | | | | | definition. Differential Revision: https://reviews.freebsd.org/D30482 MFC after: 2 weeks
* i386: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365072
* Centralize compatability translation macros.Brooks Davis2020-04-141-8/+1
| | | | | | | | | | | | | | | | Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h and replace existing definitation with includes where required. This eliminates duplicate code and allows Linux and FreeBSD compatability headers to be included in the same files. Input from: cem, jhb Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/head/; revision=359937
* Linuxulator depends on a fundamental kernel settings such as SMP. ManyDmitry Chagin2019-05-131-9/+0
| | | | | | | | | | | | | | | | | | | | | | of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Reviewed by: trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20178 Notes: svn path=/head/; revision=347538
* In order to reduce duplication between MD parts of the LinuxulatorDmitry Chagin2019-05-031-8/+0
| | | | | | | | | | | | | | | | | | | move bits that are MI out into the headers in compat/linux. For that remove bogus _packed attribute from struct l_sockaddr and use MI types for struct members. And continue to move into the linux_common module a code that is intended for both Linuxulator modules (both instruction set - 32 & 64 bit) or for external modules like linsysfs or linprocfs. To avoid header pollution introduce new sys/compat/linux_common.h header. Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20137 Notes: svn path=/head/; revision=347052
* Update syscall.master to 5.0.Dmitry Chagin2019-03-241-3/+3
| | | | | | | | | | | For 32-bit Linuxulator, ipc() syscall was historically the entry point for the IPC API. Starting in Linux 4.18, direct syscalls are provided for the IPC. Enable it. MFC after: 1 month Notes: svn path=/head/; revision=345471
* linuxulator: do not include legacy syscalls on arm64Ed Maste2018-06-151-0/+2
| | | | | | | | | | | | | | | | | Existing linuxulator platforms (i386, amd64) support legacy syscalls, such as non-*at ones like open, but arm64 and other new platforms do not. Wrap these in #ifdef LINUX_LEGACY_SYSCALLS, #defined in the MD linux.h files. We may need finer grained control in the future but this is sufficient for now. Reviewed by: andrew Sponsored by: Turing Robotic Industries Differential Revision: https://reviews.freebsd.org/D15237 Notes: svn path=/head/; revision=335201
* Rationalize license text on Linuxolator filesEd Maste2018-03-201-16/+13
| | | | | | | | | | | i386 linux.h missed in r330239. Approved by: sos MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=331234
* Rename linuxulator functions with linux_ prefixEd Maste2018-03-191-1/+1
| | | | | | | | | | It's preferable to have a consistent prefix. This also reduces differences between the three linux*_sysvec.c files. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=331226
* Linuxolator whitespace cleanupEd Maste2018-02-051-16/+16
| | | | | | | | | | | | | A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328890
* sys/i386: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326260
* Trying to be more compatible with Linux if.h definitions:Tai-hwa Liang2017-04-081-1/+2
| | | | | | | | | | | | | - renaming l_ifreq::ifru_metric to l_ifreq::ifru_ivalue; - adding a definition for ifr_ifindex which points to l_ifreq::ifru_ivalue. A quick search indicates that Linux already got the above changes since 2.1.14. Reviewed by: kib, marcel, dchagin MFC after: 1 week Notes: svn path=/head/; revision=316644
* To reduce code duplication move socket defines to the MI path.Dmitry Chagin2017-03-181-31/+0
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=315501
* Reduce code duplication between MD Linux code by moving SYSV IPC 64-bitDmitry Chagin2017-03-071-10/+0
| | | | | | | | | | | | | | | | | related struct definitions out into the MI path. Invert the native ipc structs to the Linux ipc structs convesion logic. Since 64-bit variant of ipc structs has more precision convert native ipc structs to the 64-bit Linux ipc structs and then truncate 64-bit values into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the values do not fit. Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit. MFC after: 1 month Notes: svn path=/head/; revision=314866
* Fix linux_fstatfs() to return proper value for f_frsize. Without it,Edward Tomasz Napierala2017-02-251-1/+3
| | | | | | | | | | | | linux df(1) binary from Xenial shows garbage. Reviewed by: dchagin MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9692 Notes: svn path=/head/; revision=314282
* Fix a copy/paste bug introduced during X86_64 Linuxulator work.Dmitry Chagin2016-07-101-7/+0
| | | | | | | | | | | | | | | | FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation use READ_IMPLIES_EXEC flag, introduced in r302515. While here move common part of mmap() and mprotect() code to the files in compat/linux to reduce code dupcliation between Linuxulator's. Reported by: Johannes Jost Meixner, Shawn Webb MFC after: 1 week XMFC with: r302515, r302516 Notes: svn path=/head/; revision=302517
* Revert r297310 as the SOL_XXX are equal to the IPPROTO_XX except SOL_SOCKET.Dmitry Chagin2016-03-271-1/+0
| | | | | | | Pointed out by: ae@ Notes: svn path=/head/; revision=297313
* iConvert Linux SOL_IPV6 level.Dmitry Chagin2016-03-271-0/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=297310
* 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
* Rework signal code to allow using it by other modules, like linprocfs:Dmitry Chagin2015-05-241-52/+1
| | | | | | | | | | | | | | | | | | | | 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-241-3/+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
* 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
* 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
* Add AT_RANDOM and AT_EXECFN auxiliary vector entries which are used byDmitry Chagin2015-05-241-1/+1
| | | | | | | | | 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
* Introduce a new module linux_common.ko which is intended for theDmitry Chagin2015-05-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Eliminate a now unused global declaration of elf_linux_sysvec.Dmitry Chagin2015-05-241-1/+0
| | | | | | | | Differential Revision: https://reviews.freebsd.org/D1061 Reviewed by: trasz Notes: svn path=/head/; revision=283408