aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
Commit message (Collapse)AuthorAgeFilesLines
* Fix handling of one more possible exception on return to usermode.Konstantin Belousov2017-07-081-4/+3
| | | | | | | | | | | | | | | | | | | If %ss is loaded with a segment pointing to a non-present descriptor by the IRETD instruction, a kernel-mode #SS exception is generated. Resulting T_STKFLT trap must be checked against doreti_iret_fault location and handled, otherwise userspace may panic the kernel. Note that this is i386 variant of FreeBSD-SA-15:21.amd64, but unlike amd64, there is no swapgs on i386 and the issue is arguably not exploitable. Reported by: Maxime Villard <max@m00nbsd.net> Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=320804
* Garbage collect kernel option TWA_FLASH_FIRMWARESean Bruno2017-07-031-1/+0
| | | | | | | | Submitted by: kevin.bowling0kev009.com Differential Revision: https://reviews.freebsd.org/D11387 Notes: svn path=/head/; revision=320613
* Add support for musl consumers to the Linuxulator.Dmitry Chagin2017-07-031-0/+13
| | | | | | | | | | | PR: 213809 Submitted by: Yonas Yanfa Reported by: Yonas Yanfa MFC after: 1 week Relnotes: yes Notes: svn path=/head/; revision=320595
* When "force" is specified to pmap_invalidate_cache_range(), the givenAlan Cox2017-07-011-1/+1
| | | | | | | | | | | | | | | start address is not required to be page aligned. However, the loop within pmap_invalidate_cache_range() that performs the actual cache line invalidations requires that the starting address be truncated to a multiple of the cache line size. This change corrects an error in that truncation. Submitted by: Brett Gutstein <bgutstein@rice.edu> Reviewed by: kib MFC after: 1 week Notes: svn path=/head/; revision=320546
* Clean up MD pollution of bus_dma.h:Jason A. Harmening2017-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --Remove special-case handling of sparc64 bus_dmamap* functions. Replace with a more generic mechanism that allows MD busdma implementations to generate inline mapping functions by defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>. This is currently useful for sparc64, x86, and arm64, which all implement non-load dmamap operations as simple wrappers around map objects which may be bus- or device-specific. --Remove NULL-checked bus_dmamap macros. Implement the equivalent NULL checks in the inlined x86 implementation. For non-x86 platforms, these checks are a minor pessimization as those platforms do not currently allow NULL maps. NULL maps were originally allowed on arm64, which appears to have been the motivation behind adding arm[64]-specific barriers to bus_dma.h, but that support was removed in r299463. --Simplify the internal interface used by the bus_dmamap_load* variants and move it to bus_dma_internal.h --Fix some drivers that directly include sys/bus_dma.h despite the recommendations of bus_dma(9) Reviewed by: kib (previous revision), marius Differential Revision: https://reviews.freebsd.org/D10729 Notes: svn path=/head/; revision=320528
* Fix indent.Konstantin Belousov2017-06-241-1/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=320307
* Correct translations between abridged and full x87 tags.Konstantin Belousov2017-06-171-3/+8
| | | | | | | | | Reported and tested by: karnajit wangkhem <karnajitw@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=320051
* Move struct syscall_args syscall arguments parameters container intoKonstantin Belousov2017-06-123-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | struct thread. For all architectures, the syscall trap handlers have to allocate the structure on the stack. The structure takes 88 bytes on 64bit arches which is not negligible. Also, it cannot be easily found by other code, which e.g. caused duplication of some members of the structure to struct thread already. The change removes td_dbg_sc_code and td_dbg_sc_nargs which were directly copied from syscall_args. The structure is put into the copied on fork part of the struct thread to make the syscall arguments information correct in the child after fork. This move will also allow several more uses shortly. Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks X-Differential revision: https://reviews.freebsd.org/D11080 Notes: svn path=/head/; revision=319873
* Make struct syscall_args visible to userspace compilation environmentKonstantin Belousov2017-06-121-7/+7
| | | | | | | | | | | | from machine/proc.h, consistently on all architectures. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 weeks X-Differential revision: https://reviews.freebsd.org/D11080 Notes: svn path=/head/; revision=319871
* Remove the BSD/OS 2.1 system call gate LDT entry.John Baldwin2017-05-231-4/+0
| | | | | | | | | | | | An extra copy of the system call gate was added to the default LDT back in 1996 (r18513 / r18514). However, the ability to run BSD/OS 2.1 i386 binaries under FreeBSD's native ABI is most likely no longer needed. Discussed with: kib Notes: svn path=/head/; revision=318761
* Remove register keyword from sys/ and ANSIfy prototypesEd Maste2017-05-1710-159/+67
| | | | | | | | | | | | | | | A long long time ago the register keyword told the compiler to store the corresponding variable in a CPU register, but it is not relevant for any compiler used in the FreeBSD world today. ANSIfy related prototypes while here. Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10193 Notes: svn path=/head/; revision=318389
* Use kmem_malloc() instead of malloc(9) for the native amd64 filter.Jung-uk Kim2017-04-171-2/+14
| | | | | | | | | | r316767 broke the BPF JIT compiler for amd64 because malloc()'d space is no longer executable. Discussed with: kib, alc Notes: svn path=/head/; revision=317072
* Move declarations for a machine-dependent function to the header file.Jung-uk Kim2017-04-171-2/+0
| | | | Notes: svn path=/head/; revision=317070
* Reduce diff with amd64 version.Jung-uk Kim2017-04-171-1/+1
| | | | Notes: svn path=/head/; revision=317069
* - Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeterGleb Smirnoff2017-04-174-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in place. To do per-cpu stats, convert all fields that previously were maintained in the vmmeters that sit in pcpus to counter(9). - Since some vmmeter stats may be touched at very early stages of boot, before we have set up UMA and we can do counter_u64_alloc(), provide an early counter mechanism: o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter. o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter, so that at early stages of boot, before counters are allocated we already point to a counter that can be safely written to. o For sparc64 that required a whole dummy pcpu[MAXCPU] array. Further related changes: - Don't include vmmeter.h into pcpu.h. - vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit, to match kernel representation. - struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion. This is based on benno@'s 4-year old patch: https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html Reviewed by: kib, gallatin, marius, lidl Differential Revision: https://reviews.freebsd.org/D10156 Notes: svn path=/head/; revision=317061
* Remove unused assembly symbols pointing to vmmeter.Gleb Smirnoff2017-04-171-3/+0
| | | | Notes: svn path=/head/; revision=317057
* Corrected misspelled versions of rendezvous.Patrick Kelsey2017-04-092-3/+3
| | | | | | | | | | | | The MFC will include a compat definition of smp_no_rendevous_barrier() that calls smp_no_rendezvous_barrier(). Reviewed by: gnn, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10313 Notes: svn path=/head/; revision=316648
* 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
* Adjust the constraint for "src" in atomic_(f)cmpset_8.Mark Johnston2017-03-271-6/+6
| | | | | | | | | | | "r" is not sufficient to prevent the use of invalid byte-width registers with at least gcc. Reported and reviewed by: bde X-MFC-With: r315718 Notes: svn path=/head/; revision=316031
* revert r315959 because it causes build problemsAndriy Gapon2017-03-272-31/+22
| | | | | | | | | | | | | The change introduced a dependency between genassym.c and header files generated from .m files, but that dependency is not specified in the make files. Also, the change could be not as useful as I thought it was. Reported by: dchagin, Manfred Antar <null@pozo.com>, and many others Notes: svn path=/head/; revision=316021
* Fix printing of negative offsets (typically from frame pointers) again.Bruce Evans2017-03-261-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I fixed this in 1997, but the fix was over-engineered and fragile and was broken in 2003 if not before. i386 parameters were copied to 8 other arches verbatim, mostly after they stopped working on i386, and mostly without the large comment saying how the values were chosen on i386. powerpc has a non-verbatim copy which just changes the uncritical parameter and seems to add a sign extension bug to it. Just treat negative offsets as offsets if they are no more negative than -db_offset_max (default -64K), and remove all the broken parameters. -64K is not very negative, but it is enough for frame and stack pointer offsets since kernel stacks are small. The over-engineering was mainly to go more negative than -64K for the negative offset format, without affecting printing for more than a single address. Addresses in the top 64K of a (full 32-bit or 64-bit) address space are now printed less well, but there aren't many interesting ones. For arches that have many interesting ones very near the top (e.g., 68k has interrupt vectors there), there would be no good limit for the negative offset format and -64K is a good as anything. Notes: svn path=/head/; revision=316001
* specific end of interrupt implementation for AMD Local APICAndriy Gapon2017-03-252-22/+31
| | | | | | | | | | | | | | | | | The change is more intrusive than I would like because the feature requires that a vector number is written to a special register. Thus, now the vector number has to be provided to lapic_eoi(). It was readily available in the IO-APIC and MSI cases, but the IPI handlers required more work. Also, we now store the VMM IPI number in a global variable, so that it is available to the justreturn handler for the same reason. Reviewed by: kib MFC after: 6 weeks Differential Revision: https://reviews.freebsd.org/D9880 Notes: svn path=/head/; revision=315959
* Implement Linux mincore() system call.Dmitry Chagin2017-03-251-1/+0
| | | | | | | | | | This is necessary for the upcoming drm-next. Suggested by: hselasky@ MFC after: 1 month Notes: svn path=/head/; revision=315957
* Remove buggy adjustment of page tables in db_write_bytes().Bruce Evans2017-03-241-52/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Long ago, perhaps only on i386, kernel text was mapped read-only and it was necessary to change the mapping to read-write to set breakpoints in kernel text. Other writes by ddb to kernel text were also allowed. This write protection is harder to implement with 4MB pages, and was lost even for 4K pages when 4MB pages were implemented. So changing the mapping became useless. It was actually worse than useless since it followed followed various null and otherwise garbage pointers to not change random memory instead of the mapping. (On i386s, the pointers became good in pmap_bootstrap(), and on amd64 the pointers became bad in pmap_bootstrap() if not before.) Another bug broke detection of following of null pointers on i386, except early in boot where not detecting this was a feature. When I fixed the bug, I accidentally broke the feature and soon got traps in db_write_bytes(). Setting breakpoints early in ddb was broken. kib pointed out that a clean way to do the adjustment would be to use a special [sub]map giving a small window on the bytes to be written. The trap handler didn't know how to fix up errors for pagefaults accessing the map itself. Such errors rarely need fixups, since most traps for the map are for the first access which is a read. Reviewed by: kib Notes: svn path=/head/; revision=315914
* Remove Solaris 2.6 syscalls selector.Gleb Smirnoff2017-03-231-1/+0
| | | | | | | Discussed with: kib Notes: svn path=/head/; revision=315867
* Stop providing the compat_3_brand.Ed Schouten2017-03-231-1/+0
| | | | | | | | | | As of r315860, the ELF image activator works fine for CloudABI without it. Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=315861
* Update r315753 with the proper flag name.Konstantin Belousov2017-03-221-1/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=315754
* Add a flag BI_BRAND_ONLY_STATIC to specify that the brand onlyKonstantin Belousov2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | matches static binaries. Interpretation of the 'static' there is that the binary must not specify an interpreter. In particular, shared objects are matched by the brand if BI_CAN_EXEC_DYN is also set. This improves precision of the brand matching, which should eliminate surprises due to brand ordering. Revert r315701. Discussed with and tested by: ed (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=315753
* Add support for 8- and 16-bit atomic_(f)cmpset to x86.Mark Johnston2017-03-221-37/+74
| | | | | | | | | Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10068 Notes: svn path=/head/; revision=315718
* Set the interpreter path to /nonexistent.Ed Schouten2017-03-221-0/+1
| | | | | | | | | | | | | | | | | | CloudABI executables are statically linked and don't have an interpreter. Setting the interpreter path to NULL used to work previously, but r314851 introduced code that checks the string unconditionally. Running CloudABI executables now causes a null pointer dereference. Looking at the rest of imgact_elf.c, it seems various other codepaths already leaned on the fact that the interpreter path is set. Let's just go ahead and pick an obviously incorrect interpreter path to appease imgact_elf.c. MFC after: 1 week Notes: svn path=/head/; revision=315701
* Implement getrandom() syscall.Dmitry Chagin2017-03-181-1/+0
| | | | | | | | | Note. GRND_RANDOM option is not supported for now. MFC after: 1 month Notes: svn path=/head/; revision=315505
* 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
* Don't access the reserved registers %dr4 and %dr5 on i386.Bruce Evans2017-03-173-45/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the original i386, %dr[4-5] were unimplemented but not very clearly reserved, so debuggers read them to print them. i386 was still doing this. On the original athlon64, %dr[4-5] are documented as reserved but are aliased to %dr[6-7] unless CR4_DE is set, when accessing them traps. On 2 of my systems, accessing %dr[4-5] trapped sometimes. On my Haswell system, the apparent randomness was because the boot CPU starts with CR4_DE set while all other CPUs start with CR4_DE clear. FreeBSD doesn't support the data breakpoints enabled by CR4_DE and it never changes this flag, so the flag remains different across CPUs and the behaviour seemed inconsistent except while booting when the CPU doesn't change. The invalid accesses broke: - read access for printing the registers in ddb "show watches" on CPUs with CR4_DE set - read accesses in fill_dbregs() on CPUs with CR4_DE set. This didn't implement panic(3) since the user case always skipped %dr[4-5]. - write accesses in set_dbregs(). This also didn't affect userland. When it didn't trap, the aliasing made it fragile. Don't print the dummy (zero) values of %dr[4-5] in "show watches" for i386 or amd64. Fix style bugs near this printing. amd64 also has space in the dbregs struct for the reserved %dr[8-15] and already didn't print the dummy values for these, and never accessed any of the 10 reserved debug registers. Remove cpufuncs for making the invalid accesses. Even amd64 had these. Notes: svn path=/head/; revision=315454
* Remove i915drm and radeondrm from NOTES and conf.Emmanuel Vadot2017-03-121-2/+0
| | | | | | | | | This unbreak LINT kernel. Reported by: lwhsu Notes: svn path=/head/; revision=315093
* Reduce code duplication between MD Linux code by moving SYSV IPC 64-bitDmitry Chagin2017-03-072-155/+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
* Regenerated Linuxulator syscall tables for r314782Mahdi Mokhtari2017-03-065-72/+8
| | | | | | | | Approved by: dchagin MFC after: 1 month Notes: svn path=/head/; revision=314783
* Add UNIMPLEMENTED() placeholder macro forMahdi Mokhtari2017-03-062-8/+22
| | | | | | | | | | | | | the syscalls that are not implemented in Linux kernel itself. Cleanup DUMMY() macros. Reviewed by: dchagin, trasz Approved by: dchagin MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9804 Notes: svn path=/head/; revision=314782
* Revert r314669, r314670:Pedro F. Giffuni2017-03-061-0/+1
| | | | | | | | | | | | | | | | Bring back the i486 option in GENERIC by default. The code related to i386 CPU variants configuration has received many changes in the last years: most of the features are detected automatically, so there are no performance penalties from keeping the 486 support enabled. Re-instate the 486 support: while the general configuration could still be cleaned a bit, there is no advantage in removing it. Differential Revision: https://reviews.freebsd.org/D9879 Notes: svn path=/head/; revision=314721
* Drop i486 from the default i386 GENERIC kernel configuration.Pedro F. Giffuni2017-03-041-1/+0
| | | | | | | | | | | | | | | | | 80486 production was stopped by Intel on September 2007. Dropping the 486 configuration option from the GENERIC kernel improves performance slightly. Removing I486_CPU is consistent at this time: we don't support any processor without a FPU and the PC-98 arch, which frequently involved i486 CPUs, is also gone so we don't test such platforms anymore. Relnotes: yes MFC after: 2 weeks https://reviews.freebsd.org/D9879 Notes: svn path=/head/; revision=314669
* Renumber copyright clause 4Warner Losh2017-02-2830-30/+30
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Initialize pcb_save for thread0.Konstantin Belousov2017-02-281-0/+1
| | | | | | | | | | | | | Otherwise kernel traps on NULL dereference if fpu_kern(9) is used from the thread0 context. Reported by: cem Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=314429
* Remove SVR4 (System V Release 4) binary compatibility support.Gleb Smirnoff2017-02-285-806/+0
| | | | | | | | UNIX System V Release 4 is operating system released in 1988. It ceased to exist in early 2000-s. Notes: svn path=/head/; revision=314373
* Regen for r314312 (Linux epoll_pwait).Dmitry Chagin2017-02-262-1/+6
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314313
* Change Linux epoll_pwait syscall definition to match Linux actual one.Dmitry Chagin2017-02-261-1/+2
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314312
* Refine the fix from r312954. Specifically, add a new PDE-only flag,Alan Cox2017-02-262-29/+41
| | | | | | | | | | | | | | PG_PROMOTED, that indicates whether lingering 4KB page mappings might need to be flushed on a PDE change that restricts or destroys a 2MB page mapping. This flag allows the pmap to avoid range invalidations that are both unnecessary and costly. Reviewed by: kib, markj MFC after: 6 weeks Differential Revision: https://reviews.freebsd.org/D9665 Notes: svn path=/head/; revision=314310
* Implement timerfd family syscalls.Dmitry Chagin2017-02-261-4/+0
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314295
* Regen after r314291 (timerfd definition).Dmitry Chagin2017-02-263-9/+70
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314292
* Change Linuxulator timerfd syscalls definition to match actual Linux one.Dmitry Chagin2017-02-261-3/+6
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314291
* 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
* Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.Mahdi Mokhtari2017-02-241-3/+0
| | | | | | | | | | Reviewed by: dchagin Approved by: dchagin, trasz (src committers) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9722 Notes: svn path=/head/; revision=314219