mirror of
https://github.com/torvalds/linux.git
synced 2026-11-30 18:42:21 +00:00
Currently functions like get_dwarf_regnum only work with the host architecture. Carry the elf machine and flags in struct arch so that in disassembly these can be used to allow cross platform disassembly. Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Anup Patel <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Albert Ou <[email protected]> Cc: Shenlin Liang <[email protected]> Cc: Nick Terrell <[email protected]> Cc: Guilherme Amadio <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Changbin Du <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: Przemek Kitszel <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Guo Ren <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Will Deacon <[email protected]> Cc: James Clark <[email protected]> Cc: Mike Leach <[email protected]> Cc: Chen Pei <[email protected]> Cc: Leo Yan <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Aditya Gupta <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Bibo Mao <[email protected]> Cc: John Garry <[email protected]> Cc: Atish Patra <[email protected]> Cc: Dima Kogan <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
static
|
|
struct ins_ops *mips__associate_ins_ops(struct arch *arch, const char *name)
|
|
{
|
|
struct ins_ops *ops = NULL;
|
|
|
|
if (!strncmp(name, "bal", 3) ||
|
|
!strncmp(name, "bgezal", 6) ||
|
|
!strncmp(name, "bltzal", 6) ||
|
|
!strncmp(name, "bgtzal", 6) ||
|
|
!strncmp(name, "blezal", 6) ||
|
|
!strncmp(name, "beqzal", 6) ||
|
|
!strncmp(name, "bnezal", 6) ||
|
|
!strncmp(name, "bgtzl", 5) ||
|
|
!strncmp(name, "bltzl", 5) ||
|
|
!strncmp(name, "bgezl", 5) ||
|
|
!strncmp(name, "blezl", 5) ||
|
|
!strncmp(name, "jialc", 5) ||
|
|
!strncmp(name, "beql", 4) ||
|
|
!strncmp(name, "bnel", 4) ||
|
|
!strncmp(name, "jal", 3))
|
|
ops = &call_ops;
|
|
else if (!strncmp(name, "jr", 2))
|
|
ops = &ret_ops;
|
|
else if (name[0] == 'j' || name[0] == 'b')
|
|
ops = &jump_ops;
|
|
else
|
|
return NULL;
|
|
|
|
arch__associate_ins_ops(arch, name, ops);
|
|
|
|
return ops;
|
|
}
|
|
|
|
static
|
|
int mips__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
|
|
{
|
|
if (!arch->initialized) {
|
|
arch->associate_instruction_ops = mips__associate_ins_ops;
|
|
arch->initialized = true;
|
|
arch->objdump.comment_char = '#';
|
|
arch->e_machine = EM_MIPS;
|
|
arch->e_flags = 0;
|
|
}
|
|
|
|
return 0;
|
|
}
|