Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf syscalltbl: Mask off ABI type for MIPS system calls

Arnd Bergmann described that MIPS system calls don't necessarily start
from 0 as an ABI prefix is applied:
https://lore.kernel.org/lkml/8ed7dfb2-1e4d-4aa4-a04b-0397a89365d1@app.fastmail.com/
When decoding the "id" (aka system call number) for MIPS ignore values
greater-than 1000.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Link: https://lore.kernel.org/r/20250319050741.269828-12-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
95b802ca 16ab5c70

+8
+8
tools/perf/util/syscalltbl.c
··· 46 46 { 47 47 const struct syscalltbl *table = find_table(e_machine); 48 48 49 + if (e_machine == EM_MIPS && id > 1000) { 50 + /* 51 + * MIPS may encode the N32/64/O32 type in the high part of 52 + * syscall number. Mask this off if present. See the values of 53 + * __NR_N32_Linux, __NR_64_Linux, __NR_O32_Linux and __NR_Linux. 54 + */ 55 + id = id % 1000; 56 + } 49 57 if (table && id >= 0 && id < table->num_to_name_len) 50 58 return table->num_to_name[id]; 51 59 return NULL;