summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/fpu.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement an API to allow a hypervisor to save/restoregrehan2012-12-121-0/+5
| | | | | | | | | | | | | guest floating point state without having to know the size of floating-point state. Unstaticize fpurestore to allow the hypervisor to save/restore guest state using fpusave/fpurestore on the allocated FPU state area. Reviewed by: kib Obtained from: NetApp/bhyve MFC after: 1 week
* On AMD64, provide siginfo.si_code for floating point errors when errorkib2012-07-181-1/+2
| | | | | | | | | | | | | | occurs using the SSE math processor. Update comments describing the handling of the exception status bits in coprocessors control words. Remove GET_FPU_CW and GET_FPU_SW macros which were used only once. Prefer to use curpcb to access pcb_save over the longer path of referencing pcb through the thread structure. Based on the submission by: Ed Alley <wea llnl gov> PR: amd64/169927 Reviewed by: bde MFC after: 3 weeks
* Move userland bits of i386 npx.h and amd64 fpu.h to x86 fpu.h.tijl2012-03-161-84/+1
| | | | | | | | | | | | | | Remove FPU types from compat/ia32/ia32_reg.h that are no longer needed. Create machine/npx.h on amd64 to allow compiling i386 code that uses this header. The original npx.h and fpu.h define struct envxmm differently. Both definitions have been included in the new x86 header as struct __envxmm32 and struct __envxmm64. During compilation either __envxmm32 or __envxmm64 is defined as envxmm depending on machine architecture. On amd64 the i386 struct is also available as struct envxmm32. Reviewed by: kib
* Add support for the extended FPU states on amd64, both for nativekib2012-01-211-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 64bit and 32bit ABIs. As a side-effect, it enables AVX on capable CPUs. In particular: - Query the CPU support for XSAVE, list of the supported extensions and the required size of FPU save area. The hw.use_xsave tunable is provided for disabling XSAVE, and hw.xsave_mask may be used to select the enabled extensions. - Remove the FPU save area from PCB and dynamically allocate the (run-time sized) user save area on the top of the kernel stack, right above the PCB. Reorganize the thread0 PCB initialization to postpone it after BSP is queried for save area size. - The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as well. FPU state is only useful for suspend, where it is saved in dynamically allocated suspfpusave area. - Use XSAVE and XRSTOR to save/restore FPU state, if supported and enabled. - Define new mcontext_t flag _MC_HASFPXSTATE, indicating that mcontext_t has a valid pointer to out-of-struct extended FPU state. Signal handlers are supplied with stack-allocated fpu state. The sigreturn(2) and setcontext(2) syscall honour the flag, allowing the signal handlers to inspect and manipilate extended state in the interrupted context. - The getcontext(2) never returns extended state, since there is no place in the fixed-sized mcontext_t to place variable-sized save area. And, since mcontext_t is embedded into ucontext_t, makes it impossible to fix in a reasonable way. Instead of extending getcontext(2) syscall, provide a sysarch(2) facility to query extended FPU state. - Add ptrace(2) support for getting and setting extended state; while there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries. - Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to consumers, making it opaque. Internally, struct fpu_kern_ctx now contains a space for the extended state. Convert in-kernel consumers of fpu_kern KPI both on i386 and amd64. First version of the support for AVX was submitted by Tim Bird <tim.bird am sony com> on behalf of Sony. This version was written from scratch. Tested by: pho (previous version), Yamagi Burmeister <lists yamagi org> MFC after: 1 month
* Add definitions for the FPU extended state header, legacy extendedkib2012-01-171-0/+22
| | | | | | state and AVX state. MFC after: 1 week
* Modernize the fpusave structures definitions by using uint*_t types.kib2012-01-171-13/+18
| | | | MFC after: 1 week
* Remove npxgetregs(), npxsetregs(), fpugetregs() and fpusetregs()kib2010-11-261-3/+2
| | | | | | | | | | | | | | | | functions, they are unused. Remove 'user' from npxgetuserregs() etc. names. For {npx,fpu}{get,set}regs(), always use pcb->pcb_user_save for FPU context storage. This eliminates the need for ugly copying with overwrite of the newly added and reserved fields in ucontext on i386 to satisfy alignment requirements for fpusave() and fpurstor(). pc98 version was copied from i386. Suggested and reviewed by: bde Tested by: pho (i386 and amd64) MFC after: 1 week
* Introduce the x86 kernel interfaces to allow kernel code to usekib2010-06-051-0/+24
| | | | | | | | | | | | | | | | FPU/SSE hardware. Caller should provide a save area that is chained into the stack of the areas; pcb save_area for usermode FPU state is on top. The pcb now contains a pointer to the current FPU saved area, used during FPUDNA handling and context switches. There is also a facility to allow the kernel thread to use pcb save_area. Change the dreaded warnings "npxdna in kernel mode!" into the panics when FPU usage is not registered. KPI discussed with: fabient Tested by: pho, fabient Hardware provided by: Sentex Communications MFC after: 1 month
* A few cleanups to the FPU code on amd64:jhb2009-03-051-1/+1
| | | | | | | | | | - fpudna() always returned 1 since amd64 CPUs always have FPUs. Change the function to return void and adjust the calling code in trap() to assume the return 1 case is the only case. - Remove fpu_cleanstate_ready as it is always true when it is tested. Also, only initialize fpu_cleanstate when fpuinit() is called on the BSP. Reviewed by: bde
* Use a different value for the initial control word for the FPU state forjhb2009-01-281-0/+1
| | | | | | | | 32-bit processes. The value matches the initial setting used by FreeBSD/i386. Otherwise, 32-bit binaries using floating point would use a slightly different initial state when run on FreeBSD/amd64. MFC after: 1 week
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* We can simplify a lot of things now that we don't have to worry aboutpeter2004-01-281-1/+0
| | | | hardware bugs on external 386 cpus and now that we can depend on SSE.
* Switch from having a fpu "device" to something that is more like thepeter2003-11-081-1/+1
| | | | integrated part of the cpu core that it is.
* The great s/npx/fpu/gipeter2003-11-081-14/+14
|
* Go back to 64 bit precision for fadd/fsub/fsqrt etc. This is because onpeter2003-07-221-8/+9
| | | | | | | AMD64, gcc (and the ABI) expects the x87 unit to be running in 80/64 mode (not 64/53) so that it can use it for 'long double' operations. It takes the expected precision differences into account when generating code.
* Include the MXCSR initial values, based on the AMD docs. This filepeter2003-05-091-0/+2
| | | | | | should really be renamed to fpu.h and npx.c to fpu.c since its part of the core architecture on amd64 systems, not an isa 'numeric processor extension'.
* Commit MD parts of a loosely functional AMD64 port. This is based onpeter2003-05-011-58/+15
| | | | | | | | | | | | | | | | | | | | | | a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
* At great personal risk, add a __packed and __aligned(x) define thatpeter2002-09-231-1/+1
| | | | | | | | | | expand to __attribute__((packed)) and __attribute__((aligned(x))) respectively. Replace the handful of gcc-ism's that use __attribute__((aligned(16))) etc around the kernel with __aligned(16). There are over 400 __attribute__((packed)) to deal with, that can come later. I just want to use __packed in new code rather than add more gcc-ism's.
* Add kernel support needed for the KSE-aware libpthread:mini2002-09-161-4/+7
| | | | | | | | - Maintain fpu state across signals. - Save and restore FPU state properly in ucontext_t's. Reviewed by: deischen, julian Approved by: -arch
* Remove __P.alfred2002-03-201-5/+5
|
* KSE Milestone 2julian2001-09-121-1/+1
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* style(9) the structure definitions.obrien2001-09-051-3/+3
|
* Activate SSE/SIMD. This is the extra context switching support thatpeter2001-07-121-1/+37
| | | | | | | | | | | | | | | we are required to do if we let user processes use the extra 128 bit registers etc. This is the base part of the diff I got from: http://www.issei.org/issei/FreeBSD/sse.html I believe this is by: Mr. SUZUKI Issei <issei@issei.org> SMP support apparently by: Takekazu KATO <kato@chino.it.okayama-u.ac.jp> Test code by: NAKAMURA Kazushi <kaz@kobe1995.net>, see http://kobe1995.net/~kaz/FreeBSD/SSE.en.html I have fixed a couple of style(9) deviations. I have some followup commits to fix a couple of non-style things.
* Convert npx interrupts into traps instead of vice versa. This is muchbde2001-05-221-0/+1
| | | | | | | | simpler for npx exceptions that start as traps (no assembly required...) and works better for npx exceptions that start as interrupts (there is no longer a problem for nested interrupts). Submitted by: original (pre-SMPng) version by luoqi
* Declare or #define per-cpu globals in <machine/globals.h> in all cases.bde2000-10-271-6/+0
| | | | The i386 UP case was messily different.
* Change the default FPU control word so that exceptions for newcracauer2000-03-101-34/+4
| | | | | | | processes are now masked until set by fpsetmask(3). Submitted by: bde Approved by: jkh, bde
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-1/+1
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Enable vmspace sharing on SMP. Major changes are,luoqi1999-04-281-1/+5
| | | | | | | | | | | | | | | | | - %fs register is added to trapframe and saved/restored upon kernel entry/exit. - Per-cpu pages are no longer mapped at the same virtual address. - Each cpu now has a separate gdt selector table. A new segment selector is added to point to per-cpu pages, per-cpu global variables are now accessed through this new selector (%fs). The selectors in gdt table are rearranged for cache line optimization. - fask_vfork is now on as default for both UP and SMP. - Some aio code cleanup. Reviewed by: Alan Cox <alc@cs.rice.edu> John Dyson <dyson@iquest.net> Julian Elischer <julian@whistel.com> Bruce Evans <bde@zeta.org.au> David Greenman <dg@root.com>
* Removed unused #includes and a stale forward declaration.bde1997-07-201-6/+1
|
* Preliminary support for per-cpu data pages.peter1997-06-221-1/+3
| | | | | | | | | | | | | | | | This eliminates a lot of #ifdef SMP type code. Things like _curproc reside in a data page that is unique on each cpu, eliminating the expensive macros like: #define curproc (SMPcurproc[cpunumber()]) There are some unresolved bootstrap and address space sharing issues at present, but Steve is waiting on this for other work. There is still some strictly temporary code present that isn't exactly pretty. This is part of a larger change that has run into some bumps, this part is standalone so it should be safe. The temporary code goes away when the full idle cpu support is finished. Reviewed by: fsmp, dyson
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Added `#include "ioconf.h"' to <machine/conf.h> and cleaned up thebde1995-11-041-2/+1
| | | | | | | | | | misplaced extern declarations (mostly prototypes of interrupt handlers) that this exposed. The prototypes should be moved back to the driver sources when the functions are staticalized. Added idempotency guards to <machine/conf.h>. "ioconf.h" can't be included when building LKMs so define a wart in bsd.kmod.mk to help guard against including it.
* Fix benign type mismatches in isa interrupt handlers. Many returned intbde1995-09-191-2/+2
| | | | instead of void.
* Killed some unused stuff inherited from Bill Jolitz. Note that sincedg1995-08-171-8/+1
| | | | | | | this changes the size of the pcb struct, gdb will need to be rebuilt or debugging won't work correctly. Reviewed by: Bruce Evans
* Replace sv_ex_tw by padding (it is no longer used; the tag word in sv_envbde1995-01-031-8/+13
| | | | | | | | is valid). Expand comment about bogus padding for emulators. Update prototpe for npxinit().
* Declare all functions exported by the npx driver.bde1994-11-051-4/+17
| | | | Uniformize idempotency ifdefs.
* __386BSD__ -> __FreeBSD__jkh1994-11-041-2/+2
| | | | | | I know that many of these entries are bogus and need to be revisited, but let's get the tree working again for now and then do a pass through looking at all the __FreeBSD__ entries, shall we?
* Submitted by: Bruce Evansats1994-08-141-6/+4
| | | | | | | Delete the ifdef GPL_EMULATE case here and made the padding work for both types of emulators so that there is no longer a need to compile ps and friends new if you are using the GPL math emulator instead the normal one.
* Deleted on ifdef dontdefgclarkii1994-04-291-4/+6
| | | | | Added ifdef for GPL_MATH_EMULATE so we get the extra padding that is needed in the save87 struct.
* Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, somergrimes1993-10-161-9/+2
| | | | minor cleanup. Added $Id$ to files that did not have any version info, etc
* Initial import, 0.1 + pk 0.2.4-B1rgrimes1993-06-121-0/+146
OpenPOWER on IntegriCloud