/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* This is an emulation of EFI runtime services.
This allows a more uniform boot on i386 machines.
As it emulates only runtime service it isn't able
to chainload EFI bootloader on non-EFI system. */
GRUB_MOD_LICENSE ("GPLv3+");
/* System table. Two version depending on mode */
/* Modules may need to execute some actions after memory allocation happens */
/* Linked list of configuration tables */
static int prepared = 0;
/* Free all allocated space */
grub_efiemu_unload (void)
{
{
cur = d;
}
efiemu_config_tables = 0;
{
}
efiemu_prepare_hooks = 0;
prepared = 0;
return GRUB_ERR_NONE;
}
/* Remove previously registered table from the list */
{
/* Special treating if head is to remove */
while (efiemu_config_tables
{
if (efiemu_config_tables->unload)
}
if (!efiemu_config_tables)
return GRUB_ERR_NONE;
/* Remove from chain */
{
}
else
{
}
return GRUB_ERR_NONE;
}
void *data)
{
if (! hook)
if (! nhook)
return GRUB_ERR_NONE;
}
/* Register a configuration table either supplying the address directly
or with a hook
*/
void *data)
{
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"you must set at least get_table or data");
if (err)
return err;
if (! tbl)
return GRUB_ERR_NONE;
}
static grub_err_t
{
return grub_efiemu_unload ();
}
static grub_err_t
{
return grub_efiemu_prepare ();
}
/* Load the runtime from the file FILENAME. */
static grub_err_t
{
if (! file)
return grub_errno;
err = grub_efiemu_mm_init ();
if (err)
{
}
if (err)
{
return err;
}
/* For configuration tables entry in system table. */
return GRUB_ERR_NONE;
}
grub_efiemu_autocore (void)
{
const char *prefix;
char *filename;
const char *suffix;
if (grub_efiemu_sizeof_uintn_t () != 0)
return GRUB_ERR_NONE;
if (! prefix)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
"couldn't find efiemu core because prefix "
"isn't set");
if (! filename)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"couldn't allocate temporary space");
if (err)
return err;
#ifndef GRUB_MACHINE_EMU
if (err)
return err;
#endif
return GRUB_ERR_NONE;
}
grub_efiemu_prepare (void)
{
if (prepared)
return GRUB_ERR_NONE;
err = grub_efiemu_autocore ();
if (err)
return err;
8 * grub_efiemu_sizeof_uintn_t ());
/* Create NVRAM. */
prepared = 1;
if (grub_efiemu_sizeof_uintn_t () == 4)
else
}
static grub_err_t
{
if (argc != 1)
if (err)
return err;
#ifndef GRUB_MACHINE_EMU
if (err)
return err;
#endif
return GRUB_ERR_NONE;
}
{
N_("FILE"),
N_("Load and initialize EFI emulator."));
0,
N_("Finalize loading of EFI emulator."));
0,
N_("Unload EFI emulator."));
}
{
}