/*-
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include <efi.h>
#include <eficonsctl.h>
#include <efilib.h>
#include <stand.h>
static CHAR16 *
{
argp++;
return (argp);
}
static CHAR16 *
{
argp++;
return (argp);
}
void *
{
int i;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
}
return (NULL);
}
{
}
void
{
IH = image_handle;
ST = system_table;
(VOID **)&console_control);
if (status == EFI_SUCCESS)
/* 4GB upper limit, try to leave some space from 1MB */
heap = 0x0000000100000000;
if (status != EFI_SUCCESS)
/* Use exit() from here on... */
if (status != EFI_SUCCESS)
/*
* Pre-process the (optional) load options. If the option string
* is given as an ASCII string, we use a poor man's ASCII to
* Unicode-16 translation. The size of the option string as given
* to us includes the terminating null character. We assume the
* string is an ASCII string if strlen() plus the terminating
* '\0' is less than LoadOptionsSize. Even if all Unicode-16
* characters have the upper 8 bits non-zero, the terminating
* null character will cause a one-off.
* If the string is already in Unicode-16, we make a copy so that
* we know we can always modify the string.
*/
} else {
}
} else
/*
* Use a quick and dirty algorithm to build the argv vector. We
* first count the number of words. Then, after allocating the
* vector, we split the string up. We don't deal with quotes or
* other more advanced shell features.
* The EFI shell will pass the name of the image as the first
* word in the argument list. This does not happen if we're
* loaded by the boot manager. This is not so easy to figure
* out though. The ParentHandle is not always NULL, because
* there can be a function (=image) that will perform the task
* for the boot manager.
*/
/* Part 1: Figure out if we need to add our program name. */
if (!addprog) {
addprog =
sizeof(FILEPATH_DEVICE_PATH)) ? 1 : 0;
if (!addprog) {
/* XXX todo. */
}
}
/* Part 2: count words. */
if (*argp == 0)
break;
argc++;
}
/* Part 3: build vector. */
argc = 0;
if (addprog)
if (*argp == 0)
break;
/* Terminate the words. */
if (*argp != 0)
*argp++ = 0;
}
}