aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/linux
Commit message (Collapse)AuthorAgeFilesLines
* linuxolator: fix nosys() to not send SIGSYSKonstantin Belousov2023-10-091-1/+1
| | | | (cherry picked from commit 7acc4240ce00af540093b47ad00be0508310b515)
* sys: Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 78d146160dc5)
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-232-2/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 031beb4e239b)
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-235-10/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-235-5/+0
| | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 2ff63af9b88c)
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-234-8/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 95ee2897e98f)
* linux(4): Add elf_hwcap2 to x86Dmitry Chagin2023-08-111-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 (cherry picked from commit 4281dab8bc11b3b2f3b58be5e0f67806329bddae)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-255-5/+5
| | | | | | | | | | | 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 (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* linux(4): Preserve fpu xsave state across signal delivery on amd64Dmitry Chagin2023-06-291-4/+95
| | | | | | | | | PR: 270247 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40444 MFC after: 2 weeks (cherry picked from commit cbbac560911521c0ded3e06e713107176855fae4)
* linux(4): In preparation for xsave refactor fxsave code on amd64Dmitry Chagin2023-06-291-57/+69
| | | | | | | | | | | Due to fxsave area is os independent reimplement fxsave handmade code using copying of a whole area. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40443 MFC after: 2 weeks (cherry picked from commit 920184ed6e43b19f4b71253b55fd3ba66a7f0bb2)
* linux(4) rt_sendsig: Remove the use of caddr_tDmitry Chagin2023-06-291-4/+4
| | | | | | | | Replace caddr_t by more appropriate char *. MFC after: 2 weeks (cherry picked from commit 84617f6fccd45505f3eeebad1c8cdce1140b7f8e)
* linux(4): Fix stack unwinding across signal frame on x86_64Dmitry Chagin2023-06-291-2/+0
| | | | | | | | | | Get rid of using register numbers which is undefined in libunwind on x86_64. Differential Revision: https://reviews.freebsd.org/D40156 MFC after: 1 month (cherry picked from commit 78c2e58fa5b0aa4518d79d8155c0513b9a04f531)
* linux(4): Preserve %rcx (return address) like a Linux doDmitry Chagin2023-06-291-0/+2
| | | | | | | | | | | | | | Perhaps, this does not makes much sense as destroyng %rcx declared by the x86_64 Linux syscall ABI. However,: a) if we get a signal while we are in the kernel, we should restore tf_rcx when preparing machine context for signal handlers. b) the Linux world is strange, someone can depend on %rcx value after syscall, something like go. Differential Revision: https://reviews.freebsd.org/D40155 MFC after: 1 month (cherry picked from commit 037b60fb0fbcb2dd6b6cbb632b05a2939ff4ff29)
* linux(4): Simplify %r10 restoring on amd64Dmitry Chagin2023-06-292-9/+3
| | | | | | | | | Restore %r10 at system call entry to avoid doing this multiply times. Differential Revision: https://reviews.freebsd.org/D40154 MFC after: 1 month (cherry picked from commit 185bd9fa3096595350ebe7bcd7e0ddcf17773030)
* linux(4): Add a comment explaining registers at syscall entry point on amd64Dmitry Chagin2023-06-291-0/+17
| | | | | | | Differential Revision: https://reviews.freebsd.org/D40153 MFC after: 1 month (cherry picked from commit a463dd810851fdae5efcb8f8205d742ebf221bc8)
* linux(4): Drop a weird comment from linux_set_syscall_retval on amd64Dmitry Chagin2023-06-291-3/+0
| | | | | | | | | | | I agree, it would be great to avoid PCB_FULL_IRET, however we should follow Linux system call ABI. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40152 MFC after: 1 month (cherry picked from commit a99b890ecd26131e0c91e5693b55f5700c40a847)
* linux(4): Implement ptrace_pokeusr for x86_64Dmitry Chagin2023-06-291-3/+70
| | | | | | | Differential Revision: https://reviews.freebsd.org/D40097 MFC after: 1 week (cherry picked from commit 1d76741520c031730319ed976a6c394213991504)
* linux(4): Make ptrace_pokeusr machine dependentDmitry Chagin2023-06-292-0/+10
| | | | | | | Differential Revision: https://reviews.freebsd.org/D40096 MFC after: 1 week (cherry picked from commit 3d0addcd35193461e927db6cfe4b6d9b579eed6b)
* linux(4): Make ptrace_peekusr machine dependendDmitry Chagin2023-06-292-0/+33
| | | | | | | | | And partially implement it for x86_64. Differential Revision: https://reviews.freebsd.org/D40095 MFC after: 1 week (cherry picked from commit dd2a6cd701aea5a6ced59b9947e087304f7d7238)
* linux(4): Regen for mknod syscall changesDmitry Chagin2023-06-292-6/+6
| | | | (cherry picked from commit cd0fca82bb86e9287d7eacefead1b02766986762)
* linux(4): Use Linux dev_t type for mknod syscalls dev argumentDmitry Chagin2023-06-291-2/+2
| | | | | | | | | | | | | | As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer on all platforms. Prior the 2.6 kernel dev_t type was an unsigned short. However, since the firs commit of the Linuxulator, mknod syscall get int dev argument. Also, there is some confusion here, while the kernel declares a dev_t type as a 32-bit sized, the user-space dev_t type can be size of 64 bits, e.g., in the Glibc library. To avoid confusion and to help porting of the Linuxulator to other platforms use explicit l_dev_t for dev argument of mknod syscalls. (cherry picked from commit ca3333dd4a3bef7b615d5df104c525f8cac51b26)
* linux(4): Move dev_t type declaration under /compat/linuxDmitry Chagin2023-06-291-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. (cherry picked from commit 19973638bee2205be2a7eb07bc154b8afb1e44a3)
* linux(4): Make struct newstat to match actual Linux oneDmitry Chagin2023-06-291-3/+3
| | | | | | In the struct stat the st_dev, st_rdev are unsigned long. (cherry picked from commit e0bfe0d62ca708c8c6173296cc05f6bbfb79b2ee)
* linux(4): Fix LINUX_AT_COUNT commentsDmitry Chagin2023-06-291-1/+4
| | | | | | | Differential Revision: https://reviews.freebsd.org/D39645 MFC after: 1 month (cherry picked from commit 56c5230afdcf2b317d904009abe577e91b382542)
* linux(4): Deduplicate linux_copyout_auxargs()Dmitry Chagin2023-06-292-46/+10
| | | | | | | | | | 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 (cherry picked from commit 7d8c98398302b939b97310d31883ebdab8c0b938)
* linux(4): Regen for close_range syscallDmitry Chagin2023-06-293-4/+26
| | | | | | MFC after: 2 weeks (cherry picked from commit 50111714f5a46add66264d48456c32b7d3d0036a)
* linux(4): Modify close_range syscall to match LinuxDmitry Chagin2023-06-291-2/+6
| | | | | | MFC after: 2 weeks (cherry picked from commit 1c27dce1f8979e7bbe3ca51f4f2db38b202042a0)
* linux(4): Rename linux_timer.h to linux_time.hDmitry Chagin2023-03-011-1/+1
| | | | | | | | | | | To avoid confusing people, rename linux_timer.h to linux_time.h, as linux_timer.c is the implementation of timer syscalls only, while linux_time.c contains implementation of all stuff declared in linux_time.h. MFC after: 2 weeks (cherry picked from commit c8a79231a5a74fc4263ec3d18c6519a974efb529)
* linux(4): Cleanup includes under amd64/linuxDmitry Chagin2023-03-014-34/+4
| | | | | | | | | Cleanup unneeded includes, sort the rest according to style(9). No functional changes. MFC after: 2 weeks (cherry picked from commit 2456a45929328ce73a40ef6577600b0f1e2cced6)
* linux(4): Cleanup vm includes from linux_util.hDmitry Chagin2023-03-011-0/+1
| | | | | | | | | | Include vm headers directly where they needed. The linux_util.h included in a most source files of the Linuxulator, avoid collecting a rarely used includes here. MFC after: 2 weeks (cherry picked from commit 31e938c531dcbb708dbcd0e1d0a4ea80dcc82300)
* linux(4): Remove stale comment that no longer applies.Dmitry Chagin2023-02-091-2/+0
| | | | | | MFC after: 1 week (cherry picked from commit ce20c00e858f209f42d404eca597553e461e0892)
* linux(4): Microoptimize rt_sendsig() on amd64.Dmitry Chagin2023-02-091-17/+17
| | | | | | | | | | | Drop proc lock earlier, before copying user stuff. Pointed out by: kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38326 MFC after: 1 week (cherry picked from commit 6ad07a4b2bdf0856545ff8495a7b3396695814fa)
* linux(4): Preserve fpu fxsave state across signal delivery on amd64.Dmitry Chagin2023-02-091-6/+64
| | | | | | | | | PR: 240768 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38302 MFC after: 1 week (cherry picked from commit a95cb95e12e537dbe70f9de18cc0fe98e4a5ebf5)
* linux(4): Deduplicate linux_trans_osrel().Dmitry Chagin2023-02-091-29/+2
| | | | | | MFC after: 1 week (cherry picked from commit 95b8603427d5759c5d6090ffaacfaf7f3b8fb926)
* linux(4): Deduplicate linux_copyout_strings().Dmitry Chagin2023-02-091-129/+1
| | | | | | | | It is still present in the 32-bit Linuxulator on amd64. MFC after: 1 week (cherry picked from commit 6039e966ff276ff6bcb57f2f70e7d8ff376b24fd)
* linux(4): Deduplicate linux_fixup_elf().Dmitry Chagin2023-02-091-17/+1
| | | | | | | | | Use native routines to fixup initial process stack. On Arm64 linux_elf_fixup() is noop, as it do the stack fixup (room for argc) in the linux_copyout_strings(). MFC after: 1 week (cherry picked from commit 9e550625f867a23ea3d87a77aa3c216b79ecd790)
* linux(4): Microoptimize linux_elf.h for future use.Dmitry Chagin2023-02-091-0/+1
| | | | | | | | | In order to reduce code duplication move coredump support definitions into the appropriate header and hide private definitions. MFC after: 1 week (cherry picked from commit 7446514533a40b376eaeb349ea33531ce9c711c2)
* linux(4): Deduplicate MI futex structures.Dmitry Chagin2023-02-091-11/+0
| | | | | | MFC after: 1 week (cherry picked from commit 575e48f1c4eb05fe8df6aaeb5f55e17c63a02639)
* linux: populate sv_syscallnames in each sysentvecMitchell Horne2022-11-061-1/+2
| | | | | | | | | | | | | | This allows the syscallname() function to give a usable result for Linux ABIs. Reported by: jrtc27 Reviewed by: jrtc27, markj, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37199 (cherry picked from commit 1da65dcb1c57fae7be75ddf1bd300ddf19ced850) (cherry picked from commit f396f9b6c96f6d68d4e3606ddb090287230fc565)
* linux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraintDmitry Chagin2022-07-061-0/+2
| | | | | | MFC after: 2 weeks (cherry picked from commit d416ee86c73bef55ba29c25cd594156441f1daa9)
* linux(4): Properly build argument list for the signal handlerDmitry Chagin2022-06-171-12/+16
| | | | | | | | Provide arguments 2 and 3 if signal handler installed with SA_SIGINFO. MFC after: 2 weeks (cherry picked from commit 109fd18ad96957c25cfaa78da2f825c729e33fef)
* linux(4): Microoptimize rt_sendsig(), convert signal mask onceDmitry Chagin2022-06-171-1/+1
| | | | | | | | | | On amd64 Linux saves the thread signal mask in both contexts, in the machine dependent and in the machine independent. Both contexts are user accessible. Convert the mask once, then copy it. MFC after: 2 weeks (cherry picked from commit c30a767c6fd6d3f19e897fb800513e75175249b9)
* linux(4): Avoid direct manipulation of td_sigmaskDmitry Chagin2022-06-171-5/+3
| | | | | | | | | Use kern_sigprocmask() instead of direct manipulation of td_sigmask to reschedule newly blocked signals. MFC after: 2 weeks (cherry picked from commit 2ab9b59faafb68402dbebc285b424cfb06b59cf3)
* linux(4): Reduce duplication between MD parts of the LinuxulatorDmitry Chagin2022-06-171-5/+0
| | | | | | | | | Move sigprocmask actions defines under compat/linux, they are identical across all Linux architectures. MFC after: 2 weeks (cherry picked from commit 2ca34847e7288fba6b2a15e64648238bc12e4960)
* linux(4): Deduplicate execveDmitry Chagin2022-06-171-27/+0
| | | | | | | | | | As linux_execve is common across archs, except amd64 32-bit Linuxulator, move it under compat/linux. Noted by: andrew@ MFC after: 2 weeks (cherry picked from commit 26700ac0c4d0466c00f944bde9613d18625d1f91)
* linux(4): Deduplicate bsd_to_linux_trapcode()Dmitry Chagin2022-06-171-39/+0
| | | | | | | | | As bsd_to_linux_trapcode() is common for x86 Linuxulators, move it under x86/linux. MFC after: 2 weeks (cherry picked from commit 9016ec056ae3896522798ead39bb2f3ff4f68809)
* linux(4): Deduplicate translate_traps()Dmitry Chagin2022-06-171-23/+0
| | | | | | | | | As translate_traps() is common for x86 Linuxulators, move it under x86/linux. MFC after: 2 weeks (cherry picked from commit 2434137f690dabc35586ab45fc4c4ecc5b71184f)
* Retire sv_transtrapDmitry Chagin2022-06-171-2/+1
| | | | | | | | Call translate_traps directly from sendsig(). MFC after: 2 weeks (cherry picked from commit eca368ecb6e00e9db7e1c090e98a29439d255895)
* linux(4): Retire handmade DWARF annotations from signal trampolinesDmitry Chagin2022-06-172-37/+74
| | | | | | | | | | | | | | | | | The Linux exports __kernel_sigreturn and __kernel_rt_sigreturn from the vdso. Modern glibc's sigaction sets the sa_restorer field of sigaction to the corresponding vdso __sigreturn, and sets the SA_RESTORER. Our signal trampolines uses the FreeBSD-way to call a signal handler, so does not use the sigaction's sa_restorer. However, as glibc's runtime linker depends on the existment of the vdso __sigreturn symbols, for all Linuxulators was added separate trampolines named __sigcode with DWARF anotations and left separate __sigreturn methods, which are exported. MFC after: 2 weeks (cherry picked from commit 8f9635dc99f571a0ae4e613b9a0439e68da7b160)
* linux(4): Better naming for ucontext field of struct rt_sigframeDmitry Chagin2022-06-172-29/+29
| | | | | | | | | To reduce sendsig code difference and to avoid confusing me, rename sf_sc to sf_uc to match the content. MFC after: 2 weeks (cherry picked from commit 6e826d27c340fa29e166d06e5d8553f6c63c409e)