+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):
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';
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;
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;
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. */
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);
#endif
/* Move the modules out of BSS. */
-#ifndef GRUB_MACHINE_ARC
lui $t2, %hi(__bss_start)
addiu $t2, %lo(__bss_start)
b modulesmovcont
addiu $t3, $t3, -1
modulesmovdone:
-#endif
/* Clean BSS. */
#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
#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
.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,
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));