You need to transform the code which switches to i386 into a trampoline in
i386/efi/linux.c and i386/linux.c. I have no time to do it now. However I
attach 2 patches with this mail which should help you. Apply only one of
them (each of them tries a quick hack in a different way).

On Thu, Apr 23, 2009 at 12:05 PM, decoder <deco...@own-hero.net> wrote:

> Hi,
>
>
> yes I am compiling grub on a 64 bit kernel and with x86_64 as target
> (--with-platform=efi --target=x86_64)
>
> Compiling on a 32 bit machine does not succeed because the Xserve 2,1 does
> not accept 32 bit EFI images.
>
> Best regards,
>
>
>
> Chris
>
>
>
> Chip Panarchy wrote:
>
>> Hello
>>
>> I don't know much about this.
>>
>> However, you're compiling it on a 64-bit kernel, right?
>>
>> The limitation you are talking about is the 32-bit 2 64-bit
>> limitation. 32-bit only supports up to 3.25GB of RAM.
>>
>> Have you tried compiling it on 32-bit os? That may (for some reason)
>> fix the problem.
>>
>> Give it a go.
>>
>> Panarchy
>>
>>
>> ---------- Forwarded message ----------
>> From: decoder <deco...@own-hero.net>
>> Date: Thu, Apr 23, 2009 at 7:49 PM
>> Subject: Grub2 SVN on 64bit Xserve 2,1
>> To: grub-devel@gnu.org
>> Cc: st_ad...@st.cs.uni-saarland.de
>>
>>
>> Hello all,
>>
>>
>> recently, we tried to use Grub2 SVN on a 64bit Apple Xserve (Model
>> 2,1) using EFI and after Bean solved some Xserve specific problems
>> that were discussed on the Ubuntu forums
>> (http://ubuntuforums.org/showthread.php?t=995704) someone else finally
>> managed to boot his Xserve 2,1 model with Grub2.
>>
>> Ours however, did not boot and we isolated the problem to be a memory
>> problem: When we plug in 4 GB or more, Grub2 fails (when you finally
>> type "boot" on the command line, the machine instantly reboots). If we
>> remove all but 2 GB of RAM, it works and we managed to boot a Debian
>> kernel. So this seems to be a bug which only appears on this type of
>> machine with >= 4GB of RAM.
>>
>>
>> Unfortunately, I haven't found a way yet to get any debug output for
>> you from the machine (serial console doesn't seem to be supported in
>> EFI). If there is anything we can do to get this bug solved, please
>> let us know.
>>
>> If this is the wrong list for this discussion, I'm sorry, I wasn't
>> sure which list discusses Grub2 SVN bugs/problems :)
>>
>>
>>
>> Thanks in advance,
>>
>>
>>
>> Christian Holler
>> System Administrator
>>
>> Saarland University
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>
>>
>>
>> On Thu, Apr 23, 2009 at 7:49 PM, decoder <deco...@own-hero.net> wrote:
>>
>>
>>> Hello all,
>>>
>>>
>>> recently, we tried to use Grub2 SVN on a 64bit Apple Xserve (Model 2,1)
>>> using EFI and after Bean solved some Xserve specific problems that were
>>> discussed on the Ubuntu forums
>>> (http://ubuntuforums.org/showthread.php?t=995704) someone else finally
>>> managed to boot his Xserve 2,1 model with Grub2.
>>>
>>> Ours however, did not boot and we isolated the problem to be a memory
>>> problem: When we plug in 4 GB or more, Grub2 fails (when you finally type
>>> "boot" on the command line, the machine instantly reboots). If we remove
>>> all
>>> but 2 GB of RAM, it works and we managed to boot a Debian kernel. So this
>>> seems to be a bug which only appears on this type of machine with >= 4GB
>>> of
>>> RAM.
>>>
>>>
>>> Unfortunately, I haven't found a way yet to get any debug output for you
>>> from the machine (serial console doesn't seem to be supported in EFI). If
>>> there is anything we can do to get this bug solved, please let us know.
>>>
>>> If this is the wrong list for this discussion, I'm sorry, I wasn't sure
>>> which list discusses Grub2 SVN bugs/problems :)
>>>
>>>
>>>
>>> Thanks in advance,
>>>
>>>
>>>
>>> Christian Holler
>>> System Administrator
>>>
>>> Saarland University
>>>
>>> _______________________________________________
>>> Grub-devel mailing list
>>> Grub-devel@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
diff --git a/loader/i386/efi/linux.c b/loader/i386/efi/linux.c
index 100b268..ccf4960 100644
--- a/loader/i386/efi/linux.c
+++ b/loader/i386/efi/linux.c
@@ -418,9 +418,6 @@ grub_linux_boot (void)
   /* Hardware interrupts are not safe any longer.  */
   asm volatile ("cli" : : );
   
-  /* Load the IDT and the GDT for the bootstrap.  */
-  asm volatile ("lidt %0" : : "m" (idt_desc));
-  asm volatile ("lgdt %0" : : "m" (gdt_desc));
 
 #ifdef __x86_64__
 
@@ -430,10 +427,19 @@ grub_linux_boot (void)
   asm volatile ( "mov %0, %%rbx" : : "m" (params->code32_start));
   asm volatile ( "mov %0, %%rsi" : : "m" (real_mode_mem));
 
+  /* Load the IDT and the GDT for the bootstrap.  */
+  asm volatile ("lidt %0" : : "m" (idt_desc));
+  asm volatile ("lgdt %0" : : "m" (gdt_desc));
+
   asm volatile ( "ljmp *%0" : : "m" (jumpvector));
 
 #else
 
+  /* Load the IDT and the GDT for the bootstrap.  */
+  asm volatile ("lidt %0" : : "m" (idt_desc));
+  asm volatile ("lgdt %0" : : "m" (gdt_desc));
+
+
   /* Pass parameters.  */
   asm volatile ("movl %0, %%ecx" : : "m" (params->code32_start));
   asm volatile ("movl %0, %%esi" : : "m" (real_mode_mem));
diff --git a/kern/efi/mm.c b/kern/efi/mm.c
index 35b12ab..d845ec3 100644
--- a/kern/efi/mm.c
+++ b/kern/efi/mm.c
@@ -73,7 +73,10 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
     type = GRUB_EFI_ALLOCATE_ADDRESS;
 #else
   if (address == 0)
-    type = GRUB_EFI_ALLOCATE_ANY_PAGES;
+    {
+      type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
+      address = 0xffffffff;
+    }
   else
     type = GRUB_EFI_ALLOCATE_ADDRESS;
 #endif
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to