These 4th words were an attempt to allow integration into the boot
loader scripts. However, that path won't be taken after all it seems. Remove this code before it decays into uselessness. Also remove build dependencies on forth no longer needed.
This commit is contained in:
parent
74bb0b0e9a
commit
b28421d5f1
@ -38,6 +38,9 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20180201: Obsolete forth files
|
||||
OLD_FILES+=boot/efi.4th
|
||||
|
||||
# 20180114: new clang import which bumps version from 5.0.1 to 6.0.0.
|
||||
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h
|
||||
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/asan_interface.h
|
||||
|
@ -2,10 +2,6 @@
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
.if ${MK_FORTH} != "no"
|
||||
.include "${BOOTSRC}/ficl.mk"
|
||||
.endif
|
||||
|
||||
LIB= efi
|
||||
WARNS?= 2
|
||||
|
||||
|
@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <uuid.h>
|
||||
#include <stdbool.h>
|
||||
#include "bootstrap.h"
|
||||
#ifdef BOOT_FORTH
|
||||
#include "ficl.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple wrappers to the underlying UEFI functions.
|
||||
@ -375,160 +372,3 @@ command_efi_unset(int argc, char *argv[])
|
||||
}
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
#ifdef BOOT_FORTH
|
||||
/*
|
||||
* FreeBSD's loader interaction words and extras
|
||||
*
|
||||
* efi-setenv ( value n name n guid n attr -- 0 | -1)
|
||||
* efi-getenv ( guid n addr n -- addr' n' | -1 )
|
||||
* efi-unsetenv ( name n guid n'' -- )
|
||||
*/
|
||||
|
||||
/*
|
||||
* efi-setenv
|
||||
* efi-setenv ( value n name n guid n attr -- 0 | -1)
|
||||
*
|
||||
* Set environment variables using the SetVariable EFI runtime service.
|
||||
*
|
||||
* Value and guid are passed through in binary form (so guid needs to be
|
||||
* converted to binary form from its string form). Name is converted from
|
||||
* ASCII to CHAR16. Since ficl doesn't have support for internationalization,
|
||||
* there's no native CHAR16 interface provided.
|
||||
*
|
||||
* attr is an int in the bitmask of the following attributes for this variable.
|
||||
*
|
||||
* 1 Non volatile
|
||||
* 2 Boot service access
|
||||
* 4 Run time access
|
||||
* (corresponding to the same bits in the UEFI spec).
|
||||
*/
|
||||
static void
|
||||
ficlEfiSetenv(FICL_VM *pVM)
|
||||
{
|
||||
char *value = NULL, *guid = NULL;
|
||||
CHAR16 *name = NULL;
|
||||
int i;
|
||||
char *namep, *valuep, *guidp;
|
||||
int names, values, guids, attr;
|
||||
EFI_STATUS status;
|
||||
uuid_t u;
|
||||
uint32_t ustatus;
|
||||
bool error = true;
|
||||
|
||||
#if FICL_ROBUST > 1
|
||||
vmCheckStack(pVM, 6, 0);
|
||||
#endif
|
||||
attr = stackPopINT(pVM->pStack);
|
||||
guids = stackPopINT(pVM->pStack);
|
||||
guidp = (char*)stackPopPtr(pVM->pStack);
|
||||
names = stackPopINT(pVM->pStack);
|
||||
namep = (char*)stackPopPtr(pVM->pStack);
|
||||
values = stackPopINT(pVM->pStack);
|
||||
valuep = (char*)stackPopPtr(pVM->pStack);
|
||||
|
||||
guid = (char*)ficlMalloc(guids);
|
||||
if (guid == NULL)
|
||||
goto out;
|
||||
memcpy(guid, guidp, guids);
|
||||
uuid_from_string(guid, &u, &ustatus);
|
||||
if (ustatus != uuid_s_ok) {
|
||||
stackPushINT(pVM->pStack, -1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
name = ficlMalloc((names + 1) * sizeof(CHAR16));
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
for (i = 0; i < names; i++)
|
||||
name[i] = namep[i];
|
||||
name[names] = 0;
|
||||
|
||||
value = ficlMalloc(values + 1);
|
||||
if (value == NULL)
|
||||
goto out;
|
||||
memcpy(value, valuep, values);
|
||||
|
||||
status = efi_set_variable(name, (EFI_GUID *)&u, attr, values, value);
|
||||
if (status == EFI_SUCCESS)
|
||||
stackPushINT(pVM->pStack, 0);
|
||||
else
|
||||
stackPushINT(pVM->pStack, -1);
|
||||
error = false;
|
||||
out:
|
||||
ficlFree(name);
|
||||
ficlFree(value);
|
||||
ficlFree(guid);
|
||||
|
||||
if (error == true)
|
||||
vmThrowErr(pVM, "Error: out of memory");
|
||||
}
|
||||
|
||||
static void
|
||||
ficlEfiGetenv(FICL_VM *pVM)
|
||||
{
|
||||
char *name, *value;
|
||||
char *namep;
|
||||
int names;
|
||||
|
||||
#if FICL_ROBUST > 1
|
||||
vmCheckStack(pVM, 2, 2);
|
||||
#endif
|
||||
names = stackPopINT(pVM->pStack);
|
||||
namep = (char*) stackPopPtr(pVM->pStack);
|
||||
|
||||
name = (char*) ficlMalloc(names+1);
|
||||
if (name == NULL)
|
||||
vmThrowErr(pVM, "Error: out of memory");
|
||||
strncpy(name, namep, names);
|
||||
name[names] = '\0';
|
||||
|
||||
value = getenv(name);
|
||||
ficlFree(name);
|
||||
|
||||
if(value != NULL) {
|
||||
stackPushPtr(pVM->pStack, value);
|
||||
stackPushINT(pVM->pStack, strlen(value));
|
||||
} else
|
||||
stackPushINT(pVM->pStack, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
ficlEfiUnsetenv(FICL_VM *pVM)
|
||||
{
|
||||
char *name;
|
||||
char *namep;
|
||||
int names;
|
||||
|
||||
#if FICL_ROBUST > 1
|
||||
vmCheckStack(pVM, 2, 0);
|
||||
#endif
|
||||
names = stackPopINT(pVM->pStack);
|
||||
namep = (char*) stackPopPtr(pVM->pStack);
|
||||
|
||||
name = (char*) ficlMalloc(names+1);
|
||||
if (name == NULL)
|
||||
vmThrowErr(pVM, "Error: out of memory");
|
||||
strncpy(name, namep, names);
|
||||
name[names] = '\0';
|
||||
|
||||
unsetenv(name);
|
||||
ficlFree(name);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
** Add FreeBSD UEFI platform extensions into the system dictionary
|
||||
**************************************************************************/
|
||||
void ficlEfiCompilePlatform(FICL_SYSTEM *pSys)
|
||||
{
|
||||
FICL_DICT *dp = pSys->dp;
|
||||
assert (dp);
|
||||
|
||||
dictAppendWord(dp, "efi-setenv", ficlEfiSetenv, FW_DEFAULT);
|
||||
dictAppendWord(dp, "efi-getenv", ficlEfiGetenv, FW_DEFAULT);
|
||||
dictAppendWord(dp, "efi-unsetenv", ficlEfiUnsetenv, FW_DEFAULT);
|
||||
}
|
||||
|
||||
FICL_COMPILE_SET(ficlEfiCompilePlatform);
|
||||
|
||||
#endif /* BOOT_FORTH */
|
||||
|
@ -19,7 +19,6 @@ FILES+= brand-fbsd.4th
|
||||
FILES+= check-password.4th
|
||||
FILES+= color.4th
|
||||
FILES+= delay.4th
|
||||
FILES+= efi.4th
|
||||
FILES+= frames.4th
|
||||
FILES+= loader.4th
|
||||
FILES+= logo-beastie.4th
|
||||
|
@ -46,9 +46,6 @@ include /boot/support.4th
|
||||
include /boot/color.4th
|
||||
include /boot/delay.4th
|
||||
include /boot/check-password.4th
|
||||
s" efi-version" getenv? [if]
|
||||
include /boot/efi.4th
|
||||
[then]
|
||||
|
||||
only forth definitions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user