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> 2013-04-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter): * grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter):

View file

@ -73,7 +73,7 @@ kernel = {
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; 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_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK'; mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
@ -372,7 +372,7 @@ image = {
objcopyflags = '-O binary'; objcopyflags = '-O binary';
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_qemu_mips_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'; ldadd = '-lgcc';
cflags = '-Wno-unreachable-code -static-libgcc'; cflags = '-Wno-unreachable-code -static-libgcc';
enable = mips; enable = mips;
@ -388,7 +388,7 @@ image = {
objcopyflags = '-O binary'; objcopyflags = '-O binary';
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
mips_qemu_mips_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'; ldadd = '-lgcc';
cflags = '-static-libgcc'; cflags = '-static-libgcc';
enable = mips; 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"))); extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text")));
grub_addr_t grub_modbase; grub_addr_t grub_modbase;
extern char _end[];
void void
grub_machine_init (void) grub_machine_init (void)
{ {
struct grub_arc_memory_descriptor *cur = NULL; 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 (); grub_console_init_early ();
/* FIXME: measure this. */ /* FIXME: measure this. */
@ -153,10 +157,10 @@ grub_machine_init (void)
start = ((grub_uint64_t) cur->start_page) << 12; start = ((grub_uint64_t) cur->start_page) << 12;
end = ((grub_uint64_t) cur->num_pages) << 12; end = ((grub_uint64_t) cur->num_pages) << 12;
end += start; end += start;
if ((grub_uint64_t) end > ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR if ((grub_uint64_t) start < (modend & 0x1fffffff))
- grub_total_modules_size) & 0x1fffffff)) start = (modend & 0x1fffffff);
end = ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size) if ((grub_uint64_t) end > 0x20000000)
& 0x1fffffff); end = 0x20000000;
if (end > start) if (end > start)
grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000), grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000),
end - start); end - start);

View file

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

View file

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

View file

@ -80,7 +80,7 @@
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10 #define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08 #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 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32

View file

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