1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _ASM_CRIS_ELF_H 3 #define _ASM_CRIS_ELF_H 4 5 #define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32 6 7 /* Matches struct user_regs_struct */ 8 #define ELF_NGREG 32 9 10 /* 11 * This is used to ensure we don't load something for the wrong architecture. 12 */ 13 #define elf_check_arch(x) \ 14 ((x)->e_machine == EM_CRIS \ 15 && ((((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_V32 \ 16 || (((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_COMMON_V10_V32)))) 17 18 /* CRISv32 ELF register definitions. */ 19 20 #include <asm/ptrace.h> 21 22 /* Explicitly zero out registers to increase determinism. */ 23 #define ELF_PLAT_INIT(_r, load_addr) do { \ 24 (_r)->r13 = 0; (_r)->r12 = 0; (_r)->r11 = 0; (_r)->r10 = 0; \ 25 (_r)->r9 = 0; (_r)->r8 = 0; (_r)->r7 = 0; (_r)->r6 = 0; \ 26 (_r)->r5 = 0; (_r)->r4 = 0; (_r)->r3 = 0; (_r)->r2 = 0; \ 27 (_r)->r1 = 0; (_r)->r0 = 0; (_r)->mof = 0; (_r)->srp = 0; \ 28 (_r)->acr = 0; \ 29 } while (0) 30 31 /* 32 * An executable for which elf_read_implies_exec() returns TRUE will 33 * have the READ_IMPLIES_EXEC personality flag set automatically. 34 */ 35 #define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack)) 36 37 /* 38 * This is basically a pt_regs with the additional definition 39 * of the stack pointer since it's needed in a core dump. 40 * pr_regs is a elf_gregset_t and should be filled according 41 * to the layout of user_regs_struct. 42 */ 43 #define ELF_CORE_COPY_REGS(pr_reg, regs) \ 44 pr_reg[0] = regs->r0; \ 45 pr_reg[1] = regs->r1; \ 46 pr_reg[2] = regs->r2; \ 47 pr_reg[3] = regs->r3; \ 48 pr_reg[4] = regs->r4; \ 49 pr_reg[5] = regs->r5; \ 50 pr_reg[6] = regs->r6; \ 51 pr_reg[7] = regs->r7; \ 52 pr_reg[8] = regs->r8; \ 53 pr_reg[9] = regs->r9; \ 54 pr_reg[10] = regs->r10; \ 55 pr_reg[11] = regs->r11; \ 56 pr_reg[12] = regs->r12; \ 57 pr_reg[13] = regs->r13; \ 58 pr_reg[14] = rdusp(); /* SP */ \ 59 pr_reg[15] = regs->acr; /* ACR */ \ 60 pr_reg[16] = 0; /* BZ */ \ 61 pr_reg[17] = rdvr(); /* VR */ \ 62 pr_reg[18] = 0; /* PID */ \ 63 pr_reg[19] = regs->srs; /* SRS */ \ 64 pr_reg[20] = 0; /* WZ */ \ 65 pr_reg[21] = regs->exs; /* EXS */ \ 66 pr_reg[22] = regs->eda; /* EDA */ \ 67 pr_reg[23] = regs->mof; /* MOF */ \ 68 pr_reg[24] = 0; /* DZ */ \ 69 pr_reg[25] = 0; /* EBP */ \ 70 pr_reg[26] = regs->erp; /* ERP */ \ 71 pr_reg[27] = regs->srp; /* SRP */ \ 72 pr_reg[28] = 0; /* NRP */ \ 73 pr_reg[29] = regs->ccs; /* CCS */ \ 74 pr_reg[30] = rdusp(); /* USP */ \ 75 pr_reg[31] = regs->spc; /* SPC */ \ 76 77 #endif /* _ASM_CRIS_ELF_H */ 78