summaryrefslogtreecommitdiffstats
path: root/sys/compat/ia32/ia32_signal.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC r304740:ed2016-10-121-0/+2
| | | | | | Add missing header dependency. This header depends on sigaltstack32 being declared.
* Add support for the extended FPU states on amd64, both for nativekib2012-01-211-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 support for executing the FreeBSD 1/i386 a.out binaries on amd64.kib2011-04-011-4/+9
| | | | | | | | | | | | | | | In particular: - implement compat shims for old stat(2) variants and ogetdirentries(2); - implement delivery of signals with ancient stack frame layout and corresponding sigreturn(2); - implement old getpagesize(2); - provide a user-mode trampoline and LDT call gate for lcall $7,$0; - port a.out image activator and connect it to the build as a module on amd64. The changes are hidden under COMPAT_43. MFC after: 1 month
* Add include guards.kib2010-11-231-0/+5
| | | | MFC after: 3 days
* Add a forward declaration to silence a warning when compiling ia32_genassym.c.bz2010-04-031-0/+1
| | | | | Reviewed by: kib MFC after: 3 days
* Change the arguments of exec_setregs() so that it receives a pointernwhitehorn2010-03-251-2/+2
| | | | | | | | to the image_params struct instead of several members of that struct individually. This makes it easier to expand its arguments in the future without touching all platforms. Reviewed by: jhb
* Add all segment registers for the amd64 CPU to struct reg and mcontext.kib2009-04-011-1/+3
| | | | | | | | | | | | | 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
* Move some declaration of 32-bit signal structures into filedavidxu2006-10-051-45/+5
| | | | freebsd32-signal.h, implement sigtimedwait and sigwaitinfo system calls.
* Catch up to the system siginfo changes. Use a union for the ia32 layoutpeter2005-12-061-2/+19
| | | | | of siginfo just like the system one. There are now two fields to copy instead of one.
* 1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, mostdavidxu2005-10-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
* Fix 32 bit signals on amd64. It turns out that I was sign extendingpeter2005-04-051-72/+72
| | | | | | | | | | the register values coming back from sigreturn(2). Normally this wouldn't matter because the 32 bit environment would truncate the upper 32 bits and re-save the truncated values at the next trap. However, if we got a fast second signal and it was pending while we were returning from sigreturn(2) in the signal trampoline, we'd never have had a chance to truncate the bogus values in 32 bit mode, and the new sendsig would get an EFAULT when trying to write to the bogus user stack address.
* Check in structure definitions for the FreeBSD-3.x signal syscall stuff.peter2004-04-141-0/+43
| | | | Nothing uses these yet, but I dont want to lose them.
* Add a note about the landmine in the middle of struct ia32_sigframe.peter2004-02-211-0/+1
|
* Move a MD 32 bit binary support routine into the MD areas. exec_setregspeter2003-11-081-0/+2
| | | | | | | is highly MD in an emulation environment since it operates on the host environment. Although the setregs functions are really for exec support rather than signals, they deal with the same sorts of context and include files. So I put it there rather than create yet another file.
* Point the description of the fpu data in the context structures topeter2003-11-081-1/+1
| | | | | i386/include/npx.h instead of the host's machine/npx.h (which might not exist)
* Add CTASSERT()'s to check that the sizes of our replicas of the 32 bitpeter2003-10-301-2/+0
| | | | | | | | | | structures come out the right size. Fix the ones that broke. stat32 had some missing fields from the end and statfs32 was broken due to the strange definition of MNAMELEN (which is dependent on sizeof(long)) I'm not sure if this fixes any actual problems or not.
* Add BASIC i386 binary support for the amd64 kernel. This is largelypeter2003-05-141-0/+164
stolen from the ia64/ia32 code (indeed there was a repocopy), but I've redone the MD parts and added and fixed a few essential syscalls. It is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic) and p4. The ia64 code has not implemented signal delivery, so I had to do that. Before you say it, yes, this does need to go in a common place. But we're in a freeze at the moment and I didn't want to risk breaking ia64. I will sort this out after the freeze so that the common code is in a common place. On the AMD64 side, this required adding segment selector context switch support and some other support infrastructure. The %fs/%gs etc code is hairy because loading %gs will clobber the kernel's current MSR_GSBASE setting. The segment selectors are not used by the kernel, so they're only changed at context switch time or when changing modes. This still needs to be optimized. Approved by: re (amd64/* blanket)
OpenPOWER on IntegriCloud