Support trampoline jumps on powerpc.

* grub-core/kern/dl.c (grub_dl_load_segments) [__powerpc__]: Follow
	__ia64__ path.
	(grub_dl_load_segments): Set mod->sz.
	(grub_dl_flush_cache): Flush whole space occupied by module, not just
	segments.
	* grub-core/kern/ia64/dl.c (nopm): Make const while on it.
	(jump): Likewise.
	* grub-core/kern/powerpc/dl.c (grub_arch_dl_get_tramp_got_size): New
	function.
	(trampoline): New struct.
	(trampoline_template): New const.
	(grub_arch_dl_relocate_symbols): Create trampolines on overflow.
	* include/grub/dl.h (grub_dl): Add sz element.
	[__powerpc__]: Follow __ia64__.
	(GRUB_ARCH_DL_TRAMP_ALIGN): Define on ppc.
	(GRUB_ARCH_DL_GOT_ALIGN): Likewise.
	(GRUB_ARCH_DL_TRAMP_SIZE): Likewise.
	(grub_arch_dl_get_tramp_got_size) [__powerpc__]: New proto.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-08 11:23:56 +01:00
parent 3084ede4c7
commit ed64e9e279
5 changed files with 120 additions and 18 deletions

View file

@ -136,11 +136,12 @@ struct grub_dl
Elf_Sym *symtab;
void (*init) (struct grub_dl *mod);
void (*fini) (void);
#ifdef __ia64__
#if defined (__ia64__) || defined (__powerpc__)
void *got;
void *tramp;
#endif
void *base;
grub_size_t sz;
struct grub_dl *next;
};
typedef struct grub_dl *grub_dl_t;
@ -176,10 +177,20 @@ void
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
grub_size_t *got);
#ifdef __ia64__
#if defined (__ia64__)
#define GRUB_ARCH_DL_TRAMP_ALIGN 16
#define GRUB_ARCH_DL_GOT_ALIGN 16
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
#else
void
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
grub_size_t *got);
#endif
#ifdef __powerpc__
#define GRUB_ARCH_DL_TRAMP_SIZE 16
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
#define GRUB_ARCH_DL_GOT_ALIGN 4
#endif
#endif