summaryrefslogtreecommitdiffstats
path: root/bsd-user/openbsd
diff options
context:
space:
mode:
authorWarner Losh2021-08-05 21:41:52 +0200
committerWarner Losh2021-09-10 22:13:06 +0200
commit790baacc63c1cb29bfc3bf0755f49ca73a348eae (patch)
tree18e7ea67e8081e13d23ff7e4cf0fca8347d5a26b /bsd-user/openbsd
parentbsd-user: Add system independent stack, data and text limiting (diff)
downloadqemu-790baacc63c1cb29bfc3bf0755f49ca73a348eae.tar.gz
qemu-790baacc63c1cb29bfc3bf0755f49ca73a348eae.tar.xz
qemu-790baacc63c1cb29bfc3bf0755f49ca73a348eae.zip
bsd-user: *BSD specific siginfo defintions
Add FreeBSD, NetBSD and OpenBSD values for the various signal info types and defines to decode different signals to discover more information about the specific signal types. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Diffstat (limited to 'bsd-user/openbsd')
-rw-r--r--bsd-user/openbsd/target_os_siginfo.h82
-rw-r--r--bsd-user/openbsd/target_os_signal.h69
2 files changed, 151 insertions, 0 deletions
diff --git a/bsd-user/openbsd/target_os_siginfo.h b/bsd-user/openbsd/target_os_siginfo.h
new file mode 100644
index 0000000000..baf646a5ab
--- /dev/null
+++ b/bsd-user/openbsd/target_os_siginfo.h
@@ -0,0 +1,82 @@
+#ifndef _TARGET_OS_SIGINFO_H_
+#define _TARGET_OS_SIGINFO_H_
+
+#define TARGET_NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
+#define TARGET_NSIG_BPW (sizeof(uint32_t) * 8)
+#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
+
+/* this struct defines a stack used during syscall handling */
+typedef struct target_sigaltstack {
+ abi_long ss_sp;
+ abi_ulong ss_size;
+ abi_long ss_flags;
+} target_stack_t;
+
+typedef struct {
+ uint32_t __bits[TARGET_NSIG_WORDS];
+} target_sigset_t
+
+struct target_sigaction {
+ abi_ulong _sa_handler;
+ int32_t sa_flags;
+ target_sigset_t sa_mask;
+};
+
+/* Compare to sys/siginfo.h */
+typedef union target_sigval {
+ int sival_int;
+ abi_ulong sival_ptr;
+} target_sigval_t;
+
+struct target_ksiginfo {
+ int32_t _signo;
+ int32_t _code;
+ int32_t _errno;
+#if TARGET_ABI_BITS == 64
+ int32_t _pad;
+#endif
+ union {
+ struct {
+ int32_t _pid;
+ int32_t _uid;
+ target_sigval_t _value;
+ } _rt;
+
+ struct {
+ int32_t _pid;
+ int32_t _uid;
+ int32_t _struct;
+ /* clock_t _utime; */
+ /* clock_t _stime; */
+ } _child;
+
+ struct {
+ abi_ulong _addr;
+ int32_t _trap;
+ } _fault;
+
+ struct {
+ long _band;
+ int _fd;
+ } _poll;
+ } _reason;
+};
+
+typedef union target_siginfo {
+ int8_t si_pad[128];
+ struct target_ksiginfo _info;
+} target_siginfo_t;
+
+#define target_si_signo _info._signo
+#define target_si_code _info._code
+#define target_si_errno _info._errno
+#define target_si_addr _info._reason._fault._addr
+
+#define TARGET_SEGV_MAPERR 1
+#define TARGET_SEGV_ACCERR 2
+
+#define TARGET_TRAP_BRKPT 1
+#define TARGET_TRAP_TRACE 2
+
+
+#endif /* ! _TARGET_OS_SIGINFO_H_ */
diff --git a/bsd-user/openbsd/target_os_signal.h b/bsd-user/openbsd/target_os_signal.h
new file mode 100644
index 0000000000..a373922f7e
--- /dev/null
+++ b/bsd-user/openbsd/target_os_signal.h
@@ -0,0 +1,69 @@
+#ifndef _TARGET_OS_SIGNAL_H_
+#define _TARGET_OS_SIGNAL_H_
+
+#include "target_os_siginfo.h"
+#include "target_arch_signal.h"
+
+#define TARGET_SIGHUP 1 /* hangup */
+#define TARGET_SIGINT 2 /* interrupt */
+#define TARGET_SIGQUIT 3 /* quit */
+#define TARGET_SIGILL 4 /* illegal instruction (not reset when caught) */
+#define TARGET_SIGTRAP 5 /* trace trap (not reset when caught) */
+#define TARGET_SIGABRT 6 /* abort() */
+#define TARGET_SIGIOT SIGABRT /* compatibility */
+#define TARGET_SIGEMT 7 /* EMT instruction */
+#define TARGET_SIGFPE 8 /* floating point exception */
+#define TARGET_SIGKILL 9 /* kill (cannot be caught or ignored) */
+#define TARGET_SIGBUS 10 /* bus error */
+#define TARGET_SIGSEGV 11 /* segmentation violation */
+#define TARGET_SIGSYS 12 /* bad argument to system call */
+#define TARGET_SIGPIPE 13 /* write on a pipe with no one to read it */
+#define TARGET_SIGALRM 14 /* alarm clock */
+#define TARGET_SIGTERM 15 /* software termination signal from kill */
+#define TARGET_SIGURG 16 /* urgent condition on IO channel */
+#define TARGET_SIGSTOP 17 /* sendable stop signal not from tty */
+#define TARGET_SIGTSTP 18 /* stop signal from tty */
+#define TARGET_SIGCONT 19 /* continue a stopped process */
+#define TARGET_SIGCHLD 20 /* to parent on child stop or exit */
+#define TARGET_SIGTTIN 21 /* to readers pgrp upon background tty read */
+#define TARGET_SIGTTOU 22 /* like TTIN for out if (tp->t_local&LTOSTOP) */
+#define TARGET_SIGIO 23 /* input/output possible signal */
+#define TARGET_SIGXCPU 24 /* exceeded CPU time limit */
+#define TARGET_SIGXFSZ 25 /* exceeded file size limit */
+#define TARGET_SIGVTALRM 26 /* virtual time alarm */
+#define TARGET_SIGPROF 27 /* profiling time alarm */
+#define TARGET_SIGWINCH 28 /* window size changes */
+#define TARGET_SIGINFO 29 /* information request */
+#define TARGET_SIGUSR1 30 /* user defined signal 1 */
+#define TARGET_SIGUSR2 31 /* user defined signal 2 */
+
+/*
+ * Language spec says we must list exactly one parameter, even though we
+ * actually supply three. Ugh!
+ */
+#define TARGET_SIG_DFL ((void (*)(int))0)
+#define TARGET_SIG_IGN ((void (*)(int))1)
+#define TARGET_SIG_ERR ((void (*)(int))-1)
+
+#define TARGET_SA_ONSTACK 0x0001 /* take signal on signal stack */
+#define TARGET_SA_RESTART 0x0002 /* restart system on signal return */
+#define TARGET_SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
+#define TARGET_SA_NODEFER 0x0010 /* don't mask the signal we're delivering */
+#define TARGET_SA_NOCLDWAIT 0x0020 /* don't create zombies (assign to pid 1) */
+#define TARGET_SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
+#define TARGET_SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
+#define TARGET_SA_SIGINFO 0x0040 /* generate siginfo_t */
+
+/*
+ * Flags for sigprocmask:
+ */
+#define TARGET_SIG_BLOCK 1 /* block specified signal set */
+#define TARGET_SIG_UNBLOCK 2 /* unblock specified signal set */
+#define TARGET_SIG_SETMASK 3 /* set specified signal set */
+
+#define TARGET_BADSIG SIG_ERR
+
+#define TARGET_SS_ONSTACK 0x0001 /* take signals on alternate stack */
+#define TARGET_SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
+
+#endif /* !_TARGET_OS_SIGNAL_H_ */