[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub_machine_fini

From: Hollis Blanchard
Subject: Re: grub_machine_fini
Date: Thu, 7 Apr 2005 10:31:53 -0500

On Feb 15, 2005, at 2:41 PM, Marco Gerards wrote:

"Yoshinori K. Okuji" <address@hidden> writes:

I added a new function grub_machine_fini which is an arch-specific
function. This function is not called automatically, and used only for
grub-emu at the moment. I implemented this function for grub-emu and

This function should be implemented for all architectures, and should be
called before GRUB exits. I think it is unnecessary to call this
function from reboot or halt, because the machine should be reset
completely in this case. So this should be called maybe only from boot.

This sounds useful.  On the PPC this should be used to free memory, I
think.  I don't think this is required for linux, so it is not
implemented yet.

I discovered that this was the source of my boot failures. This is PPC's grub_machine_fini:
grub_machine_fini (void)
  grub_ofdisk_fini ();
  grub_console_fini ();

  grub_ieee1275_release (grub_heap_start, grub_heap_len);
  /* XXX Release memory claimed for Old World firmware.  */

The thing is, modules were loaded into heap memory. When we "release" that memory, Apple OF (remember, running in translated mode) unmaps it or makes it otherwise inaccessible. The very next function called after grub_machine_fini is the boot function pointer, which points into a module. Some sort of exception occurs (probably a "missing instruction mapping"), causing OF to fall over (and it's impossible to get any debug info).

In other words, either:
- the boot function must be part of the core, not in a module
- or we cannot release heap memory

If we remove the release call, then all that's left are those two _fini calls, which do almost nothing themselves. Also, we may want to print debug messages after this point, so grub_console_fini doesn't make sense here (luckily it doesn't actually stop grub_printf from working)...

So I'm not sure how to use grub_machine_fini properly...?

The good news is that when I comment out the release call, I can boot Linux again.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]