Merge branch 'relocator' into mips
This commit is contained in:
commit
f5b6810b5a
2 changed files with 11 additions and 13 deletions
|
@ -57,11 +57,9 @@ extern grub_uint32_t grub_relocator32_backward_esp;
|
||||||
#define PREFIX(x) grub_relocator32_ ## x
|
#define PREFIX(x) grub_relocator32_ ## x
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
|
write_call_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
|
||||||
grub_size_t size, struct grub_relocator32_state state)
|
grub_size_t size, struct grub_relocator32_state state)
|
||||||
{
|
{
|
||||||
void (*entry) ();
|
|
||||||
|
|
||||||
grub_relocator32_backward_dest = dest;
|
grub_relocator32_backward_dest = dest;
|
||||||
grub_relocator32_backward_src = PTR_TO_UINT64 (src);
|
grub_relocator32_backward_src = PTR_TO_UINT64 (src);
|
||||||
grub_relocator32_backward_size = size;
|
grub_relocator32_backward_size = size;
|
||||||
|
@ -76,13 +74,12 @@ write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
|
||||||
grub_memmove (ptr,
|
grub_memmove (ptr,
|
||||||
&grub_relocator32_backward_start,
|
&grub_relocator32_backward_start,
|
||||||
RELOCATOR_SIZEOF (backward));
|
RELOCATOR_SIZEOF (backward));
|
||||||
entry = (void (*)()) (ptr);
|
((void (*)()) ptr) ();
|
||||||
entry ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
|
write_call_relocator_fw (void *ptr, void *src, grub_uint32_t dest,
|
||||||
grub_size_t size, struct grub_relocator32_state state)
|
grub_size_t size, struct grub_relocator32_state state)
|
||||||
{
|
{
|
||||||
|
|
||||||
grub_relocator32_forward_dest = dest;
|
grub_relocator32_forward_dest = dest;
|
||||||
|
@ -99,6 +96,7 @@ write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
|
||||||
grub_memmove (ptr,
|
grub_memmove (ptr,
|
||||||
&grub_relocator32_forward_start,
|
&grub_relocator32_forward_start,
|
||||||
RELOCATOR_SIZEOF (forward));
|
RELOCATOR_SIZEOF (forward));
|
||||||
entry = (void (*)()) ptr;
|
((void (*)()) ptr) ();
|
||||||
entry ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "../relocator.c"
|
||||||
|
|
|
@ -75,8 +75,8 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
||||||
overhead =
|
overhead =
|
||||||
ALIGN_UP (dest - RELOCATOR_SIZEOF (backward) - RELOCATOR_ALIGN,
|
ALIGN_UP (dest - RELOCATOR_SIZEOF (backward) - RELOCATOR_ALIGN,
|
||||||
RELOCATOR_ALIGN);
|
RELOCATOR_ALIGN);
|
||||||
write_call_relocator_bw (relocator - overhead,
|
write_call_relocator_bw ((char *) relocator - overhead,
|
||||||
relocator - overhead,
|
(char *) relocator - overhead,
|
||||||
dest - overhead, size + overhead, state);
|
dest - overhead, size + overhead, state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -86,7 +86,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
|
||||||
overhead = ALIGN_UP (dest + size, RELOCATOR_ALIGN)
|
overhead = ALIGN_UP (dest + size, RELOCATOR_ALIGN)
|
||||||
+ RELOCATOR_SIZEOF (forward) - (dest + size);
|
+ RELOCATOR_SIZEOF (forward) - (dest + size);
|
||||||
|
|
||||||
write_call_relocator_fw (relocator + size + overhead
|
write_call_relocator_fw ((char *) relocator + size + overhead
|
||||||
- RELOCATOR_SIZEOF (forward),
|
- RELOCATOR_SIZEOF (forward),
|
||||||
relocator, dest, size + overhead, state);
|
relocator, dest, size + overhead, state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue