mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
csky: fixup relocation error with 807 & 860
810 doesn't support jsri instruction and csky-as will leave jsri + nop for relocation. Module-probe need replace them with lrw + jsr. Signed-off-by: Guo Ren <ren_guo@c-sky.com> Cc: Hui Kai <huikai@acoinfo.com>
This commit is contained in:
parent
8a5aaf97cc
commit
f553aa1c13
@ -12,7 +12,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
#if defined(__CSKYABIV2__)
|
||||
#ifdef CONFIG_CPU_CK810
|
||||
#define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000)
|
||||
#define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0)
|
||||
|
||||
@ -25,6 +25,26 @@
|
||||
*(uint16_t *)(addr) = 0xE8Fa; \
|
||||
*((uint16_t *)(addr) + 1) = 0x0000; \
|
||||
} while (0)
|
||||
|
||||
static void jsri_2_lrw_jsr(uint32_t *location)
|
||||
{
|
||||
uint16_t location_tmp = (uint16_t *)location;
|
||||
|
||||
if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
|
||||
return;
|
||||
|
||||
if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
|
||||
/* jsri 0x... --> lrw r26, 0x... */
|
||||
CHANGE_JSRI_TO_LRW(location);
|
||||
/* lsli r0, r0 --> jsr r26 */
|
||||
SET_JSR32_R26(location + 1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void inline jsri_2_lrw_jsr(uint32_t *location)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
|
||||
@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
|
||||
Elf32_Sym *sym;
|
||||
uint32_t *location;
|
||||
short *temp;
|
||||
#if defined(__CSKYABIV2__)
|
||||
uint16_t *location_tmp;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
|
||||
/* This is where to make the change */
|
||||
@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
|
||||
case R_CSKY_PCRELJSR_IMM11BY2:
|
||||
break;
|
||||
case R_CSKY_PCRELJSR_IMM26BY2:
|
||||
#if defined(__CSKYABIV2__)
|
||||
location_tmp = (uint16_t *)location;
|
||||
if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
|
||||
break;
|
||||
|
||||
if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
|
||||
/* jsri 0x... --> lrw r26, 0x... */
|
||||
CHANGE_JSRI_TO_LRW(location);
|
||||
/* lsli r0, r0 --> jsr r26 */
|
||||
SET_JSR32_R26(location + 1);
|
||||
}
|
||||
#endif
|
||||
jsri_2_lrw_jsr(location);
|
||||
break;
|
||||
case R_CSKY_ADDR_HI16:
|
||||
temp = ((short *)location) + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user