]> git.proxmox.com Git - mirror_qemu.git/blob - bsd-user/signal-common.h
bsd-user/signal.c: implement do_sigreturn
[mirror_qemu.git] / bsd-user / signal-common.h
1 /*
2 * Emulation of BSD signals
3 *
4 * Copyright (c) 2013 Stacey Son
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #ifndef SIGNAL_COMMON_H
10 #define SIGNAL_COMMON_H
11
12 long do_rt_sigreturn(CPUArchState *env);
13 abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
14 long do_sigreturn(CPUArchState *env, abi_ulong addr);
15 void force_sig_fault(int sig, int code, abi_ulong addr);
16 int host_to_target_signal(int sig);
17 void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
18 void process_pending_signals(CPUArchState *env);
19 void queue_signal(CPUArchState *env, int sig, int si_type,
20 target_siginfo_t *info);
21 void signal_init(void);
22 int target_to_host_signal(int sig);
23 void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
24
25 /*
26 * Within QEMU the top 8 bits of si_code indicate which of the parts of the
27 * union in target_siginfo is valid. This only applies between
28 * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not appear
29 * either within host siginfo_t or in target_siginfo structures which we get
30 * from the guest userspace program. Linux kenrels use this internally, but BSD
31 * kernels don't do this, but its a useful abstraction.
32 *
33 * The linux-user version of this uses the top 16 bits, but FreeBSD's SI_USER
34 * and other signal indepenent SI_ codes have bit 16 set, so we only use the top
35 * byte instead.
36 *
37 * For FreeBSD, we have si_pid, si_uid, si_status, and si_addr always. Linux and
38 * {Open,Net}BSD have a different approach (where their reason field is larger,
39 * but whose siginfo has fewer fields always).
40 */
41 #define QEMU_SI_NOINFO 0 /* nothing other than si_signo valid */
42 #define QEMU_SI_FAULT 1 /* _fault is valid in _reason */
43 #define QEMU_SI_TIMER 2 /* _timer is valid in _reason */
44 #define QEMU_SI_MESGQ 3 /* _mesgq is valid in _reason */
45 #define QEMU_SI_POLL 4 /* _poll is valid in _reason */
46 #define QEMU_SI_CAPSICUM 5 /* _capsicum is valid in _reason */
47
48 #endif