]> git.proxmox.com Git - mirror_qemu.git/blame - bsd-user/signal-common.h
bsd-user/signal.c: implement do_sigreturn
[mirror_qemu.git] / bsd-user / signal-common.h
CommitLineData
0ef59989
WL
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
2bd010c4
WL
12long do_rt_sigreturn(CPUArchState *env);
13abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
c885ae0e 14long do_sigreturn(CPUArchState *env, abi_ulong addr);
0ef59989 15void force_sig_fault(int sig, int code, abi_ulong addr);
1366ef81 16int host_to_target_signal(int sig);
c93cbac1 17void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
2bd010c4 18void process_pending_signals(CPUArchState *env);
e32a6301
WL
19void queue_signal(CPUArchState *env, int sig, int si_type,
20 target_siginfo_t *info);
2bd010c4 21void signal_init(void);
1366ef81 22int target_to_host_signal(int sig);
c93cbac1 23void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
0ef59989 24
e32a6301
WL
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
0ef59989 48#endif