/* Export pnvram and some variables for runtime */
/*
* 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/>.
*/
/* Place for final location of variables */
static int nvram_handle = 0;
static int nvramsize_handle = 0;
static int high_monotonic_count_handle = 0;
static int timezone_handle = 0;
static int accuracy_handle = 0;
static int daylight_handle = 0;
/* Parse signed value */
static int
{
if (arg[0] == '-')
}
static inline int
hextoval (char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'z')
return c - 'a' + 10;
if (c >= 'A' && c <= 'Z')
return c - 'A' + 10;
return 0;
}
static inline grub_err_t
{
{
ptr += 3;
dptr++;
}
else
{
ptr++;
dptr++;
}
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
return 0;
}
/* Export stuff for efiemu */
static grub_err_t
{
const char *env;
/* Take definitive pointers */
char *nvramptr;
{
int len = 0;
int i;
sizeof ("EfiEmu.pnvram.") - 1) != 0)
return 0;
if (!attr)
return 0;
attr++;
if (!name)
return 0;
name++;
{
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
return 1;
}
nvramptr += sizeof (struct efi_variable);
if (*guid != '-')
return 0;
guid++;
if (*guid != '-')
return 0;
guid++;
if (*guid != '-')
return 0;
guid++;
for (i = 0; i < 8; i++)
if (! varname)
return 1;
return 1;
if (len < 0)
{
return 1;
}
*((grub_uint16_t *) nvramptr) = 0;
nvramptr += 2;
{
return 1;
}
return 0;
}
/* Copy to definitive loaction */
if (grub_errno)
return grub_errno;
/* Register symbols */
grub_efiemu_register_symbol ("efiemu_high_monotonic_count",
grub_efiemu_register_symbol ("efiemu_time_accuracy",
accuracy_handle, 0);
return GRUB_ERR_NONE;
}
static void
{
}
grub_efiemu_pnvram (void)
{
const char *size;
nvramsize = 0;
if (size)
if (!nvramsize)
nvramsize = 2048;
if (err)
return err;
return GRUB_ERR_NONE;
}