summaryrefslogtreecommitdiffstats
path: root/sys/amd64
Commit message (Collapse)AuthorAgeFilesLines
* fix missing variable in r298736avg2016-04-281-0/+1
| | | | | | | Pointyhat to: avg Reported by: Ivan Klymenko <fidaj@ukr.net> MFC after: 2 weeks X-MFC with: r298736
* ensure that initial local apic id is sane on AMD 10h systemsavg2016-04-281-0/+13
| | | | | | | | | | | | | | | | Summary: The Initial Local APIC ID is returned by CPUID function 1 (in EBX). On AMD Family 10h systems the way that ID is built is controlled by an MSR bit (InitApicIdCpuIdLo). BKDG instructs BIOS to set it in a certain way, but a BIOS can be buggy. In that case the ID can confuse tools that use it, e.g. hwloc. For example, on a system that I own real Local APIC IDs are configured as 0, 1, 2, 3, but IDs reported via CPUID.1 are 0, 0x40, 0x80, 0xc0. See: https://github.com/open-mpi/hwloc/issues/183 Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6060
* AMD64 pmap: Use howmany() macrocem2016-04-241-1/+1
| | | | | | Use param.h howmany() instead of hand-rolled version. Sponsored by: EMC / Isilon Storage Division
* Cleanup redundant parenthesis from existing howmany()/roundup() macro uses.pfg2016-04-223-3/+3
|
* sys: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-212-2/+2
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
* X86: use our nitems() macro when it is avaliable through param.h.pfg2016-04-194-5/+5
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* Add 4Kn kernel dump supportcem2016-04-151-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | (And 4Kn minidump support, but only for amd64.) Make sure all I/O to the dump device is of the native sector size. To that end, we keep a native sector sized buffer associated with dump devices (di->blockbuf) and use it to pad smaller objects as needed (e.g. kerneldumpheader). Add dump_write_pad() as a convenience API to dump smaller objects with zero padding. (Rather than pull in NPM leftpad, we wrote our own.) Savecore(1) has been updated to deal with these dumps. The format for 512-byte sector dumps should remain backwards compatible. Minidumps for other architectures are left as an exercise for the reader. PR: 194279 Submitted by: ambrisko@ Reviewed by: cem (earlier version), rpokala Tested by: rpokala (4Kn/512 except 512 fulldump), cem (512 fulldump) Relnotes: yes Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5848
* hyperv: Deprecate HYPERV option by moving Hyper-V IDT vector into vmbussephe2016-04-153-19/+0
| | | | | | | Submitted by: Jun Su <junsu microsoft com> Reviewed by: jhb, kib, sephe Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5910
* Expose doreti as a global symbol on amd64 and i386.jhb2016-04-131-0/+1
| | | | | | | | | | doreti provides the common code path for returning from interrupt andlers on x86. Exposing doreti as a global symbol allows kernel modules to include low-level interrupt handlers instead of requiring all low-level handlers to be statically compiled into the kernel. Submitted by: Howard Su <howard0su@gmail.com> Reviewed by: kib
* Enable DEVICE_NUMA with up to 8 domains by default on amd64.jhb2016-04-123-1/+3
| | | | | | | | | 8 memory domains should handle a quad-socket board with dual-domain processors. Reviewed by: kib Relnotes: maybe? Differential Revision: https://reviews.freebsd.org/D5893
* re-enable AMD Topology extension on certain models if disabled by BIOSavg2016-04-121-1/+1
| | | | | | | | | | | | | Some BIOSes disable AMD Topology extension on AMD Family 15h notebook processors. We re-enable the extension, so that we can properly discover core and cache topology. Linux seems to do the same. Reported by: Johannes Dieterich <dieterich.joh@gmail.com> Reviewed by: jhb, kib Tested by: Johannes Dieterich <dieterich.joh@gmail.com> (earlier version) MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D5883
* [amd64] dtrace_invop handler is to be called only for kernel exceptionsavg2016-04-121-0/+2
| | | | | | | | | | | | DTrace-related exceptions in userland code are handled elsewhere. One practical problem was a crash in dtrace_invop_start() when saved %rsp pointed to a virtual address that was not backed. i386 code already ignored userland exceptions. Reviewed by: markj, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D5906
* Allow guest writes to AMD microcode update[0xc0010020] MSR without updating ↵anish2016-04-111-0/+5
| | | | | | | | actual hardware MSR. This allows guest microcode update to go through which otherwise failing because wrmsr() was returning EINVAL. Submitted by:Yamagi Burmeister Approved by:grehan MFC after:2 weeks
* Make CloudABI's way of doing TLS more friendly to userspace emulators.ed2016-04-061-4/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic: - CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS. - If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0. As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area. Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836
* Add kern.features flags for linux and linux64 modulesbapt2016-04-052-0/+2
| | | | | | | | | | | | | kern.features.linux: 1 meaning linux 32 bits binaries are supported kern.features.linux64: 1 meaning linux 64 bits binaries are supported The goal here is to help 3rd party applications (including ports) to determine if the host do support linux emulation Reviewed by: dchagin MFC after: 1 week Relnotes: yes Differential Revision: D5830
* Move i386/i386/autoconf.c to sys/x86/x86 and use it on both amd64 and i386.jhb2016-04-031-125/+0
|
* Make Position Independent Executables work for CloudABI.ed2016-03-311-0/+1
| | | | | | | - Set BI_CAN_EXEC_DYN, so we can execute ET_DYN ELF files in addition to regular ET_EXECs. - Provide an AT_BASE entry in the auxiliary vector, so the executable knows at which address it got loaded and can apply relocations.
* Type of the interrupt handlers on x86 cannot be expressed in C.kib2016-03-292-4/+1
| | | | | | | | Simplify and unify placeholder type definitions. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5771
* Revert r297310 as the SOL_XXX are equal to the IPPROTO_XX except SOL_SOCKET.dchagin2016-03-272-2/+0
| | | | Pointed out by: ae@
* iConvert Linux SOL_IPV6 level.dchagin2016-03-272-0/+2
| | | | MFC after: 1 week
* Polish wbwd(4) driver and add more supported chips.mav2016-03-241-1/+0
| | | | MFC after: 1 month
* Enable interrupts on the BSP once all PICs are initialized.jhb2016-03-241-7/+0
| | | | | | | | | | | | This moves the enabling of interrupts slightly earlier (the old location was still before devices were enumerated and probed) and does it in the interrupt code (rather than in the device configuration code). This also avoids tripping over an assertion on the first TLB shootdown with earlier AP startup. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D5710
* Regen for r297061 (fstatfs64 Linux syscall).dchagin2016-03-205-7/+29
| | | | MFC after: 1 week
* Implement fstatfs64 system call.dchagin2016-03-202-2/+1
| | | | | | PR: 181012 Submitted by: John Wehle MFC after: 1 week
* Due to invalid use of a signed intermediate value in the bounds checkingglebius2016-03-161-2/+2
| | | | | | | | | during argument validity verification, unbound zero'ing of the process LDT and adjacent memory can be initiated from usermode. Submitted by: CORE Security Patch by: kib Security: SA-16:15
* The PKRU state size is 4 bytes, its support makes the XSAVE area sizekib2016-03-151-3/+4
| | | | | | | | | | | | | | | | non-multiple of 64 bytes. Thereafter, the user state save area is misaligned, which triggers assertion in the debugging kernels, or segmentation violation on accesses for non-debugging configs. Force the desired alignment of the user save area as the fix (workaround is to disable bit 9 in the hw.xsave_mask loader tunable). This correction is required for booting on the upcoming Intel' Purley platform. Reported and tested by: "Pieper, Jeffrey E" <jeffrey.e.pieper@intel.com>, jimharris Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Fix reporting of the CloudABI ABI in kdump.jhb2016-03-091-1/+1
| | | | | | | | | | | | - Advertise the word size for CloudABI ABIs via the SV_LP64 flag. All of the other ABIs include either SV_ILP32 or SV_LP64. - Fix kdump to not assume a 32-bit ABI if the ABI flags field is non-zero but SV_LP64 isn't set. Instead, only assume a 32-bit ABI if SV_ILP32 is set and fallback to the unknown value of "00" if neither SV_LP64 nor SV_ILP32 is set. Reviewed by: kib, ed Differential Revision: https://reviews.freebsd.org/D5560
* Bump VM_MAX_MEMSEGS from 2 to 3 to match the number of VM segmentmarcel2016-02-261-1/+1
| | | | | identifiers present in vmmapi.h. In particular, it's now possible to create a VM_FRAMEBUFFER segment.
* Return dst as the result from memcpy(9) on amd64.kib2016-02-241-0/+1
| | | | | PR: 207422 MFC after: 1 week
* As <machine/vm.h> is included from <vm/vm.h>, there is no need toskra2016-02-221-1/+0
| | | | | | | include it explicitly when <vm/vm.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5380
* As <machine/vmparam.h> is included from <vm/vm_param.h>, there is noskra2016-02-222-2/+0
| | | | | | | | need to include it explicitly when <vm/vm_param.h> is already included. Suggested by: alc Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D5379
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toskra2016-02-223-4/+0
| | | | | | | include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373
* Include sys/_task.h into uma_int.h, so that taskqueue.h isn't aglebius2016-02-091-1/+0
| | | | | | requirement for uma_int.h. Suggested by: jhb
* Redo r292484. Embed task(9) into zone, so that uz_maxaction is calledglebius2016-02-031-0/+1
| | | | | | | in a context that can sleep, allowing consumers of the KPI to run their drain routines without any extra measures. Discussed with: jtl
* Convert ss_sp in stack_t and sigstack to void *.jhb2016-01-274-7/+7
| | | | | | | | | | | | POSIX requires these members to be of type void * rather than the char * inherited from 4BSD. NetBSD and OpenBSD both changed their fields to void * back in 1998. No new build failures were reported via an exp-run. PR: 206503 (exp-run) Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5092
* Implement AT_SECURE properly.delphij2016-01-272-2/+6
| | | | | | | | | | | AT_SECURE auxv entry has been added to the Linux 2.5 kernel to pass a boolean flag indicating whether secure mode should be enabled. 1 means that the program has changes its credentials during the execution. Being exported AT_SECURE used by glibc issetugid() call. Submitted by: imp, dchagin Security: FreeBSD-SA-16:10.linux Security: CVE-2016-1883
* Remove obsolete comment.dchagin2016-01-231-1/+0
| | | | MFC after: 3 days
* Fix a typo.dchagin2016-01-231-2/+2
| | | | MFC after: 3 days
* Add missing atomic wrapper macro.hselasky2016-01-211-0/+1
| | | | | | Reviewed by: alfred @ Sponsored by: Mellanox Technologies MFC after: 1 week
* Use ANSI definitions. Wrap long line.kib2016-01-191-3/+4
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Clear whole XMM register file instead of only XMM0. Also clear x87kib2016-01-191-6/+8
| | | | | | | | | | | | | registers. This brings amd64 on par with i386, providing consistent initial FPU state. Note that we do not clear any extended state, at least because kernel does not understand extended state structure and consequences of zero overwrite after fninit()/fpusave(). Submitted by: joss.upton@yahoo.com PR: 206370 MFC after: 2 weeks
* Regen after r293907.glebius2016-01-1410-14/+14
|
* Change linux get_robust_list system call to match actual linux one.glebius2016-01-142-4/+4
| | | | | | | | | | | | | | | | | | | | | The set_robust_list system call request the kernel to record the head of the list of robust futexes owned by the calling thread. The head argument is the list head to record. The get_robust_list system call should return the head of the robust list of the thread whose thread id is specified in pid argument. The list head should be stored in the location pointed to by head argument. In contrast, our implemenattion of get_robust_list system call copies the known portion of memory pointed by recorded in set_robust_list system call pointer to the head of the robust list to the location pointed by head argument. So, it is possible for a local attacker to read portions of kernel memory, which may result in a privilege escalation. Submitted by: mjg Security: SA-16:03.linux
* Remove dead code when the target processor has POPCNT instruction.jkim2016-01-131-1/+4
|
* Implement vsyscall hack. Prior to 2.13 glibc uses vsyscalldchagin2016-01-094-1/+59
| | | | | | | | | instead of vdso. An upcoming linux_base-c6 needs it. Differential Revision: https://reviews.freebsd.org/D1090 Reviewed by: kib, trasz MFC after: 1 week
* Move amd64 metadata.h to x86 and share with i386emaste2016-01-071-54/+3
| | | | MFC after: 1 week
* Make the 'env' directive described in config(5) work on all architectures,ian2016-01-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | providing compiled-in static environment data that is used instead of any data passed in from a boot loader. Previously 'env' worked only on i386 and arm xscale systems, because it required the MD startup code to examine the global envmode variable and decide whether to use static_env or an environment obtained from the boot loader, and set the global kern_envp accordingly. Most startup code wasn't doing so. Making things even more complex, some mips startup code uses an alternate scheme that involves calling init_static_kenv() to pass an empty buffer and its size, then uses a series of kern_setenv() calls to populate that buffer. Now all MD startup code calls init_static_kenv(), and that routine provides a single point where envmode is checked and the decision is made whether to use the compiled-in static_kenv or the values provided by the MD code. The routine also continues to serve its original purpose for mips; if a non-zero buffer size is passed the routine installs the empty buffer ready to accept kern_setenv() values. Now if the size is zero, the provided buffer full of existing env data is installed. A NULL pointer can be passed if the boot loader provides no env data; this allows the static env to be installed if envmode is set to do so. Most of the work here is a near-mechanical change to call the init function instead of directly setting kern_envp. A notable exception is in xen/pv.c; that code was originally installing a buffer full of preformatted env data along with its non-zero size (like mips code does), which would have allowed kern_setenv() calls to wipe out the preformatted data. Now it passes a zero for the size so that the buffer of data it installs is treated as non-writeable.
* Move shared variables from {amd64,i386}/initcpu.c to x86/identcpu.c.jhb2015-12-232-44/+2
| | | | | | | | While here, move the common bits of <machine/cputypes.h> to <x86/cputypes.h> as well. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D4670
* Remove redundant ctx_switch_xsave declaration in sys/amd64/include/md_var.hngie2015-12-221-1/+0
| | | | | | | | | | | | This variable was added to sys/x86/include/x86_var.h recently. This unbreaks building kernel source that #includes both md_var.h and x86_var.h with gcc 4.2.1 on amd64 Differential Revision: https://reviews.freebsd.org/D4686 Reviewed by: kib X-MFC with: r291949 Sponsored by: EMC / Isilon Storage Division
* Save the physical address passed into the kernel of the UEFI systemimp2015-12-191-0/+9
| | | | table.
OpenPOWER on IntegriCloud