svn commit: r261942 - projects/arm64/sys/boot/arm64/efi
Andrew Turner
andrew at FreeBSD.org
Sat Feb 15 18:07:32 UTC 2014
Author: andrew
Date: Sat Feb 15 18:07:31 2014
New Revision: 261942
URL: http://svnweb.freebsd.org/changeset/base/261942
Log:
Implement elf64_exec on arm64.
Modified:
projects/arm64/sys/boot/arm64/efi/exec.c
Modified: projects/arm64/sys/boot/arm64/efi/exec.c
==============================================================================
--- projects/arm64/sys/boot/arm64/efi/exec.c Sat Feb 15 18:06:49 2014 (r261941)
+++ projects/arm64/sys/boot/arm64/efi/exec.c Sat Feb 15 18:07:31 2014 (r261942)
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
#include <efi.h>
#include <efilib.h>
+#include "libarm64.h"
+
static int elf64_exec(struct preloaded_file *amp);
static int elf64_obj_exec(struct preloaded_file *amp);
@@ -55,8 +57,38 @@ struct file_format *file_formats[] = {
static int
elf64_exec(struct preloaded_file *fp)
{
- printf("elf64_exec\n");
- return (EINVAL);
+ struct file_metadata *md;
+ EFI_STATUS status;
+ UINTN descsz, memmapsz, mapkey;
+ UINT32 descver;
+ Elf_Ehdr *ehdr;
+ void (*entry)(void *);
+
+ if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
+ return(EFTYPE);
+
+ ehdr = (Elf_Ehdr *)&(md->md_data);
+
+ entry = arm64_efi_translate(ehdr->e_entry);
+
+ memmapsz = 0;
+ status = BS->GetMemoryMap(&memmapsz, NULL, &mapkey, &descsz, &descver);
+ if (EFI_ERROR(status) && status != EFI_BUFFER_TOO_SMALL) {
+ printf("%s: GetMemoryMap() returned 0x%lx\n", __func__,
+ (long)status);
+ return (EINVAL);
+ }
+
+ status = BS->ExitBootServices(IH, mapkey);
+ if (EFI_ERROR(status)) {
+ printf("%s: ExitBootServices() returned 0x%lx\n", __func__,
+ (long)status);
+ return (EINVAL);
+ }
+
+ /* TODO: Pass the required metadata to the kernel */
+ (*entry)(NULL);
+ panic("exec returned");
}
static int
More information about the svn-src-projects
mailing list