aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/include/ucontext.h
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Convert machine/elf.h, machine/frame.h, machine/sigframe.h,Konstantin Belousov2013-02-201-58/+2
| | | | | | | | | | | | | | | | | machine/signal.h and machine/ucontext.h into common x86 includes, copying from amd64 and merging with i386. Kernel-only compat definitions are kept in the i386/include/sigframe.h and i386/include/signal.h, to reduce amd64 kernel namespace pollution. The amd64 compat uses its own definitions so far. The _MACHINE_ELF_WANT_32BIT definition is to allow the sys/boot/userboot/userboot/elf32_freebsd.c to use i386 ELF definitions on the amd64 compile host. The same hack could be usefully abused by other code too. Notes: svn path=/head/; revision=247047
* Add support for the extended FPU states on amd64, both for nativeKonstantin Belousov2012-01-211-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=230426
* Make the comment in i386/include/ucontext.h identical to the one inKonstantin Belousov2011-12-311-3/+4
| | | | | | | | | | amd64/include/ucontext.h. The later is better worded. Requested by: deischen MFC after: 3 days Notes: svn path=/head/; revision=229104
* Attempt to improve formatting and content of several comments forKonstantin Belousov2011-11-091-3/+3
| | | | | | | | | | amd64 and i386 MD code. Based on suggestions by: bde MFC after: 1 week Notes: svn path=/head/; revision=227399
* Add all segment registers for the amd64 CPU to struct reg and mcontext.Konstantin Belousov2009-04-011-1/+6
| | | | | | | | | | | | | | | | To keep these structures ABI-compatible, half the size of r_trapno, r_err, mc_trapno, mc_flags. Add fsbase and gsbase to mcontext on both amd64 and i386. Add flags to amd64 mcontext to indicate that it contains valid segments or bases. In collaboration with: pho Discussed with: peter Reviewed by: jhb Notes: svn path=/head/; revision=190616
* MFamd64: use register_t's.David E. O'Brien2005-09-121-42/+42
| | | | Notes: svn path=/head/; revision=150013
* Align the FPU state in the ucontext and sigcontext to 16 bytesDaniel Eischen2002-12-021-4/+6
| | | | | | | | | | | | to accomodate the new SSE/XMM floating point save/restore instructions. This commit is mostly from bde and includes some style nits. Approved by: re (jhb) Notes: svn path=/head/; revision=107521
* Add getcontext, setcontext, and swapcontext as system calls.Daniel Eischen2002-11-161-10/+3
| | | | | | | | | | | | | | Previously these were libc functions but were requested to be made into system calls for atomicity and to coalesce what might be two entrances into the kernel (signal mask setting and floating point trap) into one. A few style nits and comments from bde are also included. Tested on alpha by: gallatin Notes: svn path=/head/; revision=106977
* Split 4.x and 5.x signal handling so that we can keep 4.x signalPeter Wemm2002-10-251-0/+28
| | | | | | | | | | | | | | | | | | | handling clean and functional as 5.x evolves. This allows some of the nasty bandaids in the 5.x codepaths to be unwound. Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an anti-foot-shooting measure in place, 5.x folks need this for a while) and finish encapsulating the older stuff under COMPAT_43. Since the ancient stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *' to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn is supposed to take), add a compile time check to prevent foot shooting there too. Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc. Tested on: i386, alpha, ia64. Compiled on sparc64 (a few days ago). Approved by: re Notes: svn path=/head/; revision=105950
* Add another temporary hack to allow running older i386 binaries.Daniel Eischen2002-10-041-6/+6
| | | | | | | | | | | This will be removed when new versions of syscalls sigreturn() and sigaction() are added (mini is working on this but is in the middle of a move). This should fix the problem of cvsupd dying. Notes: svn path=/head/; revision=104460
* Add kernel support needed for the KSE-aware libpthread:Jonathan Mini2002-09-161-5/+19
| | | | | | | | | | | - Maintain fpu state across signals. - Save and restore FPU state properly in ucontext_t's. Reviewed by: deischen, julian Approved by: -arch Notes: svn path=/head/; revision=103408
* Use a spare slot in the machine context for a flags word to indicateDaniel Eischen2002-01-101-1/+4
| | | | | | | | | | | | | whether the machine context is valid and whether the FPU state is valid (saved). Mark the machine context valid before copying it out when sending a signal. Approved by: -arch Notes: svn path=/head/; revision=89175
* Add a per-signal flag to mark handlers registered with osigaction, so weLuoqi Chen1999-10-111-2/+0
| | | | | | | | | | | | | | | | | | can provide the correct context to each signal handler. Fix broken sigsuspend(): don't use p_oldsigmask as a flag, use SAS_OLDMASK as we did before the linuxthreads support merge (submitted by bde). Move ps_sigstk from to p_sigacts to the main proc structure since signal stack should not be shared among threads. Move SAS_OLDMASK and SAS_ALTSTACK flags from sigacts::ps_flags to proc::p_flag. Move PS_NOCLDSTOP and PS_NOCLDWAIT flags from proc::p_flag to procsig::ps_flag. Reviewed by: marcel, jdp, bde Notes: svn path=/head/; revision=52140
* Simplification of the signal trampoline and other cleanups.Marcel Moolenaar1999-10-071-2/+19
| | | | | | | | | | | | | | | | | | o Remove unused defines from genassym.c that were needed by the trampoline. o Add load_gs_param function to support.s that catches a fault when %gs is loaded with an invalid descriptor. The function returns EFAULT in that case. o Remove struct trapframe from mcontext_t and replace it with the list of registers. o Modify sendsig and sigreturn accordingly. This commit contains a patch by bde. Reviewed by: luoqi, jdp Notes: svn path=/head/; revision=51984
* Re-introduction of sigcontext.Marcel Moolenaar1999-10-041-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct sigcontext and ucontext_t/mcontext_t are defined in such a way that both (ie struct sigcontext and ucontext_t) can be passed on to sigreturn. The signal handler is still given a ucontext_t for maximum flexibility. For backward compatibility sigreturn restores the state for the alternate signal stack from sigcontext.sc_onstack and not from ucontext_t.uc_stack. A good way to determine which value the application has set and thus which value to use, is still open for discussion. NOTE: This change should only affect those binaries that use sigcontext and/or ucontext_t. In the source tree itself this is only doscmd. Recompilation is required for those applications. This commit also fixes a lot of style bugs without hopefully adding new ones. NOTE: struct sigaltstack.ss_size now has type size_t again. For some reason I changed that into unsigned int. Parts submitted by: bde sigaltstack bug found by: bde Notes: svn path=/head/; revision=51942
* sigset_t change (part 3 of 5)Marcel Moolenaar1999-09-291-0/+43
----------------------------- By introducing a new sigframe so that the signal handler operates on the new siginfo_t and on ucontext_t instead of sigcontext, we now need two version of sendsig and sigreturn. A flag in struct proc determines whether the process expects an old sigframe or a new sigframe. The signal trampoline handles which sigreturn to call. It does this by testing for a magic cookie in the frame. The alpha uses osigreturn to implement longjmp. This means that osigreturn is not only used for compatibility with existing binaries. To handle the new sigset_t, setjmp saves it in sc_reserved (see NOTE). the struct sigframe has been moved from frame.h to sigframe.h to handle the complex header dependencies that was caused by the new sigframe. NOTE: For the i386, the size of jmp_buf has been increased to hold the new sigset_t. On the alpha this has been prevented by using sc_reserved in sigcontext. Notes: svn path=/head/; revision=51792