Add is_fcode(), is_forth() and is_aout() functions which take a pointer to an area of memory which may contain a valid loader

image.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@719 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-03-28 20:55:10 +00:00
committed by Mark Cave-Ayland
parent dc5c530885
commit c60fad9646
6 changed files with 33 additions and 11 deletions

View File

@@ -58,6 +58,15 @@ static int check_mem_ranges(struct sys_info *info,
return 0;
}
int is_aout(struct exec *ehdr)
{
return ((ehdr->a_info & 0xffff) == OMAGIC
|| (ehdr->a_info & 0xffff) == NMAGIC
|| (ehdr->a_info & 0xffff) == ZMAGIC
|| (ehdr->a_info & 0xffff) == QMAGIC);
}
int aout_load(struct sys_info *info, const char *filename)
{
int retval = -1;
@@ -81,11 +90,11 @@ int aout_load(struct sys_info *info, const char *filename)
retval = LOADER_NOT_SUPPORT;
goto out;
}
if (!N_BADMAG(ehdr))
if (is_aout(&ehdr))
break;
}
if (N_BADMAG(ehdr)) {
if (!is_aout(&ehdr)) {
debug("Not a bootable a.out image\n");
retval = LOADER_NOT_SUPPORT;
goto out;