summaryrefslogtreecommitdiff
path: root/src/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem.c')
-rw-r--r--src/mem.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/mem.c b/src/mem.c
index f98a25e2c..b1a8d1dc7 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -290,6 +290,11 @@ SYS_FUNC(mremap)
}
#include "xlat/madvise_cmds.h"
+#include "xlat/madvise_hppa_generic_cmds.h"
+
+#if defined HPPA
+# include "xlat/madvise_hppa_old_cmds.h"
+#endif
SYS_FUNC(madvise)
{
@@ -302,7 +307,40 @@ SYS_FUNC(madvise)
tprint_arg_next();
/* advice */
- printxval(madvise_cmds, tcp->u_arg[2], "MADV_???");
+ const unsigned int advice = tcp->u_arg[2];
+#if defined HPPA
+ /*
+ * hppa decided to be very special: it used to have its own
+ * definitions for some MADV_* constants (just like Alpha,
+ * for example), but then (see Linux commit v6.2-rc1~39^2~7)
+ * decided to change their values, so their symbolic names
+ * are meaningless for the user now (which would also probably
+ * add spice to debugging old binaries with the newer kernels
+ * "in year 2025 (or later)"), and that forces us to state
+ * explicitly which variant of the constant value is used.
+ */
+ const char *old_cmd = xlookup(madvise_hppa_old_cmds, advice);
+
+ if (old_cmd) {
+ PRINT_VAL_X(advice);
+ if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_RAW)
+ tprintf_comment("old %s", old_cmd);
+ } else {
+ const char *new_cmd = xlookup(madvise_hppa_generic_cmds,
+ advice);
+
+ if (new_cmd) {
+ PRINT_VAL_X(advice);
+ if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_RAW)
+ tprintf_comment("new/generic %s", new_cmd);
+ } else {
+ printxval(madvise_cmds, advice, "MADV_???");
+ }
+ }
+#else
+ printxvals(advice, "MADV_???",
+ madvise_cmds, madvise_hppa_generic_cmds, NULL);
+#endif
return RVAL_DECODED;
}