|
|
f96e0b |
From 55cfcbed53dc997ad669d3f8cd95fbe25b6e2aab Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Wed, 24 Apr 2013 13:54:17 +0200
|
|
|
f96e0b |
Subject: [PATCH 335/482] Move mips-arc link address. Previous link
|
|
|
f96e0b |
address was chosen in belief that RAM on SGI platforms grows down while
|
|
|
f96e0b |
in fact it grows up from an unusual base.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 6 ++++++
|
|
|
f96e0b |
grub-core/Makefile.core.def | 6 +++---
|
|
|
f96e0b |
grub-core/kern/mips/arc/init.c | 14 +++++++++-----
|
|
|
f96e0b |
grub-core/kern/mips/startup.S | 2 --
|
|
|
f96e0b |
include/grub/mips/arc/memory.h | 2 +-
|
|
|
f96e0b |
include/grub/offsets.h | 2 +-
|
|
|
f96e0b |
util/grub-mkimage.c | 11 ++++-------
|
|
|
f96e0b |
7 files changed, 24 insertions(+), 19 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index 2150d3d..39bb827 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,3 +1,9 @@
|
|
|
f96e0b |
+2013-04-24 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ Move mips-arc link address. Previous link address was chosen
|
|
|
f96e0b |
+ in belief that RAM on SGI platforms grows down while in fact it
|
|
|
f96e0b |
+ grows up from an unusual base.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
2013-04-21 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
* grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter):
|
|
|
f96e0b |
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
|
|
f96e0b |
index 7269609..8f36ea0 100644
|
|
|
f96e0b |
--- a/grub-core/Makefile.core.def
|
|
|
f96e0b |
+++ b/grub-core/Makefile.core.def
|
|
|
f96e0b |
@@ -73,7 +73,7 @@ kernel = {
|
|
|
f96e0b |
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
|
|
|
f96e0b |
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
|
|
|
f96e0b |
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
|
|
|
f96e0b |
- mips_arc_ldflags = '-Wl,-Ttext,0x8bd00000';
|
|
|
f96e0b |
+ mips_arc_ldflags = '-Wl,-Ttext,0x88200000';
|
|
|
f96e0b |
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
|
|
f96e0b |
|
|
|
f96e0b |
mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
|
|
|
f96e0b |
@@ -372,7 +372,7 @@ image = {
|
|
|
f96e0b |
objcopyflags = '-O binary';
|
|
|
f96e0b |
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
|
|
f96e0b |
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
|
|
f96e0b |
- mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
|
|
f96e0b |
+ mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
|
|
|
f96e0b |
ldadd = '-lgcc';
|
|
|
f96e0b |
cflags = '-Wno-unreachable-code -static-libgcc';
|
|
|
f96e0b |
enable = mips;
|
|
|
f96e0b |
@@ -388,7 +388,7 @@ image = {
|
|
|
f96e0b |
objcopyflags = '-O binary';
|
|
|
f96e0b |
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
|
|
f96e0b |
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
|
|
f96e0b |
- mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
|
|
f96e0b |
+ mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
|
|
|
f96e0b |
ldadd = '-lgcc';
|
|
|
f96e0b |
cflags = '-static-libgcc';
|
|
|
f96e0b |
enable = mips;
|
|
|
f96e0b |
diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c
|
|
|
f96e0b |
index f63ac6d..011c63f 100644
|
|
|
f96e0b |
--- a/grub-core/kern/mips/arc/init.c
|
|
|
f96e0b |
+++ b/grub-core/kern/mips/arc/init.c
|
|
|
f96e0b |
@@ -128,12 +128,16 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
|
|
f96e0b |
extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text")));
|
|
|
f96e0b |
grub_addr_t grub_modbase;
|
|
|
f96e0b |
|
|
|
f96e0b |
+extern char _end[];
|
|
|
f96e0b |
+
|
|
|
f96e0b |
void
|
|
|
f96e0b |
grub_machine_init (void)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct grub_arc_memory_descriptor *cur = NULL;
|
|
|
f96e0b |
+ grub_addr_t modend;
|
|
|
f96e0b |
|
|
|
f96e0b |
- grub_modbase = GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size;
|
|
|
f96e0b |
+ grub_modbase = ALIGN_UP ((grub_addr_t) _end, GRUB_KERNEL_MACHINE_MOD_ALIGN);
|
|
|
f96e0b |
+ modend = grub_modbase + grub_total_modules_size;
|
|
|
f96e0b |
grub_console_init_early ();
|
|
|
f96e0b |
|
|
|
f96e0b |
/* FIXME: measure this. */
|
|
|
f96e0b |
@@ -153,10 +157,10 @@ grub_machine_init (void)
|
|
|
f96e0b |
start = ((grub_uint64_t) cur->start_page) << 12;
|
|
|
f96e0b |
end = ((grub_uint64_t) cur->num_pages) << 12;
|
|
|
f96e0b |
end += start;
|
|
|
f96e0b |
- if ((grub_uint64_t) end > ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR
|
|
|
f96e0b |
- - grub_total_modules_size) & 0x1fffffff))
|
|
|
f96e0b |
- end = ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size)
|
|
|
f96e0b |
- & 0x1fffffff);
|
|
|
f96e0b |
+ if ((grub_uint64_t) start < (modend & 0x1fffffff))
|
|
|
f96e0b |
+ start = (modend & 0x1fffffff);
|
|
|
f96e0b |
+ if ((grub_uint64_t) end > 0x20000000)
|
|
|
f96e0b |
+ end = 0x20000000;
|
|
|
f96e0b |
if (end > start)
|
|
|
f96e0b |
grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000),
|
|
|
f96e0b |
end - start);
|
|
|
f96e0b |
diff --git a/grub-core/kern/mips/startup.S b/grub-core/kern/mips/startup.S
|
|
|
f96e0b |
index 2476038..35a11bc 100644
|
|
|
f96e0b |
--- a/grub-core/kern/mips/startup.S
|
|
|
f96e0b |
+++ b/grub-core/kern/mips/startup.S
|
|
|
f96e0b |
@@ -73,7 +73,6 @@ cont:
|
|
|
f96e0b |
#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
/* Move the modules out of BSS. */
|
|
|
f96e0b |
-#ifndef GRUB_MACHINE_ARC
|
|
|
f96e0b |
lui $t2, %hi(__bss_start)
|
|
|
f96e0b |
addiu $t2, %lo(__bss_start)
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -103,7 +102,6 @@ modulesmovcont:
|
|
|
f96e0b |
b modulesmovcont
|
|
|
f96e0b |
addiu $t3, $t3, -1
|
|
|
f96e0b |
modulesmovdone:
|
|
|
f96e0b |
-#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
/* Clean BSS. */
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/include/grub/mips/arc/memory.h b/include/grub/mips/arc/memory.h
|
|
|
f96e0b |
index b960d2a..68b425f 100644
|
|
|
f96e0b |
--- a/include/grub/mips/arc/memory.h
|
|
|
f96e0b |
+++ b/include/grub/mips/arc/memory.h
|
|
|
f96e0b |
@@ -19,7 +19,7 @@
|
|
|
f96e0b |
#ifndef GRUB_MEMORY_MACHINE_HEADER
|
|
|
f96e0b |
#define GRUB_MEMORY_MACHINE_HEADER 1
|
|
|
f96e0b |
|
|
|
f96e0b |
-#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0
|
|
|
f96e0b |
+#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x881ffff0
|
|
|
f96e0b |
|
|
|
f96e0b |
#ifndef ASM_FILE
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/include/grub/offsets.h b/include/grub/offsets.h
|
|
|
f96e0b |
index bce755d..1e673d5 100644
|
|
|
f96e0b |
--- a/include/grub/offsets.h
|
|
|
f96e0b |
+++ b/include/grub/offsets.h
|
|
|
f96e0b |
@@ -80,7 +80,7 @@
|
|
|
f96e0b |
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
|
|
|
f96e0b |
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
|
|
|
f96e0b |
|
|
|
f96e0b |
-#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000
|
|
|
f96e0b |
+#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x88200000
|
|
|
f96e0b |
|
|
|
f96e0b |
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
|
|
|
f96e0b |
index 0acc61e..41f795a 100644
|
|
|
f96e0b |
--- a/util/grub-mkimage.c
|
|
|
f96e0b |
+++ b/util/grub-mkimage.c
|
|
|
f96e0b |
@@ -387,8 +387,7 @@ struct image_target_desc image_targets[] =
|
|
|
f96e0b |
.voidp_sizeof = 4,
|
|
|
f96e0b |
.bigendian = 1,
|
|
|
f96e0b |
.id = IMAGE_MIPS_ARC,
|
|
|
f96e0b |
- .flags = (PLATFORM_FLAGS_DECOMPRESSORS
|
|
|
f96e0b |
- | PLATFORM_FLAGS_MODULES_BEFORE_KERNEL),
|
|
|
f96e0b |
+ .flags = PLATFORM_FLAGS_DECOMPRESSORS,
|
|
|
f96e0b |
.total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
|
|
|
f96e0b |
.decompressor_compressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE,
|
|
|
f96e0b |
.decompressor_uncompressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE,
|
|
|
f96e0b |
@@ -1522,12 +1521,10 @@ generate_image (const char *dir, const char *prefix,
|
|
|
f96e0b |
|
|
|
f96e0b |
program_size = ALIGN_ADDR (core_size);
|
|
|
f96e0b |
if (comp == COMPRESSION_NONE)
|
|
|
f96e0b |
- target_addr = (image_target->link_addr
|
|
|
f96e0b |
- - total_module_size - decompress_size);
|
|
|
f96e0b |
+ target_addr = (image_target->link_addr - decompress_size);
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- target_addr = (image_target->link_addr
|
|
|
f96e0b |
- - ALIGN_UP(total_module_size + core_size, 1048576)
|
|
|
f96e0b |
- - (1 << 20));
|
|
|
f96e0b |
+ target_addr = ALIGN_UP (image_target->link_addr
|
|
|
f96e0b |
+ + kernel_size + total_module_size, 32);
|
|
|
f96e0b |
|
|
|
f96e0b |
ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section));
|
|
|
f96e0b |
grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section));
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|