[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[1915] 2008-11-14 Robert Millan <address@hidden>
From: |
Robert Millan |
Subject: |
[1915] 2008-11-14 Robert Millan <address@hidden> |
Date: |
Fri, 14 Nov 2008 19:04:27 +0000 |
Revision: 1915
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1915
Author: robertmh
Date: 2008-11-14 19:04:26 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
2008-11-14 Robert Millan <address@hidden>
* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):
Redefine to match with GRUB_MEMORY_MACHINE_UPPER_START (0x100000). We
don't want to mess with lower memory, because it is used in the Linux
loader.
* loader/i386/linux.c (allocate_pages): Allocate `real_mode_mem' in
an appropiate place in lower memory, between 0x10000 and 0x90000,
like loader/i386/efi/linux.c does. Linux often panics if real_mode_mem
is in our heap (probably as a result of it being corrupted during
decompression).
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/include/grub/i386/coreboot/memory.h
trunk/grub2/loader/i386/linux.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2008-11-14 17:57:39 UTC (rev 1914)
+++ trunk/grub2/ChangeLog 2008-11-14 19:04:26 UTC (rev 1915)
@@ -1,5 +1,18 @@
2008-11-14 Robert Millan <address@hidden>
+ * include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):
+ Redefine to match with GRUB_MEMORY_MACHINE_UPPER_START (0x100000). We
+ don't want to mess with lower memory, because it is used in the Linux
+ loader.
+
+ * loader/i386/linux.c (allocate_pages): Allocate `real_mode_mem' in
+ an appropiate place in lower memory, between 0x10000 and 0x90000,
+ like loader/i386/efi/linux.c does. Linux often panics if real_mode_mem
+ is in our heap (probably as a result of it being corrupted during
+ decompression).
+
+2008-11-14 Robert Millan <address@hidden>
+
* term/i386/pc/serial.c [! GRUB_MACHINE_PCBIOS]
(GRUB_SERIAL_PORT_NUM): Fix misscalculation.
Modified: trunk/grub2/include/grub/i386/coreboot/memory.h
===================================================================
--- trunk/grub2/include/grub/i386/coreboot/memory.h 2008-11-14 17:57:39 UTC
(rev 1914)
+++ trunk/grub2/include/grub/i386/coreboot/memory.h 2008-11-14 19:04:26 UTC
(rev 1915)
@@ -28,9 +28,9 @@
#endif
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640
kiB - 1 kiB */
-#define GRUB_MEMORY_MACHINE_LOWER_SIZE 0xf0000 /* 960
kiB */
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000
/* 1 MiB */
+#define GRUB_MEMORY_MACHINE_LOWER_SIZE
GRUB_MEMORY_MACHINE_UPPER_START
#ifndef ASM_FILE
Modified: trunk/grub2/loader/i386/linux.c
===================================================================
--- trunk/grub2/loader/i386/linux.c 2008-11-14 17:57:39 UTC (rev 1914)
+++ trunk/grub2/loader/i386/linux.c 2008-11-14 19:04:26 UTC (rev 1915)
@@ -142,23 +142,40 @@
real_mode_mem = 0;
prot_mode_mem = 0;
- real_mode_mem = grub_malloc (real_mode_pages << 12);
-
+ auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
+ int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
grub_uint32_t type)
+ {
+ /* We must put real mode code in the traditional space. */
+
+ if (type == GRUB_MACHINE_MEMORY_AVAILABLE
+ && addr <= 0x90000)
+ {
+ if (addr < 0x10000)
+ {
+ size += addr - 0x10000;
+ addr = 0x10000;
+ }
+
+ if (addr + size > 0x90000)
+ size = 0x90000 - addr;
+
+ if (real_size + mmap_size > size)
+ return 0;
+
+ real_mode_mem = (addr + size) - (real_size + mmap_size);
+ return 1;
+ }
+
+ return 0;
+ }
+ grub_machine_mmap_iterate (hook);
if (! real_mode_mem)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate real mode pages");
goto fail;
}
- /* Next, find free pages for the protected mode code. */
- /* XXX what happens if anything is using this address? */
prot_mode_mem = (void *) 0x100000;
- if (! prot_mode_mem)
- {
- grub_error (GRUB_ERR_OUT_OF_MEMORY,
- "cannot allocate protected mode pages");
- goto fail;
- }
grub_dprintf ("linux", "real_mode_mem = %lx, real_mode_pages = %x, "
"prot_mode_mem = %lx, prot_mode_pages = %x\n",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [1915] 2008-11-14 Robert Millan <address@hidden>,
Robert Millan <=