Move mips-arc link address. Previous link address was chosen

in belief that RAM on SGI platforms grows down while in fact it
	grows up from an unusual base.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-24 13:54:17 +02:00
parent 17fca5734b
commit 8528c879e3
7 changed files with 24 additions and 19 deletions

View file

@ -1,3 +1,9 @@
2013-04-24 Vladimir Serbinenko <phcoder@gmail.com>
Move mips-arc link address. Previous link address was chosen
in belief that RAM on SGI platforms grows down while in fact it
grows up from an unusual base.
2013-04-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter):

View file

@ -73,7 +73,7 @@ kernel = {
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
mips_arc_ldflags = '-Wl,-Ttext,0x8bd00000';
mips_arc_ldflags = '-Wl,-Ttext,0x88200000';
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
@ -372,7 +372,7 @@ image = {
objcopyflags = '-O binary';
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
ldadd = '-lgcc';
cflags = '-Wno-unreachable-code -static-libgcc';
enable = mips;
@ -388,7 +388,7 @@ image = {
objcopyflags = '-O binary';
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
ldadd = '-lgcc';
cflags = '-static-libgcc';
enable = mips;

View file

@ -128,12 +128,16 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text")));
grub_addr_t grub_modbase;
extern char _end[];
void
grub_machine_init (void)
{
struct grub_arc_memory_descriptor *cur = NULL;
grub_addr_t modend;
grub_modbase = GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size;
grub_modbase = ALIGN_UP ((grub_addr_t) _end, GRUB_KERNEL_MACHINE_MOD_ALIGN);
modend = grub_modbase + grub_total_modules_size;
grub_console_init_early ();
/* FIXME: measure this. */
@ -153,10 +157,10 @@ grub_machine_init (void)
start = ((grub_uint64_t) cur->start_page) << 12;
end = ((grub_uint64_t) cur->num_pages) << 12;
end += start;
if ((grub_uint64_t) end > ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR
- grub_total_modules_size) & 0x1fffffff))
end = ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size)
& 0x1fffffff);
if ((grub_uint64_t) start < (modend & 0x1fffffff))
start = (modend & 0x1fffffff);
if ((grub_uint64_t) end > 0x20000000)
end = 0x20000000;
if (end > start)
grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000),
end - start);

View file

@ -73,7 +73,6 @@ cont:
#endif
/* Move the modules out of BSS. */
#ifndef GRUB_MACHINE_ARC
lui $t2, %hi(__bss_start)
addiu $t2, %lo(__bss_start)
@ -103,7 +102,6 @@ modulesmovcont:
b modulesmovcont
addiu $t3, $t3, -1
modulesmovdone:
#endif
/* Clean BSS. */

View file

@ -19,7 +19,7 @@
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x881ffff0
#ifndef ASM_FILE

View file

@ -80,7 +80,7 @@
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x88200000
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32

View file

@ -387,8 +387,7 @@ struct image_target_desc image_targets[] =
.voidp_sizeof = 4,
.bigendian = 1,
.id = IMAGE_MIPS_ARC,
.flags = (PLATFORM_FLAGS_DECOMPRESSORS
| PLATFORM_FLAGS_MODULES_BEFORE_KERNEL),
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
.total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
.decompressor_compressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE,
.decompressor_uncompressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE,
@ -1522,12 +1521,10 @@ generate_image (const char *dir, const char *prefix,
program_size = ALIGN_ADDR (core_size);
if (comp == COMPRESSION_NONE)
target_addr = (image_target->link_addr
- total_module_size - decompress_size);
target_addr = (image_target->link_addr - decompress_size);
else
target_addr = (image_target->link_addr
- ALIGN_UP(total_module_size + core_size, 1048576)
- (1 << 20));
target_addr = ALIGN_UP (image_target->link_addr
+ kernel_size + total_module_size, 32);
ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section));
grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section));