summaryrefslogtreecommitdiff
path: root/machdep.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-09-03 14:03:53 -0700
committerGuy Harris <guy@alum.mit.edu>2014-09-03 14:03:53 -0700
commitbf468d8027b1dc3933f91f7588f25cf5e0a5ff30 (patch)
treed7f004e63c0bc44b0d6f0e0727183bcee758e9d6 /machdep.c
parentf2e17bb1673b6c1c9d62ea51625aef920d7252d2 (diff)
downloadtcpdump-bf468d8027b1dc3933f91f7588f25cf5e0a5ff30.tar.gz
Clarify what abort_on_misalignment() does.
It doesn't request byte misalignment repair, it requests that byte misalignment kill the program with SIGBUS; on platforms that don't support aligned loads, we should be fetching possibly-misaligned data using some safe instruction sequence, not by doing misaligned loads and relying on them to trap to the kernel and be (slowly) emulated.
Diffstat (limited to 'machdep.c')
-rw-r--r--machdep.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/machdep.c b/machdep.c
index 3b8c9664..7b259ae1 100644
--- a/machdep.c
+++ b/machdep.c
@@ -50,6 +50,15 @@ int snprintf(char *, size_t, const char *, ...)
#include "machdep.h"
+/*
+ * On platforms where the CPU doesn't support unaligned loads, force
+ * unaligned accesses to abort with SIGBUS, rather than being fixed
+ * up (slowly) by the OS kernel; on those platforms, misaligned accesses
+ * are bugs, and we want tcpdump to crash so that the bugs are reported.
+ *
+ * The only OS on which this is necessary is DEC OSF/1^W^WDigital
+ * UNIX^W^WTru64 UNIX.
+ */
int
abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
{