From a03c6ae38806e3ec5e017ff42471d8f6bff70a41 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Tue, 14 Jul 2015 18:43:46 -0400 Subject: [PATCH] tramp.c (MOVHI, ORI, JMP): Conditionalize for __nios2_arch__ level. 2015-07-14 Sandra Loosemore Cesar Philippidis Chung-Lin Tang libgcc/ * config/nios2/tramp.c (MOVHI, ORI, JMP): Conditionalize for __nios2_arch__ level. Co-Authored-By: Cesar Philippidis Co-Authored-By: Chung-Lin Tang From-SVN: r225794 --- libgcc/ChangeLog | 7 +++++++ libgcc/config/nios2/tramp.c | 20 +++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 26362b3f72c..13b3a948557 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2015-07-14 Sandra Loosemore + Cesar Philippidis + Chung-Lin Tang + + * config/nios2/tramp.c (MOVHI, ORI, JMP): Conditionalize + for __nios2_arch__ level. + 2015-07-13 John Marino * config/i386/t-dragonfly: New. diff --git a/libgcc/config/nios2/tramp.c b/libgcc/config/nios2/tramp.c index 73473a15f57..e108c7a990c 100644 --- a/libgcc/config/nios2/tramp.c +++ b/libgcc/config/nios2/tramp.c @@ -33,13 +33,27 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define SC_REGNO 12 -#define MOVHI(reg,imm16) \ +/* Instruction encodings depend on the ISA level. */ +#if __nios2_arch__ == 2 +#define MOVHI(reg,imm16) \ + (((reg) << 11) | ((imm16) << 16) | 0x34) +#define ORI(reg,imm16) \ + (((reg) << 11) | ((reg) << 6) | ((imm16) << 16) | 0x14) +#define JMP(reg) \ + (((reg) << 6) | (0x0d << 26) | 0x20) + +#elif __nios2_arch__ == 1 +#define MOVHI(reg,imm16) \ (((reg) << 22) | ((imm16) << 6) | 0x34) -#define ORI(reg,imm16) \ +#define ORI(reg,imm16) \ (((reg) << 27) | ((reg) << 22) | ((imm16) << 6) | 0x14) -#define JMP(reg) \ +#define JMP(reg) \ (((reg) << 27) | (0x0d << 11) | 0x3a) +#else +#error "Unknown Nios II architecture level" +#endif + void __trampoline_setup (unsigned int *addr, void *fnptr, void *chainptr) { -- 2.30.2