Skip to contentSkip to conversation

MIPS: initial modules support

RFC In review Antony Pavlov 2 participants 2 messages May 10, 2012 – May 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 MIPS: initial modules support

This code does not work correctly.

insmod got unaligned access exception during apply_r_mips_32_rel

---
 arch/mips/Kconfig              |    1 +
 arch/mips/include/asm/elf.h    |  153 +++++++++++++++++++
 arch/mips/include/asm/module.h |   17 ++-
 arch/mips/lib/Makefile         |    1 +
 arch/mips/lib/module.c         |  328 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 499 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/lib/module.c
arch/mips/Kconfig +1 -0
index 50d5c67..55c5d3b 100644
@@ -6,6 +6,7 @@ config MIPS
 	select HAS_KALLSYMS
 	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
 	select HAVE_CONFIGURABLE_TEXT_BASE
+	select HAS_MODULES
 	default y
 
 config SYS_SUPPORTS_BIG_ENDIAN
arch/mips/include/asm/elf.h +153 -0

159 lines not on this page · raw message

arch/mips/include/asm/module.h +16 -1
index 3046220..d423ced 100644
@@ -19,6 +19,21 @@
 #ifndef _ASM_MIPS_MODULE_H_
 #define _ASM_MIPS_MODULE_H_
 
-/* nothing special yet */
+struct mod_arch_specific
+{
+};
+
+#ifdef CONFIG_32BIT
+#define Elf_Shdr	Elf32_Shdr
+#define Elf_Sym		Elf32_Sym
+#define Elf_Ehdr	Elf32_Ehdr
+#define Elf_Addr	Elf32_Addr
+
+#define Elf_Mips_Rel	Elf32_Rel
+#define Elf_Mips_Rela	Elf32_Rela
+
+#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
+#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
+#endif
 
 #endif /* _ASM_MIPS_MODULE_H_ */
arch/mips/lib/Makefile +1 -0
index 45fe920..8a043a6 100644
@@ -6,3 +6,4 @@ obj-y += ashrdi3.o
 obj-y += memory.o
 
 obj-$(CONFIG_CMD_MIPS_CPUINFO) += cpuinfo.o
+obj-$(CONFIG_MODULES) += module.o
arch/mips/lib/module.c new file +328 -0

328 lines not on this page · raw message

Signature · 7 lines
1.7.10


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 3 lines · Antony Pavlov

This code does not work correctly.

insmod got unaligned access exception during apply_r_mips_32_rel

I can't say much to this patch, it looks sane. Of course it should work before applying it ;)

arch/mips/lib/module.c line 47

Quoted 3 lines
arch/mips/lib/module.c new file +3 -0
+static int apply_r_mips_32_rel(struct module *me, u32 *location, Elf_Addr v)
+{
+	pr_debug("apply_r_mips_32_rel: locatio = %p, v = %08x\n", location, v);

s/locatio/location/

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox