Index: bootcd/isolinux/syslinux-6.03/efi/Makefile
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/Makefile	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/Makefile	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,109 @@
+## -----------------------------------------------------------------------
+##
+##   Copyright 2011 Intel Corporation; author: Matt Fleming
+##
+##   This program is free software; you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+##   Boston MA 02111-1307, USA; either version 2 of the License, or
+##   (at your option) any later version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+VPATH = $(SRC)
+include $(MAKEDIR)/lib.mk
+include $(MAKEDIR)/efi.mk
+
+# Upstream gnu-efi has old-style function definitions.
+CFLAGS += -Wno-strict-prototypes
+
+CORE_CSRC := $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c)
+CORE_COBJ := $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o,$(CORE_CSRC)))
+
+# We don't want to include any of the networking stack or the thread
+# code since it will be implemented completely differently for EFI.
+FILTERED_OBJS:= $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o, \
+	$(wildcard $(core)/legacynet/*.c) \
+	$(wildcard $(core)/fs/pxe/*.c) \
+	$(wildcard $(core)/thread/*.c)))
+
+# Don't include unit tests
+FILTERED_OBJS += $(subst $(core),$(OBJ)/../core/, \
+	$(patsubst %.c,%.o,$(shell find $(core) -path "*/tests/*.c" -print)))
+
+# Don't include console objects
+CORE_OBJS = $(filter-out %hello.o %rawcon.o %plaincon.o %strcasecmp.o %bios.o \
+	%diskio_bios.o %ldlinux-c.o %isolinux-c.o %pxelinux-c.o \
+	%localboot.o %pxeboot.o \
+	$(FILTERED_OBJS),$(CORE_COBJ) $(CORE_SOBJ))
+
+CORE_OBJS += $(addprefix $(OBJ)/../core/, \
+	fs/pxe/pxe.o fs/pxe/tftp.o fs/pxe/urlparse.o fs/pxe/dhcp_option.o \
+	fs/pxe/ftp.o fs/pxe/ftp_readdir.o fs/pxe/http.o fs/pxe/http_readdir.o)
+
+LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
+	$(LIBEFI)
+
+CSRC = $(wildcard $(SRC)/*.c)
+OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
+
+OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o
+
+# The DATE is set on the make command line when building binaries for
+# official release.  Otherwise, substitute a hex string that is pretty much
+# guaranteed to be unique to be unique from build to build.
+ifndef HEXDATE
+HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS))
+endif
+ifndef DATE
+DATE    := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE))
+endif
+CFLAGS		+= -DDATE_STR='"$(DATE)"'
+
+.PHONY: subdirs
+subdirs:
+	mkdir -p $(ARCH)
+
+$(OBJS): subdirs
+
+# The targets to build in this directory
+BTARGET  = syslinux.efi
+
+syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
+	$(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
+
+# We need to rename the .hash section because the EFI firmware
+# linker really doesn't like it.
+# $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
+#syslinux.so: syslinux1.so
+#	cp $^ $@
+
+wrapper: wrapper.c
+	$(CC) $^ -o $@
+
+#
+# Build the wrapper app and wrap our .so to produce a .efi
+syslinux.efi: syslinux.so wrapper
+	$(OBJ)/wrapper syslinux.so $@
+
+all: $(BTARGET)
+
+codepage.o: ../codepage/cp865.cp
+	cp $(objdir)/../codepage/cp865.cp codepage.cp
+	$(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S
+
+install:
+	install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR)
+
+strip:
+
+tidy dist:
+	rm -f *.so *.o wrapper
+	find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
+		xargs -0r rm -f
+	$(topdir)/efi/clean-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
+
+clean: tidy
+
+spotless: clean
+	rm -f $(BTARGET)
Index: bootcd/isolinux/syslinux-6.03/efi/adv.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/adv.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/adv.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,297 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2012 Intel Corporation; author: H. Peter Anvin
+ *   Chandramouli Narayanan
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ *   Boston MA 02111-1307, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * adv.c
+ *
+ * Core ADV I/O
+ * Code consolidated from libinstaller/adv*.c and core/adv.inc with the
+ * addition of EFI support
+ *
+ * Return 0 on success, -1 on error, and set errno.
+ *
+ */
+#define  _GNU_SOURCE
+
+#include <syslinux/config.h>
+#include <string.h>
+#include "adv.h"
+
+unsigned char syslinux_adv[2 * ADV_SIZE];
+
+static void cleanup_adv(unsigned char *advbuf)
+{
+    int i;
+    uint32_t csum;
+
+    /* Make sure both copies agree, and update the checksum */
+    *(uint32_t *)advbuf =  ADV_MAGIC1;
+
+    csum = ADV_MAGIC2;
+    for (i = 8; i < ADV_SIZE - 4; i += 4)
+	csum -= *(uint32_t *)(advbuf + i);
+
+    *(uint32_t *)(advbuf + 4) =  csum;
+    *(uint32_t *)(advbuf + ADV_SIZE - 4) =  ADV_MAGIC3;
+
+    memcpy(advbuf + ADV_SIZE, advbuf, ADV_SIZE);
+}
+
+void syslinux_reset_adv(unsigned char *advbuf)
+{
+    /* Create an all-zero ADV */
+    memset(advbuf + 2 * 4, 0, ADV_LEN);
+    cleanup_adv(advbuf);
+}
+
+static int adv_consistent(const unsigned char *p)
+{
+    int i;
+    uint32_t csum;
+
+    if (*(uint32_t *)p != ADV_MAGIC1 ||
+	*(uint32_t *)(p + ADV_SIZE - 4) != ADV_MAGIC3)
+	return 0;
+
+    csum = 0;
+    for (i = 4; i < ADV_SIZE - 4; i += 4)
+	csum += *(uint32_t *)(p + i);
+
+    return csum == ADV_MAGIC2;
+}
+
+/*
+ * Verify that an in-memory ADV is consistent, making the copies consistent.
+ * If neither copy is OK, return -1 and call syslinux_reset_adv().
+ */
+int syslinux_validate_adv(unsigned char *advbuf)
+{
+    if (adv_consistent(advbuf + 0 * ADV_SIZE)) {
+	memcpy(advbuf + ADV_SIZE, advbuf, ADV_SIZE);
+	return 0;
+    } else if (adv_consistent(advbuf + 1 * ADV_SIZE)) {
+	memcpy(advbuf, advbuf + ADV_SIZE, ADV_SIZE);
+	return 0;
+    } else {
+	syslinux_reset_adv(advbuf);
+	return -1;
+    }
+}
+
+/*
+ * Read the ADV from an existing instance, or initialize if invalid.
+ * Returns -1 on fatal errors, 0 if ADV is okay, 1 if the ADV is
+ * invalid, and 2 if the file does not exist.
+ */
+
+/* make_filespec
+ * Take the ASCII pathname and filename and concatenate them
+ * into an allocated memory space as unicode file specification string.
+ * The path and cfg ASCII strings are assumed to be null-terminated.
+ * For EFI, the separation character in the path name is '\'
+ * and therefore it is assumed that the file spec uses '\' as separation char
+ *
+ * The function returns
+ * 	 0  if successful and fspec is a valid allocated CHAR16 pointer
+ * 	    Caller is responsible to free up the allocated filespec string
+ * 	-1  otherwise
+ *
+ */
+static int make_filespec(CHAR16 **fspec, const char *path, const char *cfg)
+{
+	CHAR16 *p;
+	int size, append;
+
+	/* allocate size for a CHAR16 string */
+	size = sizeof(CHAR16) * (strlena((CHAR8 *)path)+strlena((CHAR8 *)cfg)+2);	/* including null */
+	*fspec = malloc(size);
+	if (!*fspec) return -1;
+
+	append = path[strlena((CHAR8 *)path) - 1] != '\\';
+	for (p = *fspec; *path; path++, p++)
+		*p = (CHAR16)*path;
+	/* append the separation character to the path if need be */
+	if (append) *p++ = (CHAR16)'\\';
+	for (; *cfg; cfg++, p++)
+		*p = (CHAR16)*cfg;
+	*p = (CHAR16)CHAR_NULL;
+
+	return 0;
+}
+
+
+/* TODO:
+ * set_attributes() and clear_attributes() are supported for VFAT only
+ */
+int read_adv(const char *path, const char *cfg)
+{
+    CHAR16 *file;
+    EFI_FILE_HANDLE fd;
+    EFI_FILE_INFO st;
+    int err = 0;
+    int rv;
+
+    rv = make_filespec(&file, path, cfg);
+    if (rv < 0 || !file) {
+	efi_perror(L"read_adv");
+	return -1;
+    }
+
+    /* TBD: Not sure if EFI accepts the attribute read only
+     * even if an existing file is opened for read access
+     */
+    fd = efi_open(file, EFI_FILE_MODE_READ);
+    if (!fd) {
+	if (efi_errno != EFI_NOT_FOUND) {
+	    err = -1;
+	} else {
+	    syslinux_reset_adv(syslinux_adv);
+	    err = 2;		/* Nonexistence is not a fatal error */
+	}
+    } else if (!efi_fstat(fd, &st)) {
+	err = -1;
+    } else if (st.FileSize < 2 * ADV_SIZE) {
+	/* Too small to be useful */
+	syslinux_reset_adv(syslinux_adv);
+	err = 0;		/* Nothing to read... */
+    } else if (efi_xpread(fd, syslinux_adv, 2 * ADV_SIZE,
+		      st.FileSize - 2 * ADV_SIZE) != 2 * ADV_SIZE) {
+	err = -1;
+    } else {
+	/* We got it... maybe? */
+	err = syslinux_validate_adv(syslinux_adv) ? 1 : 0;
+    }
+
+    if (err < 0)
+	efi_perror(file);
+    if (fd)
+	efi_close(fd);
+    free(file);
+
+    return err;
+}
+
+/* For EFI platform, initialize ADV by opening ldlinux.sys
+ * as configured and return the primary (adv0) and alternate (adv1)
+ * data into caller's buffer. File remains open for subsequent
+ * operations. This routine is to be called from comboot vector.
+ */
+void efi_adv_init(void)
+{
+    union syslinux_derivative_info sdi;
+
+    get_derivative_info(&sdi);
+
+    if (sdi.c.filesystem == SYSLINUX_FS_SYSLINUX)
+	read_adv("", SYSLINUX_FILE);
+    else {
+	__syslinux_adv_ptr = &syslinux_adv[8]; /* skip head, csum */
+	__syslinux_adv_size = ADV_LEN;
+
+	syslinux_validate_adv(syslinux_adv);
+    }
+}
+
+/* For EFI platform, write 2 * ADV_SIZE data to the file opened
+ * at ADV initialization. (i.e ldlinux.sys).
+ *
+ * TODO:
+ * 1. Validate assumption: write back to file from __syslinux_adv_ptr
+ * 2. What if there errors?
+ * 3. Do we need to set the attributes of the sys file?
+ *
+ */
+int efi_adv_write(void)
+{
+    char *name;
+    unsigned char advtmp[2 * ADV_SIZE];
+    unsigned char *advbuf = syslinux_adv;
+    int rv;
+    int err = 0;
+    EFI_FILE_HANDLE	fd;	/* handle to ldlinux.sys */
+    CHAR16 *file;
+    EFI_FILE_INFO st, xst;
+    union syslinux_derivative_info sdi;
+
+    get_derivative_info(&sdi);
+    if (sdi.c.filesystem != SYSLINUX_FS_SYSLINUX)
+	return -1;
+
+    name = SYSLINUX_FILE;
+    rv = make_filespec(&file, "", name);
+    if (rv < 0 || !file) {
+	efi_errno = EFI_OUT_OF_RESOURCES;
+	efi_perror(L"efi_adv_write:");
+	return -1;
+    }
+
+    fd = efi_open(file, EFI_FILE_MODE_READ);
+    if (fd == (EFI_FILE_HANDLE)NULL) {
+	err = -1;
+	efi_printerr(L"efi_adv_write: Unable to open file %s\n", file);
+    } else if (efi_fstat(fd, &st)) {
+	err = -1;
+	efi_printerr(L"efi_adv_write: Unable to get info for file %s\n", file);
+    } else if (st.FileSize < 2 * ADV_SIZE) {
+	/* Too small to be useful */
+	err = -2;
+	efi_printerr(L"efi_adv_write: File size too small to be useful for file %s\n", file);
+    } else if (efi_xpread(fd, advtmp, 2 * ADV_SIZE,
+		      st.FileSize - 2 * ADV_SIZE) != 2 * ADV_SIZE) {
+	err = -1;
+	efi_printerr(L"efi_adv_write: Error reading ADV data from file %s\n", file);
+    } else {
+	cleanup_adv(advbuf);
+	err = syslinux_validate_adv(advbuf) ? -2 : 0;
+
+	if (!err) {
+	    /* Got a good one, write our own ADV here */
+	    efi_clear_attributes(fd);
+
+	    /* Need to re-open read-write */
+	    efi_close(fd);
+		/* There is no SYNC attribute with EFI open */
+	    fd = efi_open(file, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE);
+	    if (fd == (EFI_FILE_HANDLE)NULL) {
+		err = -1;
+	    } else if (efi_fstat(fd, &xst) || xst.FileSize != st.FileSize) {
+		efi_perror(L"efi_adv_write: file status error/mismatch");
+		err = -2;
+	    }
+	    /* Write our own version ... */
+	    if (efi_xpwrite(fd, advbuf, 2 * ADV_SIZE,
+			st.FileSize - 2 * ADV_SIZE) != 2 * ADV_SIZE) {
+		err = -1;
+		efi_printerr(L"efi_adv_write: Error write ADV data to file %s\n", file);
+	    }
+	    if (!err) {
+		efi_sync(fd);
+		efi_set_attributes(fd);
+	    }
+	}
+    }
+
+    if (err == -2)
+	efi_printerr(L"%s: cannot write auxilliary data (need --update)?\n",
+		file);
+    else if (err == -1)
+	efi_perror(L"efi_adv_write:");
+
+    if (fd)
+	efi_close(fd);
+    if (file)
+	free(file);
+
+    return err;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/adv.h
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/adv.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/adv.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,27 @@
+#ifndef _H_EFI_ADV_
+#define _H_EFI_ADV_
+
+#include "efi.h"
+#include "fio.h"
+#include <syslinux/firmware.h>
+
+/* ADV information */
+#define ADV_SIZE	512	/* Total size */
+#define ADV_LEN		(ADV_SIZE-3*4)	/* Usable data size */
+#define SYSLINUX_FILE	"ldlinux.sys"
+
+#define ADV_MAGIC1	0x5a2d2fa5	/* Head signature */
+#define ADV_MAGIC2	0xa3041767	/* Total checksum */
+#define ADV_MAGIC3	0xdd28bf64	/* Tail signature */
+
+extern unsigned char syslinux_adv[2 * ADV_SIZE];
+extern void *__syslinux_adv_ptr;
+extern ssize_t __syslinux_adv_size;
+
+/* TODO: Revisit to ensure if these functions need to be exported */
+void syslinux_reset_adv(unsigned char *advbuf);
+int syslinux_validate_adv(unsigned char *advbuf);
+int read_adv(const char *path, const char *cfg);
+int write_adv(const char *path, const char *cfg);
+
+#endif
Index: bootcd/isolinux/syslinux-6.03/efi/build-gnu-efi.sh
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/build-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/build-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -e
+
+# Initialise the gnu-efi submodule and ensure the source is up-to-date.
+# Then build and install it for the given architecture.
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: $0: <arch> <objdir>
+
+Build the <arch> gnu-efi libs and header files and install in <objdir>.
+
+  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
+  <objdir> - The Syslinux object directory
+
+EOF
+    exit 1
+fi
+
+ARCH="$1"
+objdir="$(readlink -f $2)"
+
+if [ ! -e ../version.h ]; then
+    printf "build-gnu-efi.sh: Cannot be run outside Syslinux object tree\n"
+    pwd
+    exit 1
+fi
+
+(
+	cd ../..
+	git submodule update --init
+)
+
+mkdir -p "$objdir/gnu-efi"
+cd "$objdir/gnu-efi"
+
+EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"
+
+make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH
+make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH PREFIX="$objdir" install
+
+cd "$objdir/efi"
Index: bootcd/isolinux/syslinux-6.03/efi/check-gnu-efi.sh
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/check-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/check-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Verify that gnu-efi is installed in the object directory for our
+# firmware. If it isn't, build it.
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: $0: <arch> <objdir>
+
+Check for gnu-efi libraries and header files in <objdir> and, if none
+exist, build and install them.
+
+  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
+  <objdir> - The Syslinux object directory
+
+EOF
+    exit 1
+fi
+
+ARCH=$1
+objdir=$2
+
+if [ ! \( -f "$objdir/include/efi/$ARCH/efibind.h" -a -f "$objdir/lib/libefi.a" -a -f "$objdir/lib/libgnuefi.a" \) ]; then
+    # Build the external project with a clean make environment, as
+    # Syslinux disables built-in implicit rules.
+    export MAKEFLAGS=
+
+    ../../efi/build-gnu-efi.sh $ARCH "$objdir" > /dev/null 2>&1
+    if [ $? -ne 0 ]; then
+	printf "Failed to build gnu-efi. "
+	printf "Execute the following command for full details: \n\n"
+	printf "build-gnu-efi.sh $ARCH $objdir\n\n"
+
+	exit 1
+    fi
+else
+    printf "skip gnu-efi build/install\n"
+fi
Index: bootcd/isolinux/syslinux-6.03/efi/clean-gnu-efi.sh
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/clean-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/clean-gnu-efi.sh	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+# Initialise the gnu-efi submodule and ensure the source is up-to-date.
+# Then build and install it for the given architecture.
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: $0: <arch> <objdir>
+
+Build the <arch> gnu-efi libs and header files and install in <objdir>.
+
+  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
+  <objdir> - The Syslinux object directory
+
+EOF
+    exit 1
+fi
+
+ARCH="$1"
+objdir=$(readlink -f "$2")
+
+(
+	cd ../..
+	git submodule update --init
+)
+
+if [ -d "$objdir/gnu-efi" ];then
+	cd "$objdir/gnu-efi"
+	EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"
+	make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH clean
+fi
+
+cd "$objdir/efi"
Index: bootcd/isolinux/syslinux-6.03/efi/console.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/console.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/console.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2011-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <syslinux/linux.h>
+#include "efi.h"
+#include <string.h>
+
+extern EFI_GUID GraphicsOutputProtocol;
+
+static uint32_t console_default_attribute;
+static bool console_default_cursor;
+
+/*
+ * We want to restore the console state when we boot a kernel or return
+ * to the firmware.
+ */
+void efi_console_save(void)
+{
+    SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+    SIMPLE_TEXT_OUTPUT_MODE *mode = out->Mode;
+
+    console_default_attribute = mode->Attribute;
+    console_default_cursor = mode->CursorVisible;
+}
+
+void efi_console_restore(void)
+{
+    SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+
+    uefi_call_wrapper(out->SetAttribute, 2, out, console_default_attribute);
+    uefi_call_wrapper(out->EnableCursor, 2, out, console_default_cursor);
+}
+
+__export void writechr(char data)
+{
+	efi_write_char(data, 0);
+}
+
+static inline EFI_STATUS open_protocol(EFI_HANDLE handle, EFI_GUID *protocol,
+				       void **interface, EFI_HANDLE agent,
+				       EFI_HANDLE controller, UINT32 attributes)
+{
+	return uefi_call_wrapper(BS->OpenProtocol, 6, handle, protocol,
+				 interface, agent, controller, attributes);
+}
+
+static inline EFI_STATUS
+gop_query_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN *size,
+	       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **info)
+{
+	return uefi_call_wrapper(gop->QueryMode, 4, gop,
+				 gop->Mode->Mode, size, info);
+}
+
+static inline void bit_mask(uint32_t mask, uint8_t *pos, uint8_t *size)
+{
+	*pos = 0;
+	*size = 0;
+
+	if (mask) {
+		while (!(mask & 0x1)) {
+			mask >>= 1;
+			(*pos)++;
+		}
+
+		while (mask & 0x1) {
+			mask >>= 1;
+			(*size)++;
+		}
+	}
+}
+
+static int setup_gop(struct screen_info *si)
+{
+	EFI_HANDLE *handles = NULL;
+	EFI_STATUS status;
+	EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, *found;
+	EFI_GRAPHICS_PIXEL_FORMAT pixel_fmt;
+	EFI_PIXEL_BITMASK pixel_info;
+	uint32_t pixel_scanline;
+	UINTN i, nr_handles;
+	UINTN size;
+	uint16_t lfb_width, lfb_height;
+	uint32_t lfb_base, lfb_size;
+	int err = 0;
+	void **gop_handle = NULL;
+
+	size = 0;
+	status = uefi_call_wrapper(BS->LocateHandle, 5, ByProtocol, &GraphicsOutputProtocol,
+				NULL, &size, gop_handle);
+	/* LibLocateHandle handle already returns the number of handles.
+	 * There is no need to divide by sizeof(EFI_HANDLE)
+	 */
+	status = LibLocateHandle(ByProtocol, &GraphicsOutputProtocol,
+				 NULL, &nr_handles, &handles);
+	if (status == EFI_BUFFER_TOO_SMALL) {
+
+		handles = AllocatePool(nr_handles);
+		if (!handles)
+			return 0;
+
+		status = LibLocateHandle(ByProtocol, &GraphicsOutputProtocol,
+					 NULL, &nr_handles, &handles);
+	}
+	if (status != EFI_SUCCESS)
+		goto out;
+
+	found = NULL;
+	for (i = 0; i < nr_handles; i++) {
+		EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
+		EFI_PCI_IO *pciio = NULL;
+		EFI_HANDLE *h = handles[i];
+
+		status = uefi_call_wrapper(BS->HandleProtocol, 3, h,
+					   &GraphicsOutputProtocol, (void **)&gop);
+		if (status != EFI_SUCCESS)
+			continue;
+		uefi_call_wrapper(BS->HandleProtocol, 3, h,
+				  &PciIoProtocol, (void **)&pciio);
+		status = gop_query_mode(gop, &size, &info);
+		if (status == EFI_SUCCESS && (!found || pciio)) {
+			lfb_width = info->HorizontalResolution;
+			lfb_height = info->VerticalResolution;
+			lfb_base = gop->Mode->FrameBufferBase;
+			lfb_size = gop->Mode->FrameBufferSize;
+			pixel_fmt = info->PixelFormat;
+			pixel_info = info->PixelInformation;
+			pixel_scanline = info->PixelsPerScanLine;
+			if (pciio)
+				break;
+			found = gop;
+		}
+	}
+
+	if (!found)
+		goto out;
+
+	err = 1;
+
+	dprintf("setup_screen: set up screen parameters for EFI GOP\n");
+	si->orig_video_isVGA = 0x70; /* EFI framebuffer */
+
+	si->lfb_base = lfb_base;
+	si->lfb_size = lfb_size;
+	si->lfb_width = lfb_width;
+	si->lfb_height = lfb_height;
+	si->pages = 1;
+
+	dprintf("setup_screen: lfb_base 0x%x lfb_size %d lfb_width %d lfb_height %d\n", lfb_base, lfb_size, lfb_width, lfb_height);
+	switch (pixel_fmt) {
+	case PixelRedGreenBlueReserved8BitPerColor:
+		si->lfb_depth = 32;
+		si->lfb_linelength = pixel_scanline * 4;
+		si->red_size = 8;
+		si->red_pos = 0;
+		si->green_size = 8;
+		si->green_pos = 8;
+		si->blue_size = 8;
+		si->blue_pos = 16;
+		si->rsvd_size = 8;
+		si->rsvd_pos = 24;
+		break;
+	case PixelBlueGreenRedReserved8BitPerColor:
+		si->lfb_depth = 32;
+		si->lfb_linelength = pixel_scanline * 4;
+		si->red_size = 8;
+		si->red_pos = 16;
+		si->green_size = 8;
+		si->green_pos = 8;
+		si->blue_size = 8;
+		si->blue_pos = 0;
+		si->rsvd_size = 8;
+		si->rsvd_pos = 24;
+		break;
+	case PixelBitMask:
+		bit_mask(pixel_info.RedMask, &si->red_pos,
+			 &si->red_size);
+		bit_mask(pixel_info.GreenMask, &si->green_pos,
+			 &si->green_size);
+		bit_mask(pixel_info.BlueMask, &si->blue_pos,
+			 &si->blue_size);
+		bit_mask(pixel_info.ReservedMask, &si->rsvd_pos,
+			 &si->rsvd_size);
+		si->lfb_depth = si->red_size + si->green_size +
+			si->blue_size + si->rsvd_size;
+		si->lfb_linelength = (pixel_scanline * si->lfb_depth) / 8;
+		break;
+	default:
+		si->lfb_depth = 4;;
+		si->lfb_linelength = si->lfb_width / 2;
+		si->red_size = 0;
+		si->red_pos = 0;
+		si->green_size = 0;
+		si->green_pos = 0;
+		si->blue_size = 0;
+		si->blue_pos = 0;
+		si->rsvd_size = 0;
+		si->rsvd_pos = 0;
+		break;
+	}
+	dprintf("setup_screen: depth %d line %d rpos %d rsize %d gpos %d gsize %d bpos %d bsize %d rsvpos %d rsvsize %d\n",
+		si->lfb_depth, si->lfb_linelength,
+		si->red_pos, si->red_size,
+		si->green_pos, si->green_size,
+		si->blue_pos, si->blue_size,
+		si->blue_pos, si->blue_size,
+		si->rsvd_pos, si->rsvd_size);
+	
+out:
+	if (handles) FreePool(handles);
+
+	return err;
+}
+
+#define EFI_UGA_PROTOCOL_GUID \
+  { \
+    0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
+  }
+
+typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) (
+  IN  EFI_UGA_DRAW_PROTOCOL *This,
+  OUT UINT32 *Width,
+  OUT UINT32 *Height,
+  OUT UINT32 *Depth,
+  OUT UINT32 *Refresh
+  )
+;
+
+struct _EFI_UGA_DRAW_PROTOCOL {
+	EFI_UGA_DRAW_PROTOCOL_GET_MODE	GetMode;
+	void	*SetMode;
+	void	*Blt;
+};
+
+static int setup_uga(struct screen_info *si)
+{
+	EFI_UGA_DRAW_PROTOCOL *uga, *first;
+	EFI_GUID UgaProtocol = EFI_UGA_PROTOCOL_GUID;
+	UINT32 width, height;
+	EFI_STATUS status;
+	EFI_HANDLE *handles;
+	UINTN i, nr_handles;
+	int rv = 0;
+
+	status = LibLocateHandle(ByProtocol, &UgaProtocol,
+				 NULL, &nr_handles, &handles);
+	if (status != EFI_SUCCESS)
+		return rv;
+
+	for (i = 0; i < nr_handles; i++) {
+		EFI_PCI_IO *pciio = NULL;
+		EFI_HANDLE *handle = handles[i];
+		UINT32 w, h, depth, refresh;
+
+		status = uefi_call_wrapper(BS->HandleProtocol, 3, handle,
+					   &UgaProtocol, (void **)&uga);
+		if (status != EFI_SUCCESS)
+			continue;
+
+		uefi_call_wrapper(BS->HandleProtocol, 3, handle,
+				  &PciIoProtocol, (void **)&pciio);
+
+		status = uefi_call_wrapper(uga->GetMode, 5, uga, &w, &h,
+					   &depth, &refresh);
+
+		if (status == EFI_SUCCESS && (!first || pciio)) {
+			width = w;
+			height = h;
+
+			if (pciio)
+				break;
+
+			first = uga;
+		}
+	}
+
+	if (!first)
+		goto out;
+	rv = 1;
+
+	si->orig_video_isVGA = 0x70; /* EFI framebuffer */
+
+	si->lfb_depth = 32;
+	si->lfb_width = width;
+	si->lfb_height = height;
+
+	si->red_size = 8;
+	si->red_pos = 16;
+	si->green_size = 8;
+	si->green_pos = 8;
+	si->blue_size = 8;
+	si->blue_pos = 0;
+	si->rsvd_size = 8;
+	si->rsvd_pos = 24;
+
+out:
+	FreePool(handles);
+	return rv;
+}
+
+void setup_screen(struct screen_info *si)
+{
+	memset(si, 0, sizeof(*si));
+
+	if (!setup_gop(si))
+		setup_uga(si);
+}
Index: bootcd/isolinux/syslinux-6.03/efi/cp865_8x16.h
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/cp865_8x16.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/cp865_8x16.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,293 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1999-2012 H. Peter Anvin - All Rights Reserved
+ *   Chandramouli Narayanan - extended for EFI support
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the "Software"), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+#ifndef CP865_8x16
+#define CP865_8x16
+
+static const short cp865_8x16_font_magic = 0x436;
+static const unsigned cp865_8x16_font_mode = 0x0;
+static const int cp865_8x16_font_height = 0x10;
+static const uint8_t cp865_8x16_font_data[] = {
+	
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 
+	0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+	0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, 
+	0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 
+	0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x1c, 0x36, 0x32, 0x30, 0x78, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 
+	0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 
+	0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x70, 0x00, 0x00, 
+	0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x70, 0x00, 0x00, 
+	0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x38, 0x6c, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x36, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, 
+	0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xce, 0xd6, 0xe6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x04, 0x7c, 0xce, 0xce, 0xd6, 0xd6, 0xd6, 0xd6, 0xe6, 0xe6, 0x7c, 0x40, 0x00, 0x00, 0x00, 
+	0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 
+	0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x60, 0xe0, 0x62, 0x66, 0x6c, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00, 
+	0x00, 0x60, 0xe0, 0x62, 0x66, 0x6c, 0x18, 0x30, 0x66, 0xce, 0x9a, 0x3f, 0x06, 0x06, 0x00, 0x00, 
+	0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 
+	0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 
+	0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+	0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 
+	0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+	0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x6c, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x3c, 0x66, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+};
+#endif /* CP865_8x16 */
Index: bootcd/isolinux/syslinux-6.03/efi/derivative.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/derivative.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/derivative.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2012-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <syslinux/config.h>
+
+/*
+ * IP information.  Note that the field are in the same order as the
+ * Linux kernel expects in the ip= option.
+ */
+struct syslinux_ipinfo IPInfo;
+uint16_t APIVer;		/* PXE API version found */
+
+static enum syslinux_filesystem __filesystem;
+
+void efi_derivative(enum syslinux_filesystem fs)
+{
+    __filesystem = fs;
+}
+__export void get_derivative_info(union syslinux_derivative_info *di)
+{
+	di->disk.filesystem = __filesystem;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/diskio.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/diskio.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/diskio.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2011-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <fs.h>
+#include <ilog2.h>
+#include <disk.h>
+#include <dprintf.h>
+#include "efi.h"
+
+static inline EFI_STATUS read_blocks(EFI_BLOCK_IO *bio, uint32_t id, 
+				     sector_t lba, UINTN bytes, void *buf)
+{
+	return uefi_call_wrapper(bio->ReadBlocks, 5, bio, id, lba, bytes, buf);
+}
+
+static inline EFI_STATUS write_blocks(EFI_BLOCK_IO *bio, uint32_t id, 
+				     sector_t lba, UINTN bytes, void *buf)
+{
+	return uefi_call_wrapper(bio->WriteBlocks, 5, bio, id, lba, bytes, buf);
+}
+
+static int efi_rdwr_sectors(struct disk *disk, void *buf,
+			    sector_t lba, size_t count, bool is_write)
+{
+	struct efi_disk_private *priv = (struct efi_disk_private *)disk->private;
+	EFI_BLOCK_IO *bio = priv->bio;
+	EFI_STATUS status;
+	UINTN bytes = count * disk->sector_size;
+
+	if (is_write)
+		status = write_blocks(bio, disk->disk_number, lba, bytes, buf);
+	else
+		status = read_blocks(bio, disk->disk_number, lba, bytes, buf);
+
+	if (status != EFI_SUCCESS)
+		Print(L"Failed to %s blocks: 0x%x\n",
+			is_write ? L"write" : L"read",
+			status);
+
+	return count << disk->sector_shift;
+}
+
+struct disk *efi_disk_init(void *private)
+{
+    static struct disk disk;
+    struct efi_disk_private *priv = (struct efi_disk_private *)private;
+    EFI_HANDLE handle = priv->dev_handle;
+    EFI_BLOCK_IO *bio;
+    EFI_DISK_IO *dio;
+    EFI_STATUS status;
+
+    status = uefi_call_wrapper(BS->HandleProtocol, 3, handle,
+			       &DiskIoProtocol, (void **)&dio);
+    if (status != EFI_SUCCESS)
+	    return NULL;
+
+    status = uefi_call_wrapper(BS->HandleProtocol, 3, handle,
+			       &BlockIoProtocol, (void **)&bio);
+    if (status != EFI_SUCCESS)
+	    return NULL;
+
+    /*
+     * XXX Do we need to map this to a BIOS disk number?
+     */
+    disk.disk_number   = bio->Media->MediaId;
+
+    disk.sector_size   = bio->Media->BlockSize;
+    disk.rdwr_sectors  = efi_rdwr_sectors;
+    disk.sector_shift  = ilog2(disk.sector_size);
+
+    dprintf("sector_size=%d, disk_number=%d\n", disk.sector_size,
+	    disk.disk_number);
+
+    priv->bio = bio;
+    priv->dio = dio;
+    disk.private = private;
+#if 0
+
+    disk.part_start    = part_start;
+    disk.secpercyl     = disk.h * disk.s;
+
+
+    disk.maxtransfer   = MaxTransfer;
+
+    dprintf("disk %02x cdrom %d type %d sector %u/%u offset %llu limit %u\n",
+	    media_id, cdrom, ebios, sector_size, disk.sector_shift,
+	    part_start, disk.maxtransfer);
+#endif
+
+    return &disk;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/efi.h
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/efi.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/efi.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,83 @@
+#ifndef _SYSLINUX_EFI_H
+#define _SYSLINUX_EFI_H
+
+#include <syslinux/config.h>
+#include <core.h>
+#include <sys/types.h>	/* needed for off_t */
+//#include <syslinux/version.h> /* avoid redefinition of __STDC_VERSION__ */
+
+/*
+ * gnu-efi >= 3.0s enables GNU_EFI_USE_MS_ABI by default, which means
+ * that we must also enable it if supported by the compiler. Note that
+ * failing to enable GNU_EFI_USE_MS_ABI if gnu-efi was compiled with
+ * it on will result in undefined references to uefi_call_wrapper().
+ *
+ * The reason we don't attempt to check the version of gnu-efi we're
+ * building against is because there's no harm in turning it on for
+ * older versions - it will just be ignored.
+ */
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+  #define GNU_EFI_USE_MS_ABI 1
+#endif
+
+#include <efi.h>
+#include <efilib.h>
+#include <efistdarg.h>
+
+/* Delay for 100 ms */
+#define EFI_NOMAP_PRINT_DELAY	100
+/* We should keep EFI_NOMAP_PRINT_COUNT at 10 to limit flooding the console */
+#define EFI_NOMAP_PRINT_COUNT	10
+
+struct efi_disk_private {
+	EFI_HANDLE dev_handle;
+	EFI_BLOCK_IO *bio;
+	EFI_DISK_IO *dio;
+};
+
+struct efi_binding {
+    EFI_SERVICE_BINDING *binding;
+    EFI_HANDLE parent;
+    EFI_HANDLE child;
+    EFI_HANDLE this;
+};
+
+extern EFI_HANDLE image_handle;
+
+struct screen_info;
+extern void setup_screen(struct screen_info *);
+
+extern void efi_write_char(uint8_t, uint8_t);
+
+enum heap;
+extern void *efi_malloc(size_t, enum heap, size_t);
+extern void *efi_realloc(void *, size_t);
+extern void efi_free(void *);
+
+extern struct efi_binding *efi_create_binding(EFI_GUID *, EFI_GUID *);
+extern void efi_destroy_binding(struct efi_binding *, EFI_GUID *);
+
+static inline EFI_STATUS
+efi_setup_event(EFI_EVENT *ev, EFI_EVENT_NOTIFY func, void *ctx)
+{
+    EFI_STATUS status;
+
+    status = uefi_call_wrapper(BS->CreateEvent, 5, EVT_NOTIFY_SIGNAL,
+			       TPL_CALLBACK, func, ctx, ev);
+    return status;
+}
+
+extern void efi_derivative(enum syslinux_filesystem fs);
+
+struct boot_params;
+typedef void (handover_func_t)(void *, EFI_SYSTEM_TABLE *,
+			       struct boot_params *, unsigned long);
+
+handover_func_t efi_handover_32;
+handover_func_t efi_handover_64;
+handover_func_t efi_handover;
+
+extern void efi_console_save(void);
+extern void efi_console_restore(void);
+
+#endif /* _SYSLINUX_EFI_H */
Index: bootcd/isolinux/syslinux-6.03/efi/fio.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/fio.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/fio.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,283 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2012 Intel Corporation; author: H. Peter Anvin
+ *   Chandramouli Narayanan
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ *   Boston MA 02111-1307, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* Miscellaneous functions for UEFI support
+ * We assume that EFI library initialization has completed
+ * and we have access to the global EFI exported variables
+ *
+ */
+#include "efi.h"
+#include "fio.h"
+
+/* Variables that need to be exported
+ * efi_errno - maintains the errors from EFI calls to display error messages.
+ */
+EFI_STATUS efi_errno = EFI_SUCCESS;
+
+/* Locals
+ * vol_root - handle to the root device for file operations
+ */
+static EFI_FILE_HANDLE vol_root;
+
+/* Table of UEFI error messages to be indexed with the EFI errno
+ * Update error message list as needed
+ */
+static CHAR16 *uefi_errmsg[] = {
+	L"EFI_UNDEFINED",	/* should not get here */
+	L"EFI_LOAD_ERROR",
+	L"EFI_INVALID_PARAMETER",
+	L"EFI_UNSUPPORTED",
+	L"EFI_BAD_BUFFER_SIZE",
+	L"EFI_BUFFER_TOO_SMALL",
+	L"EFI_NOT_READY",
+	L"EFI_DEVICE_ERROR",
+	L"EFI_WRITE_PROTECTED",
+	L"EFI_OUT_OF_RESOURCES",
+	L"EFI_VOLUME_CORRUPTED",
+	L"EFI_VOLUME_FULL",
+	L"EFI_NO_MEDIA",
+	L"EFI_MEDIA_CHANGED",
+	L"EFI_NOT_FOUND",
+	L"EFI_ACCESS_DENIED",
+	L"EFI_NO_RESPONSE",
+	L"EFI_NO_MAPPING",
+	L"EFI_TIMEOUT",
+	L"EFI_NOT_STARTED",
+	L"EFI_ALREADY_STARTED",
+	L"EFI_ABORTED",
+	L"EFI_ICMP_ERROR",
+	L"EFI_TFTP_ERROR",
+	L"EFI_PROTOCOL_ERROR"
+};
+
+static UINTN nerrs = sizeof(uefi_errmsg)/sizeof(CHAR16 *);
+
+
+/* Generic write error message; there is no gnu lib api to write to StdErr
+ * For now, everything goes ConOut
+ */
+void efi_printerr(
+    CHAR16   *fmt,
+    ...
+    )
+{
+    va_list     args;
+    va_start (args, fmt);
+    VPrint (fmt, args);
+    va_end (args);
+}
+
+/* Simple console logger of efi-specific error messages. It uses
+ * gnu-efi library Print function to do the job.
+ */
+
+void efi_perror(CHAR16 *prog)
+{
+	/* Ensure that the err number lies within range
+	 * Beware: unsigned comparisons fail on efi, signed comparisons work
+	 */
+	if (EFI_ERROR(efi_errno) && (INTN)efi_errno < (INTN)nerrs)
+		efi_printerr(L"%s: %s\n", prog, uefi_errmsg[efi_errno]);
+}
+
+/* Write to UEFI ConOut */
+void efi_printout(
+    CHAR16   *fmt,
+    ...
+    )
+{
+    va_list     args;
+    va_start (args, fmt);
+    VPrint (fmt, args);
+    va_end (args);
+}
+
+/* IMPORTANT:
+ * efi_setvol_root() needs to be called from efi main.
+ * The rest of the ADV support relies on the file i/o environment
+ * setup here. In order to use the EFI file support, we need
+ * to set up the volume root. Subsequent file operations need the root to
+ * access the interface routines.
+ *
+ */
+
+EFI_STATUS efi_set_volroot(EFI_HANDLE device_handle)
+{
+	vol_root = LibOpenRoot(device_handle);
+	if (!vol_root) {
+		return EFI_DEVICE_ERROR;
+	}
+	return EFI_SUCCESS;
+}
+
+/* File operations using EFI runtime services */
+
+/* Open the file using EFI runtime service
+ * Opening a file in EFI requires a handle to the device
+ * root in order to use the interface to the file operations supported by UEFI.
+ * For now, assume device volume root handle from the loaded image
+ *
+ * Return a valid handle if open succeeded and null otherwise.
+ * UEFI returns a bogus handle on error, so return null handle on error.
+ *
+ * TODO:
+ * 1. Validate the assumption about the root device
+ * 2. Can EFI open a file with full path name specification?
+ * 3. Look into gnu-efi helper functions for dealing with device path/file path
+ * 4. Consider utilizing EFI file open attributes.
+ * 5. In EFI, file attributes can be specified only at the time of creation.
+ * How do we support the equivalent of set_attributes() and clear_attributes()
+ */
+EFI_FILE_HANDLE efi_open(CHAR16 *file, UINT64 mode)
+{
+	/* initialize with NULL handle since EFI open returns bogus */
+	EFI_FILE_HANDLE	fd = NULL;
+
+	ASSERT(vol_root);
+
+	/* Note that the attributes parameter is none for now */
+	efi_errno = uefi_call_wrapper(vol_root->Open,
+					5,
+					vol_root,
+					&fd,
+					file,
+					mode,
+					0);
+	return fd;
+}
+
+/*
+ * read/write wrapper functions for UEFI
+ *
+ * Read or write the specified number of bytes starting at the
+ * offset specified.
+ *
+ * Returns:
+ * number of bytes read/written on success
+ * -1 on error
+ */
+/* Wrapper function to read from a file */
+size_t efi_xpread(EFI_FILE_HANDLE fd, void *buf, size_t count, off_t offset)
+{
+	ASSERT(fd);
+	efi_errno = uefi_call_wrapper(fd->SetPosition,
+					2,
+				    fd,
+				    offset);
+	if (EFI_ERROR(efi_errno)) return -1;
+	efi_errno = uefi_call_wrapper(fd->Read,
+					3,
+				    fd,
+				    &count,
+					buf);
+	if (EFI_ERROR(efi_errno)) return -1;
+	return count;
+}
+
+/* Wrapper function to write */
+size_t efi_xpwrite(EFI_FILE_HANDLE fd, void *buf, size_t count, off_t offset)
+{
+	ASSERT(fd);
+	efi_errno = uefi_call_wrapper(fd->SetPosition,
+					2,
+				    fd,
+				    offset);
+	if (EFI_ERROR(efi_errno)) return -1;
+	efi_errno = uefi_call_wrapper(fd->Write,
+					3,
+				    fd,
+				    &count,
+					buf);
+	if (EFI_ERROR(efi_errno)) return -1;
+	return count;
+}
+
+/* For an open handle, return the generic file info excluding
+ * the variable-length filename in the EFI_FILE_INFO structure.
+ */
+int efi_fstat(EFI_FILE_HANDLE fd, EFI_FILE_INFO *st)
+{
+	EFI_FILE_INFO *finfo;
+
+	ASSERT(fd);
+	finfo = LibFileInfo(fd);
+	if (finfo) {
+		uefi_call_wrapper(BS->CopyMem, 3, (VOID *)st, (VOID *)finfo, SIZE_OF_EFI_FILE_INFO);
+		FreePool(finfo);
+		return 0;
+	}
+	/* gnu-efi lib does not return EFI status; export a generic device error for now */
+	efi_errno = EFI_DEVICE_ERROR;
+	return -1;
+}
+
+/* set/clear_attributes()
+ * 	Currently handles only VFAT filesystem
+ * TODO:
+ *    1. Assumes VFAT file system.
+ *    2. How do we support other file systems?
+ */
+void efi_set_attributes(EFI_FILE_HANDLE fd)
+{
+	EFI_FILE_INFO *finfo;
+
+	ASSERT(fd);
+	finfo = LibFileInfo(fd);
+	if (finfo) {
+		/* Hidden+System+Readonly */
+		finfo->Attribute = EFI_FILE_READ_ONLY|EFI_FILE_HIDDEN|EFI_FILE_SYSTEM;
+		efi_errno = uefi_call_wrapper(fd->SetInfo,
+					4,
+					fd,
+					&GenericFileInfo,
+					finfo->Size,
+					finfo);
+		FreePool(finfo);
+	} else efi_errno = EFI_NOT_FOUND;
+}
+
+void efi_clear_attributes(EFI_FILE_HANDLE fd)
+{
+	EFI_FILE_INFO *finfo;
+
+	ASSERT(fd);
+	finfo = LibFileInfo(fd);
+	if (finfo) {
+		finfo->Attribute = 0; /* no attributes */
+		efi_errno = uefi_call_wrapper(fd->SetInfo, 
+					4, 
+					fd,
+					&GenericFileInfo,
+					finfo->Size,
+					finfo);
+		FreePool(finfo);
+	} else efi_errno = EFI_NOT_FOUND;
+}
+
+/* Implement the sync operation using the EFI Flush file operation*/
+void efi_sync(EFI_FILE_HANDLE fd)
+{
+	ASSERT(fd);
+	efi_errno = uefi_call_wrapper(fd->Flush, 1, fd);
+	return;
+}
+
+/* Close the file */
+void efi_close(EFI_FILE_HANDLE fd)
+{
+
+	ASSERT(fd);
+	efi_errno = uefi_call_wrapper(fd->Close, 1, fd);
+	return;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/fio.h
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/fio.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/fio.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,43 @@
+#ifndef _H_EFI_FIO_
+#define _H_EFI_FIO_
+
+/*
+ * Friendly interfaces for EFI file I/O and various EFI support functions
+ */
+
+/* MAX_EFI_ARGS - command line args for EFI executable
+ * WS(c16) 	- check for CHAR16 white space
+ */
+#define MAX_EFI_ARGS		64
+#define WS(c16)         (c16 == L' ' || c16 == CHAR_TAB)
+
+/* VPrint is not in export declarations in gnu-efi lib yet
+ * although it is a global function; declare it here
+ */
+extern UINTN
+VPrint (
+    IN CHAR16   *fmt,
+    va_list     args
+    );
+
+extern EFI_STATUS efi_errno;
+
+void efi_memcpy(unsigned char *dst, unsigned char *src, size_t len);
+void efi_memmove(unsigned char *dst, unsigned char *src, size_t len);
+void efi_memset(unsigned char *dst, unsigned char val, size_t len);
+void *efi_alloc(int size);
+void efi_free(void *ptr);
+void efi_perror(CHAR16 *str);
+void efi_printerr(IN CHAR16 *fmt, ...);
+void efi_printout(IN CHAR16 *fmt, ...);
+EFI_STATUS efi_set_volroot(EFI_HANDLE device_handle);
+EFI_FILE_HANDLE efi_open(CHAR16 *file, UINT64 mode);
+void efi_close(EFI_FILE_HANDLE fd);
+void efi_sync(EFI_FILE_HANDLE fd);
+size_t efi_xpread(EFI_FILE_HANDLE fd, void *buf, size_t count, off_t offset);
+size_t efi_xpwrite(EFI_FILE_HANDLE fd, void *buf, size_t count, off_t offset);
+int efi_fstat(EFI_FILE_HANDLE fd, EFI_FILE_INFO *st);
+void efi_set_attributes(EFI_FILE_HANDLE fd);
+void efi_clear_attributes(EFI_FILE_HANDLE fd);
+
+#endif
Index: bootcd/isolinux/syslinux-6.03/efi/i386/linux.S
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/i386/linux.S	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/i386/linux.S	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,50 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2013 Intel Corporation; author: Matt Fleming
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+	.globl kernel_jump
+	.type  kernel_jump,@function
+	.text
+kernel_jump:
+	cli
+	movl	0x8(%esp), %esi
+	movl	0x4(%esp), %ecx
+	jmp	*%ecx
+
+	/*
+	 * The default handover function should only be invoked for
+	 * bzImage boot protocol versions < 2.12.
+	 */
+	.globl efi_handover
+	.type  efi_handover,@function
+efi_handover:
+	cli
+	popl	%ecx		/* discard return address */
+	movl	0xc(%esp), %ecx
+	jmp	*%ecx
+
+	.globl efi_handover_32
+	.type  efi_handover_32,@function
+efi_handover_32:
+	cli
+	popl	%ecx		/* discard return address */
+	movl	0xc(%esp), %ecx
+	call	*%ecx
+
+	.globl efi_handover_64
+	.type  efi_handover_64,@function
+efi_handover_64:
+	call	1f
+1:
+	popl	%eax
+	subl	$1b, %eax
+	movl	$38, errno(%eax)	/* ENOSYS */
+	ret
Index: bootcd/isolinux/syslinux-6.03/efi/i386/syslinux.ld
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/i386/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/i386/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,173 @@
+/* -----------------------------------------------------------------------
+ *   
+ *   Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Linker script for the SYSLINUX core
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+	. = 0;
+	ImageBase = .;		/* For gnu-efi's crt0 */
+	__module_start = .;
+	. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
+	.text : {
+		FILL(0x90909090)
+		__text_start = .;
+		*(.text)
+		*(.text.*)
+		__text_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+		*(.rodata.*)
+		__rodata_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.ctors : {
+		__ctors_start = .;
+		KEEP (*(SORT(.ctors.*)))
+		KEEP (*(.ctors))
+		__ctors_end = .;
+	}
+
+	.dtors : {
+		__dtors_start = .;
+		KEEP (*(SORT(.dtors.*)))
+		KEEP (*(.dtors))
+		__dtors_end = .;
+	}
+
+	. = ALIGN(4096);
+	.rel : {
+		*(.rel.got)
+		*(.rel.data)
+		*(.rel.data.*)
+		*(.rel.ctors)
+	}
+
+	. = ALIGN(4);
+
+	.gnu.hash : {
+		__gnu_hash_start = .;
+		*(.gnu.hash)
+		__gnu_hash_end = .;
+	}
+
+
+	.dynsym : {
+		__dynsym_start = .;
+		*(.dynsym)
+		__dynsym_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynstr : {
+		__dynstr_start = .;
+		*(.dynstr)
+		__dynstr_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynlink : {
+		__dynlink_start = .;
+		*(.dynlink)
+		__dynlink_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.got : {
+		__got_start = .;
+		KEEP (*(.got.plt))
+		KEEP (*(.got))
+		__got_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynamic : {
+		__dynamic_start = .;
+		*(.dynamic)
+		__dynamic_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.data : {
+		__data_start = .;
+		*(.data)
+		*(.data.*)
+		*(.lowmem)
+		__data_end = .;
+	}
+
+	.reloc : {
+		*(.reloc)
+	}
+
+	.symtab : {
+		*(.symtab)
+	}
+
+	.strtab : {
+		*(.strtab)
+	}
+
+	.bss (NOLOAD) : {
+		/* the EFI loader doesn't seem to like a .bss section,
+		   so we stick it all into .data: */
+		__bss_start = .;
+		*(.bss)
+		*(.bss.*)
+		*(.bss16)
+		*(.hugebss)
+		*(COMMON)
+		__bss_end = .;
+		*(.sbss)
+		*(.scommon)
+	}
+	__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
+	__bss_dwords = (__bss_len + 3) >> 2;
+
+	. = ALIGN(128);
+
+	/* Very large objects which don't need to be zeroed */
+
+	.hugebss : {
+		__hugebss_start = .;
+		*(.hugebss)
+		*(.hugebss.*)
+		__hugebss_end = .;
+	}
+
+	_end = .;
+
+	/* Stuff we don't need... */
+	/DISCARD/ : {
+		*(.eh_frame)
+		*(.comment)
+	}
+}
Index: bootcd/isolinux/syslinux-6.03/efi/main.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/main.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/main.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,1344 @@
+/*
+ * Copyright 2011-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <codepage.h>
+#include <core.h>
+#include <fs.h>
+#include <com32.h>
+#include <syslinux/memscan.h>
+#include <syslinux/firmware.h>
+#include <syslinux/linux.h>
+#include <sys/ansi.h>
+#include <setjmp.h>
+
+#include "efi.h"
+#include "fio.h"
+#include "version.h"
+
+__export uint16_t PXERetry;
+__export char copyright_str[] = "Copyright (C) 2011-" YEAR_STR "\n";
+uint8_t SerialNotice = 1;
+__export char syslinux_banner[] = "Syslinux " VERSION_STR " (EFI; " DATE_STR ")\n";
+char CurrentDirName[CURRENTDIR_MAX];
+struct com32_sys_args __com32;
+
+uint32_t _IdleTimer = 0;
+char __lowmem_heap[32];
+uint32_t BIOS_timer_next;
+uint32_t timer_irq;
+__export uint8_t KbdMap[256];
+char aux_seg[256];
+
+static jmp_buf load_error_buf;
+
+static inline EFI_STATUS
+efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid, EFI_HANDLE agent,
+		   EFI_HANDLE controller)
+{
+    return uefi_call_wrapper(BS->CloseProtocol, 4, handle,
+			     guid, agent, controller);
+}
+
+struct efi_binding *efi_create_binding(EFI_GUID *bguid, EFI_GUID *pguid)
+{
+    EFI_SERVICE_BINDING *sbp;
+    struct efi_binding *b;
+    EFI_STATUS status;
+    EFI_HANDLE protocol, child, *handles = NULL;
+    UINTN i, nr_handles = 0;
+
+    b = malloc(sizeof(*b));
+    if (!b)
+	return NULL;
+
+    status = LibLocateHandle(ByProtocol, bguid, NULL, &nr_handles, &handles);
+    if (status != EFI_SUCCESS)
+	goto free_binding;
+
+    for (i = 0; i < nr_handles; i++) {
+	status = uefi_call_wrapper(BS->OpenProtocol, 6, handles[i],
+				   bguid, (void **)&sbp,
+				   image_handle, handles[i],
+				   EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+	if (status == EFI_SUCCESS)
+	    break;
+
+	uefi_call_wrapper(BS->CloseProtocol, 4, handles[i], bguid,
+			  image_handle, handles[i]);
+    }
+
+    if (i == nr_handles)
+	goto free_binding;
+
+    child = NULL;
+
+    status = uefi_call_wrapper(sbp->CreateChild, 2, sbp, (EFI_HANDLE *)&child);
+    if (status != EFI_SUCCESS)
+	goto close_protocol;
+
+    status = uefi_call_wrapper(BS->OpenProtocol, 6, child,
+			      pguid, (void **)&protocol,
+			      image_handle, sbp,
+			      EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+    if (status != EFI_SUCCESS)
+	goto destroy_child;
+
+    b->parent = handles[i];
+    b->binding = sbp;
+    b->child = child;
+    b->this = protocol;
+
+    return b;
+
+destroy_child:
+    uefi_call_wrapper(sbp->DestroyChild, 2, sbp, child);
+
+close_protocol:
+    uefi_call_wrapper(BS->CloseProtocol, 4, handles[i], bguid,
+		      image_handle, handles[i]);
+
+free_binding:
+    free(b);
+    return NULL;
+}
+
+void efi_destroy_binding(struct efi_binding *b, EFI_GUID *guid)
+{
+    efi_close_protocol(b->child, guid, image_handle, b->binding);
+    uefi_call_wrapper(b->binding->DestroyChild, 2, b->binding, b->child);
+    efi_close_protocol(b->parent, guid, image_handle, b->parent);
+
+    free(b);
+}
+
+#undef kaboom
+void kaboom(void)
+{
+}
+
+void printf_init(void)
+{
+}
+
+__export void local_boot(uint16_t ax)
+{
+    /*
+     * Inform the firmware that we failed to execute correctly, which
+     * will trigger the next entry in the EFI Boot Manager list.
+     */
+    longjmp(load_error_buf, 1);
+}
+
+void bios_timer_cleanup(void)
+{
+}
+
+char trackbuf[4096];
+
+void __cdecl core_farcall(uint32_t c, const com32sys_t *a, com32sys_t *b)
+{
+}
+
+__export struct firmware *firmware = NULL;
+__export void *__syslinux_adv_ptr;
+__export size_t __syslinux_adv_size;
+char core_xfer_buf[65536];
+struct iso_boot_info {
+	uint32_t pvd;               /* LBA of primary volume descriptor */
+	uint32_t file;              /* LBA of boot file */
+	uint32_t length;            /* Length of boot file */
+	uint32_t csum;              /* Checksum of boot file */
+	uint32_t reserved[10];      /* Currently unused */
+} iso_boot_info;
+
+uint8_t DHCPMagic;
+uint32_t RebootTime;
+
+void pxenv(void)
+{
+}
+
+uint16_t BIOS_fbm = 1;
+far_ptr_t InitStack;
+far_ptr_t PXEEntry;
+
+void gpxe_unload(void)
+{
+}
+
+void do_idle(void)
+{
+}
+
+void pxe_int1a(void)
+{
+}
+
+uint8_t KeepPXE;
+
+struct semaphore;
+mstime_t sem_down(struct semaphore *sem, mstime_t time)
+{
+	/* EFI is single threaded */
+	return 0;
+}
+
+void sem_up(struct semaphore *sem)
+{
+	/* EFI is single threaded */
+}
+
+__export volatile uint32_t __ms_timer = 0;
+volatile uint32_t __jiffies = 0;
+
+void efi_write_char(uint8_t ch, uint8_t attribute)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+	uint16_t c[2];
+
+	uefi_call_wrapper(out->SetAttribute, 2, out, attribute);
+
+	/* Lookup primary Unicode encoding in the system codepage */
+	c[0] = codepage.uni[0][ch];
+	c[1] = '\0';
+
+	uefi_call_wrapper(out->OutputString, 2, out, c);
+}
+
+static void efi_showcursor(const struct term_state *st)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+	bool cursor = st->cursor ? true : false;
+
+	uefi_call_wrapper(out->EnableCursor, 2, out, cursor);
+}
+
+static void efi_set_cursor(int x, int y, bool visible)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+
+	uefi_call_wrapper(out->SetCursorPosition, 3, out, x, y);
+}
+
+static void efi_scroll_up(uint8_t cols, uint8_t rows, uint8_t attribute)
+{
+	efi_write_char('\n', 0);
+	efi_write_char('\r', 0);
+}
+
+static void efi_get_mode(int *cols, int *rows)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+	UINTN c, r;
+
+	uefi_call_wrapper(out->QueryMode, 4, out, out->Mode->Mode, &c, &r);
+	*rows = r;
+	*cols = c;
+}
+
+static void efi_erase(int x0, int y0, int x1, int y1, uint8_t attribute)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+	int cols, rows;
+
+	efi_get_mode(&cols, &rows);
+
+	/*
+	 * The BIOS version of this function has the ability to erase
+	 * parts or all of the screen - the UEFI console doesn't
+	 * support this so we just set the cursor position unless
+	 * we're clearing the whole screen.
+	 */
+	if (!x0 && y0 == (cols - 1)) {
+		/* Really clear the screen */
+		uefi_call_wrapper(out->ClearScreen, 1, out);
+	} else {
+		uefi_call_wrapper(out->SetCursorPosition, 3, out, y1, x1);
+	}
+}
+
+static void efi_text_mode(void)
+{
+}
+
+static void efi_get_cursor(uint8_t *x, uint8_t *y)
+{
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
+	*x = out->Mode->CursorColumn;
+	*y = out->Mode->CursorRow;
+}
+
+struct output_ops efi_ops = {
+	.erase = efi_erase,
+	.write_char = efi_write_char,
+	.showcursor = efi_showcursor,
+	.set_cursor = efi_set_cursor,
+	.scroll_up = efi_scroll_up,
+	.get_mode = efi_get_mode,
+	.text_mode = efi_text_mode,
+	.get_cursor = efi_get_cursor,
+};
+
+char SubvolName[2];
+static inline EFI_MEMORY_DESCRIPTOR *
+get_memory_map(UINTN *nr_entries, UINTN *key, UINTN *desc_sz,
+	       uint32_t *desc_ver)
+{
+	return LibMemoryMap(nr_entries, key, desc_sz, desc_ver);
+}
+
+
+int efi_scan_memory(scan_memory_callback_t callback, void *data)
+{
+	UINTN i, nr_entries, key, desc_sz;
+	UINTN buf, bufpos;
+	UINT32 desc_ver;
+	int rv = 0;
+
+	buf = (UINTN)get_memory_map(&nr_entries, &key, &desc_sz, &desc_ver);
+	if (!buf)
+		return -1;
+	bufpos = buf;
+
+	for (i = 0; i < nr_entries; bufpos += desc_sz, i++) {
+		EFI_MEMORY_DESCRIPTOR *m;
+		UINT64 region_sz;
+		enum syslinux_memmap_types type;
+
+		m = (EFI_MEMORY_DESCRIPTOR *)bufpos;
+		region_sz = m->NumberOfPages * EFI_PAGE_SIZE;
+
+		switch (m->Type) {
+                case EfiConventionalMemory:
+			type = SMT_FREE;
+                        break;
+		default:
+			type = SMT_RESERVED;
+			break;
+		}
+
+		rv = callback(data, m->PhysicalStart, region_sz, type);
+		if (rv)
+			break;
+	}
+
+	FreePool((void *)buf);
+	return rv;
+}
+
+static struct syslinux_memscan efi_memscan = {
+    .func = efi_scan_memory,
+};
+
+extern uint16_t *bios_free_mem;
+void efi_init(void)
+{
+	/* XXX timer */
+	*bios_free_mem = 0;
+	syslinux_memscan_add(&efi_memscan);
+	mem_init();
+}
+
+char efi_getchar(char *hi)
+{
+	SIMPLE_INPUT_INTERFACE *in = ST->ConIn;
+	EFI_INPUT_KEY key;
+	EFI_STATUS status;
+
+	do {
+		status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key);
+	} while (status == EFI_NOT_READY);
+
+	if (!key.ScanCode)
+		return (char)key.UnicodeChar;
+
+	/*
+	 * We currently only handle scan codes that fit in 8 bits.
+	 */
+	*hi = (char)key.ScanCode;
+	return 0;
+}
+
+int efi_pollchar(void)
+{
+	SIMPLE_INPUT_INTERFACE *in = ST->ConIn;
+	EFI_STATUS status;
+
+	status = WaitForSingleEvent(in->WaitForKey, 1);
+	return status != EFI_TIMEOUT;
+}
+
+struct input_ops efi_iops = {
+	.getchar = efi_getchar,
+	.pollchar = efi_pollchar,
+};
+
+extern void efi_adv_init(void);
+extern int efi_adv_write(void);
+
+struct adv_ops efi_adv_ops = {
+	.init = efi_adv_init,
+	.write = efi_adv_write,
+};
+
+struct efi_info {
+	uint32_t load_signature;
+	uint32_t systab;
+	uint32_t desc_size;
+	uint32_t desc_version;
+	uint32_t memmap;
+	uint32_t memmap_size;
+	uint32_t systab_hi;
+	uint32_t memmap_hi;
+};
+
+#define E820MAX	128
+#define E820_RAM	1
+#define E820_RESERVED	2
+#define E820_ACPI	3
+#define E820_NVS	4
+#define E820_UNUSABLE	5
+
+#define BOOT_SIGNATURE	0xaa55
+#define SYSLINUX_EFILDR	0x30	/* Is this published value? */
+#define DEFAULT_TIMER_TICK_DURATION 	500000 /* 500000 == 500000 * 100 * 10^-9 == 50 msec */
+#define DEFAULT_MSTIMER_INC		0x32	/* 50 msec */
+struct e820_entry {
+	uint64_t start;
+	uint64_t len;
+	uint32_t type;
+} __packed;
+
+struct boot_params {
+	struct screen_info screen_info;
+	uint8_t _pad[0x1c0 - sizeof(struct screen_info)];
+	struct efi_info efi;
+	uint8_t _pad2[8];
+	uint8_t e820_entries;
+	uint8_t _pad3[0x2d0 - 0x1e8 - sizeof(uint8_t)];
+	struct e820_entry e820_map[E820MAX];
+} __packed;
+
+/* Allocate boot parameter block aligned to page */
+#define BOOT_PARAM_BLKSIZE	EFI_SIZE_TO_PAGES(sizeof(struct boot_params)) * EFI_PAGE_SIZE
+
+/* Routines in support of efi boot loader were obtained from
+ * http://git.kernel.org/?p=boot/efilinux/efilinux.git:
+ * kernel_jump(), handover_jump(),
+ * emalloc()/efree, alloc_pages/free_pages
+ * allocate_pool()/free_pool()
+ * memory_map()
+ */ 
+extern void kernel_jump(EFI_PHYSICAL_ADDRESS kernel_start,
+			       struct boot_params *boot_params);
+#if __SIZEOF_POINTER__ == 4
+#define EFI_LOAD_SIG	"EL32"
+#elif __SIZEOF_POINTER__ == 8
+#define EFI_LOAD_SIG	"EL64"
+#else
+#error "unsupported architecture"
+#endif
+
+struct dt_desc {
+	uint16_t limit;
+	uint64_t *base;
+} __packed;
+
+struct dt_desc gdt = { 0x800, (uint64_t *)0 };
+struct dt_desc idt = { 0, 0 };
+
+static inline EFI_MEMORY_DESCRIPTOR *
+get_mem_desc(unsigned long memmap, UINTN desc_sz, int i)
+{
+	return (EFI_MEMORY_DESCRIPTOR *)(memmap + (i * desc_sz));
+}
+
+EFI_HANDLE image_handle;
+
+static inline UINT64 round_up(UINT64 x, UINT64 y)
+{
+	return (((x - 1) | (y - 1)) + 1);
+}
+
+static inline UINT64 round_down(UINT64 x, UINT64 y)
+{
+	return (x & ~(y - 1));
+}
+
+static void find_addr(EFI_PHYSICAL_ADDRESS *first,
+		      EFI_PHYSICAL_ADDRESS *last,
+		      EFI_PHYSICAL_ADDRESS min,
+		      EFI_PHYSICAL_ADDRESS max,
+		      size_t size, size_t align)
+{
+	EFI_MEMORY_DESCRIPTOR *map;
+	UINT32 desc_ver;
+	UINTN i, nr_entries, key, desc_sz;
+
+	map = get_memory_map(&nr_entries, &key, &desc_sz, &desc_ver);
+	if (!map)
+		return;
+
+	for (i = 0; i < nr_entries; i++) {
+		EFI_MEMORY_DESCRIPTOR *m;
+		EFI_PHYSICAL_ADDRESS best;
+		UINT64 start, end;
+
+		m = get_mem_desc((unsigned long)map, desc_sz, i);
+		if (m->Type != EfiConventionalMemory)
+			continue;
+
+		if (m->NumberOfPages < EFI_SIZE_TO_PAGES(size))
+			continue;
+
+		start = m->PhysicalStart;
+		end = m->PhysicalStart + (m->NumberOfPages << EFI_PAGE_SHIFT);
+		if (first) {
+			if (end < min)
+				continue;
+
+			/* What's the best address? */
+			if (start < min && min < end)
+				best = min;
+			else
+				best = m->PhysicalStart;
+
+			start = round_up(best, align);
+			if (start > max)
+				continue;
+
+			/* Have we run out of space in this region? */
+			if (end < start || (start + size) > end)
+				continue;
+
+			if (start < *first)
+				*first = start;
+		}
+
+		if (last) {
+			if (start > max)
+				continue;
+
+			/* What's the best address? */
+			if (start < max && max < end)
+				best = max - size;
+			else
+				best = end - size;
+
+			start = round_down(best, align);
+			if (start < min || start < m->PhysicalStart)
+				continue;
+
+			if (start > *last)
+				*last = start;
+		}
+	}
+
+	FreePool(map);
+}
+
+/**
+ * allocate_pages - Allocate memory pages from the system
+ * @atype: type of allocation to perform
+ * @mtype: type of memory to allocate
+ * @num_pages: number of contiguous 4KB pages to allocate
+ * @memory: used to return the address of allocated pages
+ *
+ * Allocate @num_pages physically contiguous pages from the system
+ * memory and return a pointer to the base of the allocation in
+ * @memory if the allocation succeeds. On success, the firmware memory
+ * map is updated accordingly.
+ *
+ * If @atype is AllocateAddress then, on input, @memory specifies the
+ * address at which to attempt to allocate the memory pages.
+ */
+static inline EFI_STATUS
+allocate_pages(EFI_ALLOCATE_TYPE atype, EFI_MEMORY_TYPE mtype,
+	       UINTN num_pages, EFI_PHYSICAL_ADDRESS *memory)
+{
+	return uefi_call_wrapper(BS->AllocatePages, 4, atype,
+				 mtype, num_pages, memory);
+}
+/**
+ * free_pages - Return memory allocated by allocate_pages() to the firmware
+ * @memory: physical base address of the page range to be freed
+ * @num_pages: number of contiguous 4KB pages to free
+ *
+ * On success, the firmware memory map is updated accordingly.
+ */
+static inline EFI_STATUS
+free_pages(EFI_PHYSICAL_ADDRESS memory, UINTN num_pages)
+{
+	return uefi_call_wrapper(BS->FreePages, 2, memory, num_pages);
+}
+
+static EFI_STATUS allocate_addr(EFI_PHYSICAL_ADDRESS *addr, size_t size)
+{
+	UINTN npages = EFI_SIZE_TO_PAGES(size);
+
+	return uefi_call_wrapper(BS->AllocatePages, 4,
+				   AllocateAddress,
+				   EfiLoaderData, npages,
+				   addr);
+}
+/**
+ * allocate_pool - Allocate pool memory
+ * @type: the type of pool to allocate
+ * @size: number of bytes to allocate from pool of @type
+ * @buffer: used to return the address of allocated memory
+ *
+ * Allocate memory from pool of @type. If the pool needs more memory
+ * pages are allocated from EfiConventionalMemory in order to grow the
+ * pool.
+ *
+ * All allocations are eight-byte aligned.
+ */
+static inline EFI_STATUS
+allocate_pool(EFI_MEMORY_TYPE type, UINTN size, void **buffer)
+{
+	return uefi_call_wrapper(BS->AllocatePool, 3, type, size, buffer);
+}
+
+/**
+ * free_pool - Return pool memory to the system
+ * @buffer: the buffer to free
+ *
+ * Return @buffer to the system. The returned memory is marked as
+ * EfiConventionalMemory.
+ */
+static inline EFI_STATUS free_pool(void *buffer)
+{
+	return uefi_call_wrapper(BS->FreePool, 1, buffer);
+}
+
+static void free_addr(EFI_PHYSICAL_ADDRESS addr, size_t size)
+{
+	UINTN npages = EFI_SIZE_TO_PAGES(size);
+
+	uefi_call_wrapper(BS->FreePages, 2, addr, npages);
+}
+
+/* cancel the established timer */
+static EFI_STATUS cancel_timer(EFI_EVENT ev)
+{
+	return uefi_call_wrapper(BS->SetTimer, 3, ev, TimerCancel, 0);
+}
+
+/* Check if timer went off and update default timer counter */
+void timer_handler(EFI_EVENT ev, VOID *ctx)
+{
+	__ms_timer += DEFAULT_MSTIMER_INC;
+	++__jiffies;
+}
+
+/* Setup a default periodic timer */
+static EFI_STATUS setup_default_timer(EFI_EVENT *ev)
+{
+	EFI_STATUS efi_status;
+
+	*ev = NULL;
+	efi_status = uefi_call_wrapper( BS->CreateEvent, 5, EVT_TIMER|EVT_NOTIFY_SIGNAL, TPL_NOTIFY, (EFI_EVENT_NOTIFY)timer_handler, NULL, ev);
+	if (efi_status == EFI_SUCCESS) {
+		efi_status = uefi_call_wrapper(BS->SetTimer, 3, *ev, TimerPeriodic, DEFAULT_TIMER_TICK_DURATION);
+	}
+	return efi_status;
+}
+
+/**
+ * emalloc - Allocate memory with a strict alignment requirement
+ * @size: size in bytes of the requested allocation
+ * @align: the required alignment of the allocation
+ * @addr: a pointer to the allocated address on success
+ *
+ * If we cannot satisfy @align we return 0.
+ */
+EFI_STATUS emalloc(UINTN size, UINTN align, EFI_PHYSICAL_ADDRESS *addr)
+{
+	UINTN i, nr_entries, map_key, desc_size;
+	EFI_MEMORY_DESCRIPTOR *map_buf;
+	UINTN d;
+	UINT32 desc_version;
+	EFI_STATUS err;
+	UINTN nr_pages = EFI_SIZE_TO_PAGES(size);
+
+	map_buf = get_memory_map(&nr_entries, &map_key,
+				 &desc_size, &desc_version);
+	if (!map_buf)
+		goto fail;
+
+	d = (UINTN)map_buf;
+
+	for (i = 0; i < nr_entries; i++, d += desc_size) {
+		EFI_MEMORY_DESCRIPTOR *desc;
+		EFI_PHYSICAL_ADDRESS start, end, aligned;
+
+		desc = (EFI_MEMORY_DESCRIPTOR *)d;
+		if (desc->Type != EfiConventionalMemory)
+			continue;
+
+		if (desc->NumberOfPages < nr_pages)
+			continue;
+
+		start = desc->PhysicalStart;
+		end = start + (desc->NumberOfPages << EFI_PAGE_SHIFT);
+
+		/* Low-memory is super-precious! */
+		if (end <= 1 << 20)
+			continue;
+		if (start < 1 << 20)
+			start = (1 << 20);
+
+		aligned = (start + align -1) & ~(align -1);
+
+		if ((aligned + size) <= end) {
+			err = allocate_pages(AllocateAddress, EfiLoaderData,
+					     nr_pages, &aligned);
+			if (err == EFI_SUCCESS) {
+				*addr = aligned;
+				break;
+			}
+		}
+	}
+
+	if (i == nr_entries)
+		err = EFI_OUT_OF_RESOURCES;
+
+	free_pool(map_buf);
+fail:
+	return err;
+}
+/**
+ * efree - Return memory allocated with emalloc
+ * @memory: the address of the emalloc() allocation
+ * @size: the size of the allocation
+ */
+void efree(EFI_PHYSICAL_ADDRESS memory, UINTN size)
+{
+	UINTN nr_pages = EFI_SIZE_TO_PAGES(size);
+
+	free_pages(memory, nr_pages);
+}
+
+/*
+ * Check whether 'buf' contains a PE/COFF header and that the PE/COFF
+ * file can be executed by this architecture.
+ */
+static bool valid_pecoff_image(char *buf)
+{
+    struct pe_header {
+	uint16_t signature;
+	uint8_t _pad[0x3a];
+	uint32_t offset;
+    } *pehdr = (struct pe_header *)buf;
+    struct coff_header {
+	uint32_t signature;
+	uint16_t machine;
+    } *chdr;
+
+    if (pehdr->signature != 0x5a4d) {
+	dprintf("Invalid MS-DOS header signature\n");
+	return false;
+    }
+
+    if (!pehdr->offset || pehdr->offset > 512) {
+	dprintf("Invalid PE header offset\n");
+	return false;
+    }
+
+    chdr = (struct coff_header *)&buf[pehdr->offset];
+    if (chdr->signature != 0x4550) {
+	dprintf("Invalid PE header signature\n");
+	return false;
+    }
+
+#if defined(__x86_64__)
+    if (chdr->machine != 0x8664) {
+	dprintf("Invalid PE machine field\n");
+	return false;
+    }
+#else
+    if (chdr->machine != 0x14c) {
+	dprintf("Invalid PE machine field\n");
+	return false;
+    }
+#endif
+
+    return true;
+}
+
+/*
+ * Boot a Linux kernel using the EFI boot stub handover protocol.
+ *
+ * This function will not return to its caller if booting the kernel
+ * image succeeds. If booting the kernel image fails, a legacy boot
+ * method should be attempted.
+ */
+static void handover_boot(struct linux_header *hdr, struct boot_params *bp)
+{
+    unsigned long address = hdr->code32_start + hdr->handover_offset;
+    handover_func_t *func = efi_handover;
+
+    dprintf("Booting kernel using handover protocol\n");
+
+    /*
+     * Ensure that the kernel is a valid PE32(+) file and that the
+     * architecture of the file matches this version of Syslinux - we
+     * can't mix firmware and kernel bitness (e.g. 32-bit kernel on
+     * 64-bit EFI firmware) using the handover protocol.
+     */
+    if (!valid_pecoff_image((char *)hdr))
+	return;
+
+    if (hdr->version >= 0x20c) {
+	if (hdr->xloadflags & XLF_EFI_HANDOVER_32)
+	    func = efi_handover_32;
+
+	if (hdr->xloadflags & XLF_EFI_HANDOVER_64)
+	    func = efi_handover_64;
+    }
+
+    efi_console_restore();
+    func(image_handle, ST, bp, address);
+}
+
+static int check_linux_header(struct linux_header *hdr)
+{
+	if (hdr->version < 0x205)
+		hdr->relocatable_kernel = 0;
+
+	/* FIXME: check boot sector signature */
+	if (hdr->boot_flag != BOOT_SIGNATURE) {
+		printf("Invalid Boot signature 0x%x, bailing out\n", hdr->boot_flag);
+		return -1;
+	}
+
+	return 0;
+}
+
+static char *build_cmdline(char *str)
+{
+	EFI_PHYSICAL_ADDRESS addr;
+	EFI_STATUS status;
+	char *cmdline = NULL; /* internal, in efi_physical below 0x3FFFFFFF */
+
+	/*
+	 * The kernel expects cmdline to be allocated pretty low,
+	 * Documentation/x86/boot.txt says,
+	 *
+	 *	"The kernel command line can be located anywhere
+	 *	between the end of the setup heap and 0xA0000"
+	 */
+	addr = 0xA0000;
+	status = allocate_pages(AllocateMaxAddress, EfiLoaderData,
+			     EFI_SIZE_TO_PAGES(strlen(str) + 1),
+			     &addr);
+	if (status != EFI_SUCCESS) {
+		printf("Failed to allocate memory for kernel command line, bailing out\n");
+		return NULL;
+	}
+	cmdline = (char *)(UINTN)addr;
+	memcpy(cmdline, str, strlen(str) + 1);
+	return cmdline;
+}
+
+static int build_gdt(void)
+{
+	EFI_STATUS status;
+
+	/* Allocate gdt consistent with the alignment for architecture */
+	status = emalloc(gdt.limit, __SIZEOF_POINTER__ , (EFI_PHYSICAL_ADDRESS *)&gdt.base);
+	if (status != EFI_SUCCESS) {
+		printf("Failed to allocate memory for GDT, bailing out\n");
+		return -1;
+	}
+	memset(gdt.base, 0x0, gdt.limit);
+
+	/*
+         * 4Gb - (0x100000*0x1000 = 4Gb)
+         * base address=0
+         * code read/exec
+         * granularity=4096, 386 (+5th nibble of limit)
+         */
+        gdt.base[2] = 0x00cf9a000000ffff;
+
+        /*
+         * 4Gb - (0x100000*0x1000 = 4Gb)
+         * base address=0
+         * data read/write
+         * granularity=4096, 386 (+5th nibble of limit)
+         */
+        gdt.base[3] = 0x00cf92000000ffff;
+
+        /* Task segment value */
+        gdt.base[4] = 0x0080890000000000;
+
+	return 0;
+}
+
+/*
+ * Callers use ->ramdisk_size to check whether any memory was
+ * allocated (and therefore needs free'ing). The return value indicates
+ * hard error conditions, such as failing to alloc memory for the
+ * ramdisk image. Having no initramfs is not an error.
+ */
+static int handle_ramdisks(struct linux_header *hdr,
+			   struct initramfs *initramfs)
+{
+	EFI_PHYSICAL_ADDRESS last;
+	struct initramfs *ip;
+	EFI_STATUS status;
+	addr_t irf_size;
+	addr_t next_addr, len, pad;
+
+	hdr->ramdisk_image = 0;
+	hdr->ramdisk_size = 0;
+
+	/*
+	 * Figure out the size of the initramfs, and where to put it.
+	 * We should put it at the highest possible address which is
+	 * <= hdr->initrd_addr_max, which fits the entire initramfs.
+	 */
+	irf_size = initramfs_size(initramfs);	/* Handles initramfs == NULL */
+	if (!irf_size)
+		return 0;
+
+	last = 0;
+	find_addr(NULL, &last, 0x1000, hdr->initrd_addr_max,
+		  irf_size, INITRAMFS_MAX_ALIGN);
+	if (last)
+		status = allocate_addr(&last, irf_size);
+
+	if (!last || status != EFI_SUCCESS) {
+		printf("Failed to allocate initramfs memory, bailing out\n");
+		return -1;
+	}
+
+	hdr->ramdisk_image = (uint32_t)last;
+	hdr->ramdisk_size = irf_size;
+
+	/* Copy initramfs into allocated memory */
+	for (ip = initramfs->next; ip->len; ip = ip->next) {
+		len = ip->len;
+		next_addr = last + len;
+
+		/*
+		 * If this isn't the last entry, extend the
+		 * zero-pad region to enforce the alignment of
+		 * the next chunk.
+		 */
+		if (ip->next->len) {
+			pad = -next_addr & (ip->next->align - 1);
+			len += pad;
+			next_addr += pad;
+		}
+
+		if (ip->data_len)
+			memcpy((void *)(UINTN)last, ip->data, ip->data_len);
+
+		if (len > ip->data_len)
+			memset((void *)(UINTN)(last + ip->data_len), 0,
+			       len - ip->data_len);
+
+		last = next_addr;
+	}
+	return 0;
+}
+
+static int exit_boot(struct boot_params *bp)
+{
+	struct e820_entry *e820buf, *e;
+	EFI_MEMORY_DESCRIPTOR *map;
+	EFI_STATUS status;
+	uint32_t e820_type;
+	UINTN i, nr_entries, key, desc_sz;
+	UINT32 desc_ver;
+
+	/* Build efi memory map */
+	map = get_memory_map(&nr_entries, &key, &desc_sz, &desc_ver);
+	if (!map)
+		return -1;
+
+	bp->efi.memmap = (uint32_t)(unsigned long)map;
+	bp->efi.memmap_size = nr_entries * desc_sz;
+	bp->efi.systab = (uint32_t)(unsigned long)ST;
+	bp->efi.desc_size = desc_sz;
+	bp->efi.desc_version = desc_ver;
+#if defined(__x86_64__)
+        bp->efi.systab_hi = ((unsigned long)ST) >> 32;
+        bp->efi.memmap_hi = ((unsigned long)map) >> 32;
+#endif
+
+
+	/*
+	 * Even though 'memmap' contains the memory map we provided
+	 * previously in efi_scan_memory(), we should recalculate the
+	 * e820 map because it will most likely have changed in the
+	 * interim.
+	 */
+	e = e820buf = bp->e820_map;
+	for (i = 0; i < nr_entries && i < E820MAX; i++) {
+		struct e820_entry *prev = NULL;
+
+		if (e > e820buf)
+			prev = e - 1;
+
+		map = get_mem_desc(bp->efi.memmap, desc_sz, i);
+		e->start = map->PhysicalStart;
+		e->len = map->NumberOfPages << EFI_PAGE_SHIFT;
+
+		switch (map->Type) {
+		case EfiReservedMemoryType:
+                case EfiRuntimeServicesCode:
+                case EfiRuntimeServicesData:
+                case EfiMemoryMappedIO:
+                case EfiMemoryMappedIOPortSpace:
+                case EfiPalCode:
+                        e820_type = E820_RESERVED;
+                        break;
+
+                case EfiUnusableMemory:
+                        e820_type = E820_UNUSABLE;
+                        break;
+
+                case EfiACPIReclaimMemory:
+                        e820_type = E820_ACPI;
+                        break;
+
+                case EfiLoaderCode:
+                case EfiLoaderData:
+                case EfiBootServicesCode:
+                case EfiBootServicesData:
+                case EfiConventionalMemory:
+			e820_type = E820_RAM;
+			break;
+
+		case EfiACPIMemoryNVS:
+			e820_type = E820_NVS;
+			break;
+		default:
+			continue;
+		}
+
+		e->type = e820_type;
+
+		/* Check for adjacent entries we can merge. */
+		if (prev && (prev->start + prev->len) == e->start &&
+		    prev->type == e->type)
+			prev->len += e->len;
+		else
+			e++;
+	}
+
+	bp->e820_entries = e - e820buf;
+
+	status = uefi_call_wrapper(BS->ExitBootServices, 2, image_handle, key);
+	if (status != EFI_SUCCESS) {
+		printf("Failed to exit boot services: 0x%016lx\n", status);
+		FreePool(map);
+		return -1;
+	}
+
+	return 0;
+}
+
+/* efi_boot_linux: 
+ * Boots the linux kernel using the image and parameters to boot with.
+ * The EFI boot loader is reworked taking the cue from
+ * http://git.kernel.org/?p=boot/efilinux/efilinux.git on the need to
+ * cap key kernel data structures at * 0x3FFFFFFF.
+ * The kernel image, kernel command line and boot parameter block are copied
+ * into allocated memory areas that honor the address capping requirement
+ * prior to kernel handoff. 
+ *
+ * FIXME
+ * Can we move this allocation requirement to com32 linux loader in order
+ * to avoid double copying kernel image?
+ */
+int efi_boot_linux(void *kernel_buf, size_t kernel_size,
+		   struct initramfs *initramfs,
+		   struct setup_data *setup_data,
+		   char *cmdline)
+{
+	struct linux_header *hdr;
+	struct boot_params *bp;
+	EFI_STATUS status;
+	EFI_PHYSICAL_ADDRESS addr, pref_address, kernel_start = 0;
+	UINT64 setup_sz, init_size = 0;
+	char *_cmdline;
+
+	if (check_linux_header(kernel_buf))
+		goto bail;
+
+	/* allocate for boot parameter block */
+	addr = 0x3FFFFFFF;
+	status = allocate_pages(AllocateMaxAddress, EfiLoaderData,
+			     BOOT_PARAM_BLKSIZE, &addr);
+	if (status != EFI_SUCCESS) {
+		printf("Failed to allocate memory for kernel boot parameter block, bailing out\n");
+		goto bail;
+	}
+
+	bp = (struct boot_params *)(UINTN)addr;
+
+	memset((void *)bp, 0x0, BOOT_PARAM_BLKSIZE);
+	/* Copy the first two sectors to boot_params */
+	memcpy((char *)bp, kernel_buf, 2 * 512);
+	hdr = (struct linux_header *)bp;
+
+	setup_sz = (hdr->setup_sects + 1) * 512;
+	if (hdr->version >= 0x20a) {
+		pref_address = hdr->pref_address;
+		init_size = hdr->init_size;
+	} else {
+		pref_address = 0x100000;
+
+		/*
+		 * We need to account for the fact that the kernel
+		 * needs room for decompression, otherwise we could
+		 * end up trashing other chunks of allocated memory.
+		 */
+		init_size = (kernel_size - setup_sz) * 3;
+	}
+	hdr->type_of_loader = SYSLINUX_EFILDR;	/* SYSLINUX boot loader module */
+	_cmdline = build_cmdline(cmdline);
+	if (!_cmdline)
+		goto bail;
+
+	hdr->cmd_line_ptr = (UINT32)(UINTN)_cmdline;
+
+	addr = pref_address;
+	status = allocate_pages(AllocateAddress, EfiLoaderData,
+			     EFI_SIZE_TO_PAGES(init_size), &addr);
+	if (status != EFI_SUCCESS) {
+		/*
+		 * We failed to allocate the preferred address, so
+		 * just allocate some memory and hope for the best.
+		 */
+		if (!hdr->relocatable_kernel) {
+			printf("Cannot relocate kernel, bailing out\n");
+			goto bail;
+		}
+
+		status = emalloc(init_size, hdr->kernel_alignment, &addr);
+		if (status != EFI_SUCCESS) {
+			printf("Failed to allocate memory for kernel image, bailing out\n");
+			goto free_map;
+		}
+	}
+	kernel_start = addr;
+	/* FIXME: we copy the kernel into the physical memory allocated here
+	 * The syslinux kernel image load elsewhere could allocate the EFI memory from here
+	 * prior to copying kernel and save an extra copy
+	 */
+	memcpy((void *)(UINTN)kernel_start, kernel_buf+setup_sz, kernel_size-setup_sz);
+
+	hdr->code32_start = (UINT32)((UINT64)kernel_start);
+
+	dprintf("efi_boot_linux: kernel_start 0x%x kernel_size 0x%x initramfs 0x%x setup_data 0x%x cmdline 0x%x\n",
+	kernel_start, kernel_size, initramfs, setup_data, _cmdline);
+
+	if (handle_ramdisks(hdr, initramfs))
+		goto free_map;
+
+	/* Attempt to use the handover protocol if available */
+	if (hdr->version >= 0x20b && hdr->handover_offset)
+		handover_boot(hdr, bp);
+
+	setup_screen(&bp->screen_info);
+
+	if (build_gdt())
+		goto free_map;
+
+	dprintf("efi_boot_linux: setup_sects %d kernel_size %d\n", hdr->setup_sects, kernel_size);
+
+	efi_console_restore();
+
+	if (exit_boot(bp))
+		goto free_map;
+
+	memcpy(&bp->efi.load_signature, EFI_LOAD_SIG, sizeof(uint32_t));
+
+	asm volatile ("lidt %0" :: "m" (idt));
+	asm volatile ("lgdt %0" :: "m" (gdt));
+
+	kernel_jump(kernel_start, bp);
+
+	/* NOTREACHED */
+
+free_map:
+	if (_cmdline)
+		efree((EFI_PHYSICAL_ADDRESS)(unsigned long)_cmdline,
+		      strlen(_cmdline) + 1);
+
+	if (bp)
+		efree((EFI_PHYSICAL_ADDRESS)(unsigned long)bp,
+		       BOOT_PARAM_BLKSIZE);
+	if (kernel_start) efree(kernel_start, init_size);
+	if (hdr->ramdisk_size)
+		free_addr(hdr->ramdisk_image, hdr->ramdisk_size);
+bail:
+	return -1;
+}
+
+extern struct disk *efi_disk_init(EFI_HANDLE);
+extern void serialcfg(uint16_t *, uint16_t *, uint16_t *);
+
+extern struct vesa_ops efi_vesa_ops;
+
+struct mem_ops efi_mem_ops = {
+	.malloc = efi_malloc,
+	.realloc = efi_realloc,
+	.free = efi_free,
+};
+
+struct firmware efi_fw = {
+	.init = efi_init,
+	.disk_init = efi_disk_init,
+	.o_ops = &efi_ops,
+	.i_ops = &efi_iops,
+	.get_serial_console_info = serialcfg,
+	.adv_ops = &efi_adv_ops,
+	.boot_linux = efi_boot_linux,
+	.vesa = &efi_vesa_ops,
+	.mem = &efi_mem_ops,
+};
+
+static inline void syslinux_register_efi(void)
+{
+	firmware = &efi_fw;
+}
+
+extern void init(void);
+extern const struct fs_ops vfat_fs_ops;
+extern const struct fs_ops pxe_fs_ops;
+
+char free_high_memory[4096];
+
+extern char __bss_start[];
+extern char __bss_end[];
+
+static void efi_setcwd(CHAR16 *dp)
+{
+	CHAR16 *c16;
+	char *c8;
+	int i, j;
+
+	/* Search for the start of the last path component */
+	for (i = StrLen(dp) - 1; i >= 0; i--) {
+		if (dp[i] == '\\' || dp[i] == '/')
+			break;
+	}
+
+	if (i < 0 || i > CURRENTDIR_MAX) {
+		dp = L"\\";
+		i = 1;
+	}
+
+	c8 = CurrentDirName;
+	c16 = dp;
+
+	for (j = 0; j < i; j++) {
+		if (*c16 == '\\') {
+			*c8++ = '/';
+			c16++;
+		} else
+			*c8++ = *c16++;
+	}
+
+	*c8 = '\0';
+}
+
+EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table)
+{
+	EFI_PXE_BASE_CODE *pxe;
+	EFI_LOADED_IMAGE *info;
+	EFI_STATUS status = EFI_SUCCESS;
+	const struct fs_ops *ops[] = { NULL, NULL };
+	unsigned long len = (unsigned long)__bss_end - (unsigned long)__bss_start;
+	static struct efi_disk_private priv;
+	SIMPLE_INPUT_INTERFACE *in;
+	EFI_INPUT_KEY key;
+	EFI_EVENT timer_ev;
+
+	memset(__bss_start, 0, len);
+	InitializeLib(image, table);
+
+	image_handle = image;
+	syslinux_register_efi();
+
+	efi_console_save();
+	init();
+
+	status = uefi_call_wrapper(BS->HandleProtocol, 3, image,
+				   &LoadedImageProtocol, (void **)&info);
+	if (status != EFI_SUCCESS) {
+		Print(L"Failed to lookup LoadedImageProtocol\n");
+		goto out;
+	}
+
+	status = uefi_call_wrapper(BS->HandleProtocol, 3, info->DeviceHandle,
+				   &PxeBaseCodeProtocol, (void **)&pxe);
+	if (status != EFI_SUCCESS) {
+		/*
+		 * Use device handle to set up the volume root to
+		 * proceed with ADV init.
+		 */
+		if (EFI_ERROR(efi_set_volroot(info->DeviceHandle))) {
+			Print(L"Failed to locate root device to prep for ");
+			Print(L"file operations & ADV initialization\n");
+			goto out;
+		}
+
+		efi_derivative(SYSLINUX_FS_SYSLINUX);
+		ops[0] = &vfat_fs_ops;
+	} else {
+		efi_derivative(SYSLINUX_FS_PXELINUX);
+		ops[0] = &pxe_fs_ops;
+	}
+
+	/* setup timer for boot menu system support */
+	status = setup_default_timer(&timer_ev);
+	if (status != EFI_SUCCESS) {
+		Print(L"Failed to set up EFI timer support, bailing out\n");
+		goto out;
+	}
+
+	/* TODO: once all errors are captured in efi_errno, bail out if necessary */
+
+	priv.dev_handle = info->DeviceHandle;
+
+	/*
+	 * Set the current working directory, which should be the
+	 * directory that syslinux.efi resides in.
+	 */
+	efi_setcwd(DevicePathToStr(info->FilePath));
+
+	fs_init(ops, (void *)&priv);
+
+	/*
+	 * There may be pending user input that wasn't processed by
+	 * whatever application invoked us. Consume and discard that
+	 * data now.
+	 */
+	in = ST->ConIn;
+	do {
+		status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key);
+	} while (status != EFI_NOT_READY);
+
+	if (!setjmp(load_error_buf))
+		load_env32(NULL);
+
+	/* load_env32() failed.. cancel timer and bailout */
+	status = cancel_timer(timer_ev);
+	if (status != EFI_SUCCESS)
+		Print(L"Failed to cancel EFI timer: %x\n", status);
+
+	/*
+	 * Tell the firmware that Syslinux failed to load.
+	 */
+	status = EFI_LOAD_ERROR;
+out:
+	efi_console_restore();
+	return status;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/mem.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/mem.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/mem.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <mem/malloc.h>
+#include <string.h>
+#include "efi.h"
+
+void *efi_malloc(size_t size, enum heap heap, malloc_tag_t tag)
+{
+	return AllocatePool(size);
+}
+
+void *efi_realloc(void *ptr, size_t size)
+{
+	void *newptr;
+
+	newptr = AllocatePool(size);
+	memcpy(newptr, ptr, size);
+	FreePool(ptr);
+	return newptr;
+}
+
+void efi_free(void *ptr)
+{
+	FreePool(ptr);
+}
Index: bootcd/isolinux/syslinux-6.03/efi/pxe.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/pxe.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/pxe.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2013-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <syslinux/firmware.h>
+#include <syslinux/pxe_api.h>
+#include "efi.h"
+#include "net.h"
+#include "fs/pxe/pxe.h"
+
+const struct url_scheme url_schemes[] = {
+    { "tftp", tftp_open, 0 },
+    { "http", http_open, O_DIRECTORY },
+    { "ftp",  ftp_open,  O_DIRECTORY },
+    { NULL, NULL, 0 },
+};
+
+/**
+ * Network stack-specific initialization
+ */
+void net_core_init(void)
+{
+    http_bake_cookies();
+}
+
+void pxe_init_isr(void) {}
+void gpxe_init(void) {}
+void pxe_idle_init(void) {}
+
+int reset_pxe(void)
+{
+    return 0;
+}
+
+#define DNS_MAX_SERVERS 4		/* Max no of DNS servers */
+uint32_t dns_server[DNS_MAX_SERVERS] = {0, };
+
+__export uint32_t dns_resolv(const char *name)
+{
+    /*
+     * Return failure on an empty input... this can happen during
+     * some types of URL parsing, and this is the easiest place to
+     * check for it.
+     */
+    if (!name || !*name)
+	return 0;
+
+    return 0;
+}
+
+int pxe_init(bool quiet)
+{
+    EFI_HANDLE *handles;
+    EFI_STATUS status;
+    UINTN nr_handles;
+
+    status = LibLocateHandle(ByProtocol, &PxeBaseCodeProtocol,
+			     NULL, &nr_handles, &handles);
+    if (status != EFI_SUCCESS) {
+	if (!quiet)
+	    Print(L"No PXE Base Code Protocol\n");
+	return -1;
+    }
+
+    return 0;
+}
+
+#define EDHCP_BUF_LEN 8192
+
+struct embedded_dhcp_options {
+    uint32_t magic[4];
+    uint32_t bdhcp_len;
+    uint32_t adhcp_len;
+    uint32_t buffer_size;
+    uint32_t reserved;
+    uint8_t  dhcp_data[EDHCP_BUF_LEN];
+} __attribute__((aligned(16)));
+
+struct embedded_dhcp_options embedded_dhcp_options =
+{
+    .magic[0] = 0x2a171ead,
+    .magic[1] = 0x0600e65e,
+    .magic[2] = 0x4025a4e4,
+    .magic[3] = 0x42388fc8,
+    .bdhcp_len = 0,
+    .adhcp_len = 0,
+    .buffer_size = EDHCP_BUF_LEN,
+};
+
+void net_parse_dhcp(void)
+{
+    EFI_PXE_BASE_CODE_MODE *mode;
+    EFI_PXE_BASE_CODE *bc;
+    unsigned int pkt_len = sizeof(EFI_PXE_BASE_CODE_PACKET);
+    EFI_STATUS status;
+    EFI_HANDLE *handles = NULL;
+    UINTN nr_handles = 0;
+    uint8_t hardlen;
+    uint32_t ip;
+    char dst[256];
+
+    status = LibLocateHandle(ByProtocol, &PxeBaseCodeProtocol,
+			 NULL, &nr_handles, &handles);
+    if (status != EFI_SUCCESS)
+	return;
+
+    /* Probably want to use IPv4 protocol to decide which handle to use */
+    status = uefi_call_wrapper(BS->HandleProtocol, 3, handles[0],
+			   &PxeBaseCodeProtocol, (void **)&bc);
+    if (status != EFI_SUCCESS) {
+	Print(L"Failed to lookup PxeBaseCodeProtocol\n");
+    }
+
+    mode = bc->Mode;
+
+    /*
+     * Parse any "before" hardcoded options
+     */
+    parse_dhcp_options(embedded_dhcp_options.dhcp_data,
+		       embedded_dhcp_options.bdhcp_len, 0);
+
+    /*
+     * Get the DHCP client identifiers (query info 1)
+     */
+    Print(L"Getting cached packet ");
+    parse_dhcp(&mode->DhcpDiscover.Dhcpv4, pkt_len);
+    /*
+     * We don't use flags from the request packet, so
+     * this is a good time to initialize DHCPMagic...
+     * Initialize it to 1 meaning we will accept options found;
+     * in earlier versions of PXELINUX bit 0 was used to indicate
+     * we have found option 208 with the appropriate magic number;
+     * we no longer require that, but MAY want to re-introduce
+     * it in the future for vendor encapsulated options.
+     */
+    *(char *)&DHCPMagic = 1;
+
+    /*
+     * Get the BOOTP/DHCP packet that brought us file (and an IP
+     * address). This lives in the DHCPACK packet (query info 2)
+     */
+    parse_dhcp(&mode->DhcpAck.Dhcpv4, pkt_len);
+    /*
+     * Save away MAC address (assume this is in query info 2. If this
+     * turns out to be problematic it might be better getting it from
+     * the query info 1 packet
+     */
+    hardlen = mode->DhcpAck.Dhcpv4.BootpHwAddrLen;
+    MAC_len = hardlen > 16 ? 0 : hardlen;
+    MAC_type = mode->DhcpAck.Dhcpv4.BootpHwType;
+    memcpy(MAC, mode->DhcpAck.Dhcpv4.BootpHwAddr, MAC_len);
+
+    /*
+     * Get the boot file and other info. This lives in the CACHED_REPLY
+     * packet (query info 3)
+     */
+    parse_dhcp(&mode->PxeReply.Dhcpv4, pkt_len);
+    Print(L"\n");
+
+    /*
+     * Parse any "after" hardcoded options
+     */
+    parse_dhcp_options(embedded_dhcp_options.dhcp_data +
+		       embedded_dhcp_options.bdhcp_len,
+		       embedded_dhcp_options.adhcp_len, 0);
+
+    ip = IPInfo.myip;
+    sprintf(dst, "%u.%u.%u.%u",
+        ((const uint8_t *)&ip)[0],
+        ((const uint8_t *)&ip)[1],
+        ((const uint8_t *)&ip)[2],
+        ((const uint8_t *)&ip)[3]);
+
+    Print(L"My IP is %a\n", dst);
+}
Index: bootcd/isolinux/syslinux-6.03/efi/syslinux.ld
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,176 @@
+/* -----------------------------------------------------------------------
+ *   
+ *   Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Linker script for the SYSLINUX core
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+	. = 0;
+	ImageBase = .;		/* For gnu-efi's crt0 */
+	__module_start = .;
+	. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
+	.text : {
+		FILL(0x90909090)
+		__text_start = .;
+		*(.text)
+		*(.text.*)
+		__text_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+		*(.rodata.*)
+		__rodata_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.ctors : {
+		__ctors_start = .;
+		KEEP (*(SORT(.ctors.*)))
+		KEEP (*(.ctors))
+		__ctors_end = .;
+	}
+
+	.dtors : {
+		__dtors_start = .;
+		KEEP (*(SORT(.dtors.*)))
+		KEEP (*(.dtors))
+		__dtors_end = .;
+	}
+
+	. = ALIGN(4096);
+	.rel : {
+		*(.rel.got)
+		*(.rel.data)
+		*(.rel.data.*)
+		*(.rel.ctors)
+	}
+
+	. = ALIGN(4);
+
+	.gnu.hash : {
+		__gnu_hash_start = .;
+		*(.gnu.hash)
+		__gnu_hash_end = .;
+	}
+
+
+	.dynsym : {
+		__dynsym_start = .;
+		*(.dynsym)
+		__dynsym_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynstr : {
+		__dynstr_start = .;
+		*(.dynstr)
+		__dynstr_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynlink : {
+		__dynlink_start = .;
+		*(.dynlink)
+		__dynlink_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.got : {
+		__got_start = .;
+		KEEP (*(.got.plt))
+		KEEP (*(.got))
+		__got_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynamic : {
+		__dynamic_start = .;
+		*(.dynamic)
+		__dynamic_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.data : {
+		__data_start = .;
+		*(.data)
+		*(.data.*)
+		*(.lowmem)
+		__data_end = .;
+	}
+
+	.reloc : {
+		*(.reloc)
+	}
+
+	.comment : {
+		*(.commet)
+	}
+
+	.symtab : {
+		*(.symtab)
+	}
+
+	.strtab : {
+		*(.strtab)
+	}
+
+	.bss : {
+		/* the EFI loader doesn't seem to like a .bss section,
+		   so we stick it all into .data: */
+		__bss_start = .;
+		*(.bss)
+		*(.bss.*)
+		*(.bss16)
+		*(.hugebss)
+		*(COMMON)
+		__bss_end = .;
+		*(.sbss)
+		*(.scommon)
+	}
+	__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
+	__bss_dwords = (__bss_len + 3) >> 2;
+
+	. = ALIGN(128);
+	
+	/* Very large objects which don't need to be zeroed */
+
+	.hugebss : {
+		__hugebss_start = .;
+		*(.hugebss)
+		*(.hugebss.*)
+		__hugebss_end = .;
+	}
+
+	_end = .;
+
+	/* Stuff we don't need... */
+	/DISCARD/ : {
+		*(.eh_frame)
+	}
+}
Index: bootcd/isolinux/syslinux-6.03/efi/tcp.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/tcp.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/tcp.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2013-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include "efi.h"
+#include "net.h"
+#include "fs/pxe/pxe.h"
+
+extern EFI_GUID Tcp4ServiceBindingProtocol;
+extern EFI_GUID Tcp4Protocol;
+
+
+extern struct efi_binding *efi_create_binding(EFI_GUID *, EFI_GUID *);
+extern void efi_destroy_binding(struct efi_binding *, EFI_GUID *);
+int core_tcp_open(struct pxe_pvt_inode *socket)
+{
+    struct efi_binding *b;
+
+    b = efi_create_binding(&Tcp4ServiceBindingProtocol, &Tcp4Protocol);
+    if (!b)
+	return -1;
+
+    socket->net.efi.binding = b;
+
+    return 0;
+}
+
+static EFIAPI void null_cb(EFI_EVENT ev, void *context)
+{
+    EFI_TCP4_COMPLETION_TOKEN *token = context;
+
+    (void)ev;
+
+    uefi_call_wrapper(BS->CloseEvent, 1, token->Event);
+}
+
+static int volatile cb_status = -1;
+static EFIAPI void tcp_cb(EFI_EVENT ev, void *context)
+{
+    EFI_TCP4_COMPLETION_TOKEN *token = context;
+
+    (void)ev;
+
+    if (token->Status == EFI_SUCCESS)
+	cb_status = 0;
+    else
+	cb_status = 1;
+}
+
+int core_tcp_connect(struct pxe_pvt_inode *socket, uint32_t ip, uint16_t port)
+{
+    EFI_TCP4_CONNECTION_TOKEN token;
+    EFI_TCP4_ACCESS_POINT *ap;
+    EFI_TCP4_CONFIG_DATA tdata;
+    struct efi_binding *b = socket->net.efi.binding;
+    EFI_STATUS status;
+    EFI_TCP4 *tcp = (EFI_TCP4 *)b->this;
+    int rv = -1;
+    int unmapped = 1;
+    jiffies_t start, last, cur;
+
+    memset(&tdata, 0, sizeof(tdata));
+
+    ap = &tdata.AccessPoint;
+    ap->UseDefaultAddress = TRUE;
+    memcpy(&ap->RemoteAddress, &ip, sizeof(ip));
+    ap->RemotePort = port;
+    ap->ActiveFlag = TRUE; /* Initiate active open */
+
+    tdata.TimeToLive = 64;
+
+    last = start = jiffies();
+    while (unmapped){
+	status = uefi_call_wrapper(tcp->Configure, 2, tcp, &tdata);
+	if (status != EFI_NO_MAPPING)
+		unmapped = 0;
+	else {
+	    cur = jiffies();
+	    if ( (cur - last) >= EFI_NOMAP_PRINT_DELAY ) {
+		last = cur;
+		Print(L"core_tcp_connect: stalling on configure with no mapping\n");
+	    } else if ( (cur - start) > EFI_NOMAP_PRINT_DELAY * EFI_NOMAP_PRINT_COUNT) {
+		Print(L"core_tcp_connect: aborting on no mapping\n");
+		unmapped = 0;
+	    }
+	}
+    }
+    if (status != EFI_SUCCESS)
+	return -1;
+
+    status = efi_setup_event(&token.CompletionToken.Event,
+			    (EFI_EVENT_NOTIFY)tcp_cb, &token.CompletionToken);
+    if (status != EFI_SUCCESS)
+	return -1;
+
+    status = uefi_call_wrapper(tcp->Connect, 2, tcp, &token);
+    if (status != EFI_SUCCESS) {
+	Print(L"Failed to connect: %d\n", status);
+	goto out;
+    }
+
+    while (cb_status == -1)
+	uefi_call_wrapper(tcp->Poll, 1, tcp);
+
+    if (cb_status == 0)
+	rv = 0;
+
+    /* Reset */
+    cb_status = -1;
+
+out:
+    uefi_call_wrapper(BS->CloseEvent, 1, token.CompletionToken.Event);
+    return rv;
+}
+
+bool core_tcp_is_connected(struct pxe_pvt_inode *socket)
+{
+    if (socket->net.efi.binding)
+	return true;
+
+    return false;
+}
+
+int core_tcp_write(struct pxe_pvt_inode *socket, const void *data,
+		   size_t len, bool copy)
+{
+    EFI_TCP4_TRANSMIT_DATA txdata;
+    EFI_TCP4_FRAGMENT_DATA *frag;
+    struct efi_binding *b = socket->net.efi.binding;
+    EFI_TCP4_IO_TOKEN iotoken;
+    EFI_STATUS status;
+    EFI_TCP4 *tcp = (EFI_TCP4 *)b->this;
+    int rv = -1;
+
+    (void)copy;
+
+    memset(&iotoken, 0, sizeof(iotoken));
+    memset(&txdata, 0, sizeof(txdata));
+
+    txdata.DataLength = len;
+    txdata.FragmentCount = 1;
+
+    frag = &txdata.FragmentTable[0];
+    frag->FragmentLength = len;
+    frag->FragmentBuffer = (void *)data;
+
+    iotoken.Packet.TxData = &txdata;
+
+    status = efi_setup_event(&iotoken.CompletionToken.Event,
+			     (EFI_EVENT_NOTIFY)tcp_cb, &iotoken.CompletionToken);
+    if (status != EFI_SUCCESS)
+	return -1;
+
+    status = uefi_call_wrapper(tcp->Transmit, 2, tcp, &iotoken);
+    if (status != EFI_SUCCESS) {
+	Print(L"tcp transmit failed, %d\n", status);
+	goto out;
+    }
+
+    while (cb_status == -1)
+	uefi_call_wrapper(tcp->Poll, 1, tcp);
+
+    if (cb_status == 0)
+	rv = 0;
+
+    /* Reset */
+    cb_status = -1;
+
+out:
+    uefi_call_wrapper(BS->CloseEvent, 1, iotoken.CompletionToken.Event);
+    return rv;
+}
+
+void core_tcp_close_file(struct inode *inode)
+{
+    struct pxe_pvt_inode *socket = PVT(inode);
+    struct efi_binding *b = socket->net.efi.binding;
+    EFI_TCP4_CLOSE_TOKEN token;
+    EFI_STATUS status;
+    EFI_TCP4 *tcp = (EFI_TCP4 *)b->this;
+
+  if (!socket->tftp_goteof) {
+	memset(&token, 0, sizeof(token));
+
+	status = efi_setup_event(&token.CompletionToken.Event,
+				 (EFI_EVENT_NOTIFY)null_cb,
+				 &token.CompletionToken);
+	if (status != EFI_SUCCESS)
+	    return;
+
+	status = uefi_call_wrapper(tcp->Close, 2, tcp, &token);
+	if (status != EFI_SUCCESS)
+	    Print(L"tcp close failed: %d\n", status);
+    }
+
+    efi_destroy_binding(b, &Tcp4ServiceBindingProtocol);
+    socket->net.efi.binding = NULL;
+}
+
+static char databuf[8192];
+
+void core_tcp_fill_buffer(struct inode *inode)
+{
+    struct pxe_pvt_inode *socket = PVT(inode);
+    struct efi_binding *b = socket->net.efi.binding;
+    EFI_TCP4_IO_TOKEN iotoken;
+    EFI_TCP4_RECEIVE_DATA rxdata;
+    EFI_TCP4_FRAGMENT_DATA *frag;
+    EFI_STATUS status;
+    EFI_TCP4 *tcp = (EFI_TCP4 *)b->this;
+    void *data;
+    size_t len;
+
+    memset(&iotoken, 0, sizeof(iotoken));
+    memset(&rxdata, 0, sizeof(rxdata));
+
+    status = efi_setup_event(&iotoken.CompletionToken.Event,
+		      (EFI_EVENT_NOTIFY)tcp_cb, &iotoken.CompletionToken);
+    if (status != EFI_SUCCESS)
+	return;
+
+    iotoken.Packet.RxData = &rxdata;
+    rxdata.FragmentCount = 1;
+    rxdata.DataLength = sizeof(databuf);
+    frag = &rxdata.FragmentTable[0];
+    frag->FragmentBuffer = databuf;
+    frag->FragmentLength = sizeof(databuf);
+
+    status = uefi_call_wrapper(tcp->Receive, 2, tcp, &iotoken);
+    if (status == EFI_CONNECTION_FIN) {
+	socket->tftp_goteof = 1;
+	if (inode->size == (uint64_t)-1)
+	    inode->size = socket->tftp_filepos;
+	socket->ops->close(inode);
+	goto out;
+    }
+
+    while (cb_status == -1)
+	uefi_call_wrapper(tcp->Poll, 1, tcp);
+
+    /* Reset */
+    cb_status = -1;
+
+    len = frag->FragmentLength;
+    memcpy(databuf, frag->FragmentBuffer, len);
+    data = databuf;
+
+    socket->tftp_dataptr = data;
+    socket->tftp_filepos += len;
+    socket->tftp_bytesleft = len;
+
+out:
+    uefi_call_wrapper(BS->CloseEvent, 1, iotoken.CompletionToken.Event);
+}
Index: bootcd/isolinux/syslinux-6.03/efi/udp.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/udp.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/udp.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,417 @@
+/*
+ * Copyright 2013-2014 Intel Corporation - All Rights Reserved
+ */
+
+#include <string.h>
+#include <minmax.h>
+#include "efi.h"
+#include "net.h"
+#include "fs/pxe/pxe.h"
+
+extern EFI_GUID Udp4ServiceBindingProtocol, Udp4Protocol;
+
+/*
+ * This UDP binding is configured to operate in promiscuous mode. It is
+ * only used for reading packets. It has no associated state unlike
+ * socket->net.efi.binding, which has a remote IP address and port
+ * number.
+ */
+static struct efi_binding *udp_reader;
+
+/** 
+ * Try to configure this UDP socket
+ *
+ * @param:udp, the EFI_UDP4 socket to configure
+ * @param:udata, the EFI_UDP4_CONFIG_DATA to use
+ * @param:f, the name of the function as a wide string.
+ *
+ * @out: status as EFI_STATUS
+ */
+
+EFI_STATUS core_udp_configure(EFI_UDP4 *udp, EFI_UDP4_CONFIG_DATA *udata,
+	short unsigned int *f)
+{
+    EFI_STATUS status;
+    int unmapped = 1;
+    jiffies_t start, last, cur;
+
+    last = start = jiffies();
+    while (unmapped){
+	status = uefi_call_wrapper(udp->Configure, 2, udp, udata);
+	if (status != EFI_NO_MAPPING)
+		unmapped = 0;
+	else {
+	    cur = jiffies();
+	    if ( (cur - last) >= EFI_NOMAP_PRINT_DELAY ) {
+		last = cur;
+		Print(L"%s: stalling on configure with no mapping\n", f);
+	    } else if ( (cur - start) > EFI_NOMAP_PRINT_DELAY * EFI_NOMAP_PRINT_COUNT) {
+		Print(L"%s: aborting on no mapping\n", f);
+		unmapped = 0;
+	    }
+	}
+    }
+    return status;
+}
+
+/**
+ * Open a socket
+ *
+ * @param:socket, the socket to open
+ *
+ * @out: error code, 0 on success, -1 on failure
+ */
+int core_udp_open(struct pxe_pvt_inode *socket)
+{
+    EFI_UDP4_CONFIG_DATA udata;
+    struct efi_binding *b;
+    EFI_STATUS status;
+    EFI_UDP4 *udp;
+
+    (void)socket;
+
+    udp_reader = efi_create_binding(&Udp4ServiceBindingProtocol, &Udp4Protocol);
+    if (!udp_reader)
+	return -1;
+
+    b = efi_create_binding(&Udp4ServiceBindingProtocol, &Udp4Protocol);
+    if (!b)
+	goto bail;
+
+    udp = (EFI_UDP4 *)udp_reader->this;
+
+    memset(&udata, 0, sizeof(udata));
+
+    status = core_udp_configure(udp, &udata, L"core_udp_open");
+    if (status != EFI_SUCCESS)
+	goto bail;
+
+    socket->net.efi.binding = b;
+
+    /*
+     * Save the random local port number that the UDPv4 Protocol
+     * Driver picked for us. The TFTP protocol uses the local port
+     * number as the TID.
+     */
+    status = uefi_call_wrapper(udp->GetModeData, 5, udp,
+			       &udata, NULL, NULL, NULL);
+    if (status != EFI_SUCCESS)
+	Print(L"Failed to get UDP mode data: %d\n", status);
+    else
+	socket->net.efi.localport = udata.StationPort;
+
+    return 0;
+
+bail:
+    if (b)
+	efi_destroy_binding(b, &Udp4ServiceBindingProtocol);
+
+    efi_destroy_binding(udp_reader, &Udp4ServiceBindingProtocol);
+    udp_reader = NULL;
+
+    return -1;
+}
+
+/**
+ * Close a socket
+ *
+ * @param:socket, the socket to open
+ */
+void core_udp_close(struct pxe_pvt_inode *socket)
+{
+    efi_destroy_binding(udp_reader, &Udp4ServiceBindingProtocol);
+    udp_reader = NULL;
+
+    if (!socket->net.efi.binding)
+	return;
+
+    efi_destroy_binding(socket->net.efi.binding, &Udp4ServiceBindingProtocol);
+    socket->net.efi.binding = NULL;
+}
+
+/**
+ * Establish a connection on an open socket
+ *
+ * @param:socket, the open socket
+ * @param:ip, the ip address
+ * @param:port, the port number, host-byte order
+ */
+void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip,
+		      uint16_t port)
+{
+    EFI_UDP4_CONFIG_DATA udata;
+    EFI_STATUS status;
+    EFI_UDP4 *udp;
+
+    udp = (EFI_UDP4 *)socket->net.efi.binding->this;
+
+    memset(&udata, 0, sizeof(udata));
+
+    /* Re-use the existing local port number */
+    udata.StationPort = socket->net.efi.localport;
+
+    udata.UseDefaultAddress = TRUE;
+    memcpy(&udata.RemoteAddress, &ip, sizeof(ip));
+    udata.RemotePort = port;
+    udata.AcceptPromiscuous = TRUE;
+    udata.TimeToLive = 64;
+
+    status = core_udp_configure(udp, &udata, L"core_udp_connect");
+    if (status != EFI_SUCCESS) {
+	Print(L"Failed to configure UDP: %d\n", status);
+	return;
+    }
+}
+
+/**
+ * Tear down a connection on an open socket
+ *
+ * @param:socket, the open socket
+ */
+void core_udp_disconnect(struct pxe_pvt_inode *socket)
+{
+    EFI_STATUS status;
+    EFI_UDP4 *udp;
+
+    udp = (EFI_UDP4 *)socket->net.efi.binding->this;
+
+    /* Reset */
+    status = uefi_call_wrapper(udp->Configure, 2, udp, NULL);
+    if (status != EFI_SUCCESS)
+	Print(L"Failed to reset UDP: %d\n", status);
+
+}
+
+static int volatile cb_status = -1;
+static EFIAPI void udp4_cb(EFI_EVENT event, void *context)
+{
+    (void)event;
+
+    EFI_UDP4_COMPLETION_TOKEN *token = context;
+
+    if (token->Status == EFI_SUCCESS)
+	cb_status = 0;
+    else
+	cb_status = 1;
+}
+
+/**
+ * Read data from the network stack
+ *
+ * @param:socket, the open socket
+ * @param:buf, location of buffer to store data
+ * @param:buf_len, size of buffer
+
+ * @out: src_ip, ip address of the data source
+ * @out: src_port, port number of the data source, host-byte order
+ */
+int core_udp_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len,
+		  uint32_t *src_ip, uint16_t *src_port)
+{
+    EFI_UDP4_COMPLETION_TOKEN token;
+    EFI_UDP4_FRAGMENT_DATA *frag;
+    EFI_UDP4_RECEIVE_DATA *rxdata;
+    struct efi_binding *b;
+    EFI_STATUS status;
+    EFI_UDP4 *udp;
+    size_t size;
+    int rv = -1;
+    jiffies_t start;
+
+    (void)socket;
+
+    b = udp_reader;
+    udp = (EFI_UDP4 *)b->this;
+    memset(&token, 0, sizeof(token));
+
+    status = efi_setup_event(&token.Event, (EFI_EVENT_NOTIFY)udp4_cb,
+			     &token);
+    if (status != EFI_SUCCESS)
+	return -1;
+
+    status = uefi_call_wrapper(udp->Receive, 2, udp, &token);
+    if (status != EFI_SUCCESS)
+	goto bail;
+
+    start = jiffies();
+    while (cb_status == -1) {
+	/* 15ms receive timeout... */
+	if (jiffies() - start >= 15) {
+	    if (jiffies() - start >= 30)
+		dprintf("Failed to cancel UDP\n");
+
+	    uefi_call_wrapper(udp->Cancel, 2, udp, &token);
+	    dprintf("core_udp_recv: timed out\n");
+	}
+
+	uefi_call_wrapper(udp->Poll, 1, udp);
+    }
+
+    if (cb_status == 0)
+	rv = 0;
+
+    /* Reset */
+    cb_status = -1;
+
+    if (rv)
+	goto bail;
+
+    rxdata = token.Packet.RxData;
+    frag = &rxdata->FragmentTable[0];
+
+    size = min(frag->FragmentLength, *buf_len);
+    memcpy(buf, frag->FragmentBuffer, size);
+    *buf_len = size;
+
+    memcpy(src_port, &rxdata->UdpSession.SourcePort, sizeof(*src_port));
+    memcpy(src_ip, &rxdata->UdpSession.SourceAddress, sizeof(*src_ip));
+
+    uefi_call_wrapper(BS->SignalEvent, 1, rxdata->RecycleSignal);
+
+bail:
+    uefi_call_wrapper(BS->CloseEvent, 1, token.Event);
+    return rv;
+}
+
+/**
+ * Send a UDP packet.
+ *
+ * @param:socket, the open socket
+ * @param:data, data buffer to send
+ * @param:len, size of data bufer
+ */
+void core_udp_send(struct pxe_pvt_inode *socket, const void *data, size_t len)
+{
+    EFI_UDP4_COMPLETION_TOKEN *token;
+    EFI_UDP4_TRANSMIT_DATA *txdata;
+    EFI_UDP4_FRAGMENT_DATA *frag;
+    struct efi_binding *b = socket->net.efi.binding;
+    EFI_STATUS status;
+    EFI_UDP4 *udp = (EFI_UDP4 *)b->this;
+
+    token = zalloc(sizeof(*token));
+    if (!token)
+	return;
+
+    txdata = zalloc(sizeof(*txdata));
+    if (!txdata) {
+	free(token);
+	return;
+    }
+
+    status = efi_setup_event(&token->Event, (EFI_EVENT_NOTIFY)udp4_cb,
+			     token);
+    if (status != EFI_SUCCESS)
+	goto bail;
+
+    txdata->DataLength = len;
+    txdata->FragmentCount = 1;
+    frag = &txdata->FragmentTable[0];
+
+    frag->FragmentLength = len;
+    frag->FragmentBuffer = (void *)data;
+
+    token->Packet.TxData = txdata;
+
+    status = uefi_call_wrapper(udp->Transmit, 2, udp, token);
+    if (status != EFI_SUCCESS)
+	goto close;
+
+    while (cb_status == -1)
+	uefi_call_wrapper(udp->Poll, 1, udp);
+
+    /* Reset */
+    cb_status = -1;
+
+close:
+    uefi_call_wrapper(BS->CloseEvent, 1, token->Event);
+
+bail:
+    free(txdata);
+    free(token);
+}
+
+/**
+ * Send a UDP packet to a destination
+ *
+ * @param:socket, the open socket
+ * @param:data, data buffer to send
+ * @param:len, size of data bufer
+ * @param:ip, the ip address
+ * @param:port, the port number, host-byte order
+ */
+void core_udp_sendto(struct pxe_pvt_inode *socket, const void *data,
+		     size_t len, uint32_t ip, uint16_t port)
+{
+    EFI_UDP4_COMPLETION_TOKEN *token;
+    EFI_UDP4_TRANSMIT_DATA *txdata;
+    EFI_UDP4_FRAGMENT_DATA *frag;
+    EFI_UDP4_CONFIG_DATA udata;
+    EFI_STATUS status;
+    struct efi_binding *b;
+    EFI_UDP4 *udp;
+
+    (void)socket;
+
+    b = efi_create_binding(&Udp4ServiceBindingProtocol, &Udp4Protocol);
+    if (!b)
+	return;
+
+    udp = (EFI_UDP4 *)b->this;
+
+    token = zalloc(sizeof(*token));
+    if (!token)
+	goto out;
+
+    txdata = zalloc(sizeof(*txdata));
+    if (!txdata)
+	goto bail;
+
+    memset(&udata, 0, sizeof(udata));
+
+    /* Re-use the existing local port number */
+    udata.StationPort = socket->net.efi.localport;
+
+    udata.UseDefaultAddress = TRUE;
+    memcpy(&udata.RemoteAddress, &ip, sizeof(ip));
+    udata.RemotePort = port;
+    udata.AcceptPromiscuous = TRUE;
+    udata.TimeToLive = 64;
+
+    status = core_udp_configure(udp, &udata, L"core_udp_sendto");
+    if (status != EFI_SUCCESS)
+	goto bail;
+
+    status = efi_setup_event(&token->Event, (EFI_EVENT_NOTIFY)udp4_cb,
+			     token);
+    if (status != EFI_SUCCESS)
+	goto bail;
+
+    txdata->DataLength = len;
+    txdata->FragmentCount = 1;
+    frag = &txdata->FragmentTable[0];
+
+    frag->FragmentLength = len;
+    frag->FragmentBuffer = (void *)data;
+
+    token->Packet.TxData = txdata;
+
+    status = uefi_call_wrapper(udp->Transmit, 2, udp, token);
+    if (status != EFI_SUCCESS)
+	goto close;
+
+    while (cb_status == -1)
+	uefi_call_wrapper(udp->Poll, 1, udp);
+
+    /* Reset */
+    cb_status = -1;
+
+close:
+    uefi_call_wrapper(BS->CloseEvent, 1, token->Event);
+
+bail:
+    free(txdata);
+    free(token);
+out:
+    efi_destroy_binding(b, &Udp4ServiceBindingProtocol);
+}
Index: bootcd/isolinux/syslinux-6.03/efi/vesa.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/vesa.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/vesa.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,310 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1999-2012 H. Peter Anvin - All Rights Reserved
+ *   Chandramouli Narayanan - extended for EFI support
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the "Software"), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <inttypes.h>
+#include <com32.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/fpu.h>
+#include <syslinux/video.h>
+#include <dprintf.h>
+#include "efi.h"
+/* We use cp865_8x16.psf as the standard font for EFI implementation
+ * the header file below contains raw data parsed from cp865_8x16.psf
+ */
+#include "cp865_8x16.h"
+#include "sys/vesa/vesa.h"
+#include "sys/vesa/video.h"
+#include "sys/vesa/fill.h"
+#include "sys/vesa/debug.h"
+
+/* EFI GOP support
+ * Note GOP support uses the VESA info structure as much as possible and
+ * extends it as needed for EFI support. Not all of the vesa info structure
+ * is populated. Care must be taken in the routines that rely the vesa
+ * informataion structure
+ */
+static void find_pixmask_bits(uint32_t mask, uint8_t *first_bit, uint8_t *len) {
+    uint8_t bit_pos = 0, bit_len = 0;
+
+    *first_bit = 0;
+    *len = 0;
+    if (mask == 0)
+	return;
+    while (!(mask & 0x1)) {
+	mask = mask >> 1;
+	bit_pos++;
+    }
+    while (mask & 0x1) {
+	mask = mask >> 1;
+	bit_len++;
+    }
+    *first_bit = bit_pos;
+    *len = bit_len;
+}
+
+unsigned long lfb_size;
+uint16_t lfb_line_size;
+uint8_t lfb_rsize;
+uint8_t lfb_gsize;
+uint8_t lfb_bsize;
+uint8_t lfb_resv_size;
+
+static int efi_vesacon_set_mode(struct vesa_info *vesa_info, int *x, int *y,
+				enum vesa_pixel_format *bestpxf)
+{
+    EFI_GUID GraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+    EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput = NULL;
+    EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *gop_mode;
+    EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info;
+    EFI_STATUS st;
+    UINT32 mode_num = 0, bestmode;
+    BOOLEAN mode_match = FALSE;
+    UINTN sz_info;
+    struct vesa_info *vi;
+    struct vesa_mode_info *mi;
+    int err = 0;
+
+    //debug("Hello, World!\r\n");
+    /* At this point, we assume that gnu-efi library is initialized */
+    st = LibLocateProtocol(&GraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
+    if (EFI_ERROR(st)) {
+	debug("LiblocateProtocol for GOP failed %d\n", st);
+	return 1; /* function call failed */
+    }
+
+    /* We use the VESA info structure to store relevant GOP info as much as possible */
+    gop_mode = GraphicsOutput->Mode;
+
+    mode_info = gop_mode->Info;
+    dprintf("mode %d version %d pixlfmt %d hres=%d vres=%d\n", mode_num, 
+			mode_info->Version, mode_info->PixelFormat,
+			mode_info->HorizontalResolution, mode_info->VerticalResolution);
+    
+    /* simply pick the best mode that suits the caller's resolution */
+    for (mode_num = 0; mode_num < gop_mode->MaxMode; mode_num++) {
+	st = uefi_call_wrapper(GraphicsOutput->QueryMode, 4, GraphicsOutput, mode_num, &sz_info, &mode_info);
+	debug("mode_num = %d query_status %d\n", mode_num, st);
+	if (st == EFI_SUCCESS && sz_info >= sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)) {
+
+		/* For now, simply pick the best mode that suits caller's resolution (x,y)
+		 * FIXME: Consider any additional criteria for matching mode
+		 */
+		mode_match = ((uint32_t)*x == mode_info->HorizontalResolution && (uint32_t)*y == mode_info->VerticalResolution);
+		debug("mode %d hres=%d vres=%d\n", mode_num, mode_info->HorizontalResolution, mode_info->VerticalResolution);
+		if (mode_match) {
+			bestmode = mode_num;
+			break;
+		}
+	}
+    }
+
+    if (!mode_match) {
+	/* Instead of bailing out, set the mode to the system default.
+ 	 * Some systems do not have support for 640x480 for instance
+ 	 * This code deals with such cases.
+ 	 */
+	mode_info = gop_mode->Info;
+	*x = mode_info->HorizontalResolution;
+	*y = mode_info->VerticalResolution;
+	bestmode = gop_mode->Mode;
+	debug("No matching mode, setting to available default mode %d (x=%d, y=%d)\n", bestmode, *x, *y);
+    }
+
+    /* Allocate space in the bounce buffer for these structures */
+    vi = malloc(sizeof(*vi));
+    if (!vi) {
+	err = 10;		/* Out of memory */
+	goto exit;
+    }
+    /* Note that the generic info is untouched as we don't find any relevance to EFI */
+    mi = &vi->mi;
+    /* Set up mode-specific information */
+    mi->h_res = *x;
+    mi->v_res = *y;
+    mi->lfb_ptr = (uint8_t *)(VOID *)(UINTN)gop_mode->FrameBufferBase;
+    lfb_size = gop_mode->FrameBufferSize;
+
+    /* FIXME: 
+     * The code below treats bpp == lfb_depth ; verify
+     */
+
+    switch (mode_info->PixelFormat) {
+    case PixelRedGreenBlueReserved8BitPerColor:
+	dprintf("RGB8bit ");
+	mi->mode_attr = 0x0080;		/* supports physical frame buffer */
+	mi->bpp = sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * 8;
+	mi->rpos = 0;
+	mi->gpos = 8;
+	mi->bpos = 16;
+	mi->resv_pos = 24;
+	lfb_resv_size = 8;
+	mi->logical_scan = lfb_line_size = (mode_info->PixelsPerScanLine * mi->bpp) / 8;
+	*bestpxf = PXF_BGRA32;
+	dprintf("bpp %d pixperScanLine %d logical_scan %d bytesperPix %d\n", mi->bpp, mode_info->PixelsPerScanLine, 
+		mi->logical_scan, (mi->bpp + 7)>>3);
+	break;
+    case PixelBlueGreenRedReserved8BitPerColor:
+	dprintf("BGR8bit ");
+	mi->mode_attr = 0x0080;		/* supports physical frame buffer */
+	mi->bpp = sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * 8;
+	mi->bpos = 0;
+	mi->gpos = 8;
+	mi->rpos = 16;
+	mi->resv_pos = 24;
+	lfb_resv_size = 8;
+	mi->logical_scan = lfb_line_size = (mode_info->PixelsPerScanLine * mi->bpp) / 8;
+	*bestpxf = PXF_BGRA32;
+	dprintf("bpp %d pixperScanLine %d logical_scan %d bytesperPix %d\n", mi->bpp, mode_info->PixelsPerScanLine, 
+		mi->logical_scan, (mi->bpp + 7)>>3);
+	break;
+    case PixelBitMask:
+	mi->mode_attr = 0x0080;		/* supports physical frame buffer */
+	dprintf("RedMask 0x%x GrnMask 0x%x BluMask 0x%x RsvMask 0x%x\n",
+		mode_info->PixelInformation.RedMask,
+		mode_info->PixelInformation.GreenMask,
+		mode_info->PixelInformation.BlueMask,
+		mode_info->PixelInformation.ReservedMask);
+	find_pixmask_bits(mode_info->PixelInformation.RedMask,
+                          &mi->rpos, &lfb_rsize);
+	find_pixmask_bits(mode_info->PixelInformation.GreenMask,
+                          &mi->gpos, &lfb_gsize);
+	find_pixmask_bits(mode_info->PixelInformation.BlueMask,
+                          &mi->bpos, &lfb_bsize);
+	find_pixmask_bits(mode_info->PixelInformation.ReservedMask,
+                          &mi->resv_pos, &lfb_resv_size);
+	mi->bpp = lfb_rsize + lfb_gsize +
+                                  lfb_bsize + lfb_resv_size;
+	mi->logical_scan = lfb_line_size = (mode_info->PixelsPerScanLine * mi->bpp) / 8;
+	dprintf("RPos %d Rsize %d GPos %d Gsize %d\n", mi->rpos, lfb_rsize, mi->gpos, lfb_gsize);
+	dprintf("BPos %d Bsize %d RsvP %d RsvSz %d\n", mi->bpos, lfb_bsize, mi->resv_pos, lfb_resv_size);
+	dprintf("bpp %d logical_scan %d bytesperPix %d\n", mi->bpp, mi->logical_scan, (mi->bpp + 7)>>3);
+	switch (mi->bpp) {
+	case 32:
+		*bestpxf = PXF_BGRA32;
+		break;
+	case 24:
+		*bestpxf = PXF_BGR24;
+		break;
+	case 16:
+		*bestpxf = PXF_LE_RGB16_565;
+		break;
+	default:
+		dprintf("Unable to handle bits per pixel %d, bailing out\n", mi->bpp);
+		err = 4;
+		goto exit;
+	}
+	break;
+    case PixelBltOnly:
+	/* FIXME: unsupported */
+	mi->mode_attr = 0x0000;		/* no support for physical frame buffer */
+	err = 4; /* no mode found */
+	goto exit;
+	break;
+    default:
+	/* should not get here, but let's error out */
+	err = 4; /* no mode found */
+	goto exit;
+	break;
+    }		   
+    
+    memcpy(&vesa_info->mi, mi, sizeof *mi);
+
+    /* Now set video mode */
+    st = uefi_call_wrapper(GraphicsOutput->SetMode, 2, GraphicsOutput, bestmode);
+    if (EFI_ERROR(st)) {
+	err = 9;		/* Failed to set mode */
+	dprintf("Failed to set mode %d\n", bestmode);
+	goto exit;
+    }	
+
+    /* TODO: Follow the code usage of vesacon_background & vesacon_shadowfb */
+    /*
+     __vesacon_background = calloc(mi->h_res*mi->v_res, 4);
+     __vesacon_shadowfb = calloc(mi->h_res*mi->v_res, 4);
+     */
+     /* FIXME: the allocation takes the possible padding into account
+      * whereas   BIOS code simply allocates hres * vres bytes.
+      * Which is correct?
+      */
+     /*
+      * For performance reasons, or due to hardware restrictions, scan lines
+      * may be padded to an amount of memory alignment. These padding pixel elements
+      * are outside the area covered by HorizontalResolution and are not visible.
+      * For direct frame buffer access, this number is used as a span between starts
+      * of pixel lines in video memory. Based on the size of an individual pixel element
+      * and PixelsPerScanline, the offset in video memory from pixel element (x, y)
+      * to pixel element (x, y+1) has to be calculated as 
+      * "sizeof( PixelElement ) * PixelsPerScanLine", and not 
+      * "sizeof( PixelElement ) * HorizontalResolution", though in many cases
+      * those values can coincide.
+      */
+
+exit:
+    if (vi)
+	free(vi);
+
+    return err;
+}
+
+static void efi_vesacon_screencpy(size_t dst, const uint32_t *s,
+				  size_t bytes, struct win_info *wi)
+{
+    size_t win_off;
+    char *win_base = wi->win_base;
+ 
+    /* For EFI, we simply take the offset from the framebuffer and write to it
+     * FIXME: any gotchas?
+     */
+    win_off = dst;
+    memcpy(win_base + win_off, s, bytes);
+}
+
+static int efi_vesacon_font_query(uint8_t **font)
+{
+    /* set up font info
+     * For now, font info is stored as raw data and used
+     * as such. Altenatively, the font data stored in a file 
+     * could be read and parsed. (note: for this, EFI
+     * file support should be exposed via firmware structure)
+     */
+    *font = (uint8_t *)cp865_8x16_font_data;
+    return cp865_8x16_font_height;
+}
+
+__export int __vesacon_i915resolution(int x, int y)
+{
+	/* We don't support this function */
+	return 1;
+}
+
+struct vesa_ops efi_vesa_ops = {
+	.set_mode = efi_vesacon_set_mode,
+	.screencpy = efi_vesacon_screencpy,
+	.font_query = efi_vesacon_font_query,
+};
Index: bootcd/isolinux/syslinux-6.03/efi/wrapper.c
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/wrapper.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/wrapper.c	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,293 @@
+/*
+ * Copyright (C) 2011 Intel Corporation; author Matt Fleming
+ *
+ * Wrap the ELF shared library in a PE32 (32bit) or PE32+ (64bit) suit.
+ *
+ * Syslinux plays some games with the ELF sections that are not easily
+ * converted to a PE32 executable. For instance, Syslinux requires
+ * that a symbol hash table be present (GNU hash or SysV) so that
+ * symbols in ELF modules can be resolved at runtime but the EFI
+ * firmware loader doesn't like that and refuses to load the file.
+ *
+ * We pretend that we have an EFI executable with a single .text
+ * section so that the EFI loader will load it and jump to the entry
+ * point. Once the Syslinux ELF shared object has control we can do
+ * whatever we want.
+ */
+#include <linux/elf.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "wrapper.h"
+
+#if __SIZEOF_POINTER__ == 4
+typedef Elf32_Ehdr Elf_Ehdr;
+typedef Elf32_Addr Elf_Addr;
+#elif __SIZEOF_POINTER__ == 8
+typedef Elf64_Ehdr Elf_Ehdr;
+typedef Elf64_Addr Elf_Addr;
+#else
+#error "unsupported architecture"
+#endif
+
+/*
+ * 'so_memsz' is the size of the ELF shared object once loaded.
+ * 'data_size' is the size of initialised data in the shared object.
+ *  'class' dictates how the header is written
+ * 	For 32bit machines (class == ELFCLASS32), the optional
+ * 	header includes PE32 header fields
+ * 	For 64bit machines (class == ELFCLASS64), the optional
+ * 	header includes PE32+header fields
+ */
+static void write_header(FILE *f, __uint32_t entry, size_t data_size,
+			 __uint32_t so_memsz, __uint8_t class)
+{
+	struct optional_hdr o_hdr;
+	struct optional_hdr_pe32p o_hdr_pe32p;
+	struct section t_sec;
+	struct extra_hdr e_hdr;
+	struct extra_hdr_pe32p e_hdr_pe32p;
+	struct coff_hdr c_hdr;
+	struct header hdr;
+	__uint32_t total_sz = data_size;
+	__uint32_t hdr_sz;
+	__uint32_t reloc_start, reloc_end;
+
+	/*
+	 * The header size have to be a multiple of file_align, which currently
+	 * is 512
+	 */
+	hdr_sz = 512;
+	total_sz += hdr_sz;
+	entry += hdr_sz;
+
+	memset(&hdr, 0, sizeof(hdr));
+	hdr.msdos_signature = MSDOS_SIGNATURE;
+
+	/*
+	 * The relocs table pointer needs to be >= 0x40 for PE files. It
+	 * informs things like file(1) that we are not an MS-DOS
+	 * executable.
+	 */
+	hdr.relocs_ptr = 0x40;
+
+	hdr.pe_hdr = OFFSETOF(struct header, pe_signature);
+	hdr.pe_signature = PE_SIGNATURE;
+	fwrite(&hdr, sizeof(hdr), 1, f);
+
+	memset(&c_hdr, 0, sizeof(c_hdr));
+	c_hdr.nr_sections = 1;
+	c_hdr.nr_syms = 1;
+	if (class == ELFCLASS32) {
+		c_hdr.arch = IMAGE_FILE_MACHINE_I386;
+		c_hdr.characteristics = IMAGE_FILE_32BIT_MACHINE |
+			IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
+			IMAGE_FILE_LINE_NUMBERS_STRIPPED;
+		c_hdr.optional_hdr_sz = sizeof(o_hdr) + sizeof(e_hdr);
+		fwrite(&c_hdr, sizeof(c_hdr), 1, f);
+		memset(&o_hdr, 0, sizeof(o_hdr));
+		o_hdr.format = PE32_FORMAT;
+		o_hdr.major_linker_version = 0x02;
+		o_hdr.minor_linker_version = 0x14;
+		o_hdr.code_sz = data_size;
+		o_hdr.entry_point = entry;
+		o_hdr.initialized_data_sz = data_size;
+		fwrite(&o_hdr, sizeof(o_hdr), 1, f);
+		memset(&e_hdr, 0, sizeof(e_hdr));
+		e_hdr.section_align = 4096;
+		e_hdr.file_align = 512;
+		e_hdr.image_sz = hdr_sz + so_memsz;
+		e_hdr.headers_sz = hdr_sz;
+		e_hdr.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+		e_hdr.rva_and_sizes_nr = sizeof(e_hdr.data_directory) / sizeof(__uint64_t);
+		fwrite(&e_hdr, sizeof(e_hdr), 1, f);
+	}
+	else if (class == ELFCLASS64) {
+		c_hdr.arch = IMAGE_FILE_MACHINE_X86_64;
+		c_hdr.characteristics = IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
+			IMAGE_FILE_LINE_NUMBERS_STRIPPED;
+		c_hdr.optional_hdr_sz = sizeof(o_hdr_pe32p) + sizeof(e_hdr_pe32p);
+		fwrite(&c_hdr, sizeof(c_hdr), 1, f);
+		memset(&o_hdr_pe32p, 0, sizeof(o_hdr_pe32p));
+		o_hdr_pe32p.format = PE32P_FORMAT;
+		o_hdr_pe32p.major_linker_version = 0x02;
+		o_hdr_pe32p.minor_linker_version = 0x14;
+		o_hdr_pe32p.code_sz = data_size;
+		o_hdr_pe32p.entry_point = entry;
+		o_hdr.initialized_data_sz = data_size;
+		fwrite(&o_hdr_pe32p, sizeof(o_hdr_pe32p), 1, f);
+		memset(&e_hdr_pe32p, 0, sizeof(e_hdr_pe32p));
+		e_hdr_pe32p.section_align = 4096;
+		e_hdr_pe32p.file_align = 512;
+		e_hdr_pe32p.image_sz = hdr_sz + so_memsz;
+		e_hdr_pe32p.headers_sz = hdr_sz;
+		e_hdr_pe32p.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+		e_hdr_pe32p.rva_and_sizes_nr = sizeof(e_hdr_pe32p.data_directory) / sizeof(__uint64_t);
+		fwrite(&e_hdr_pe32p, sizeof(e_hdr_pe32p), 1, f);
+	}
+
+	memset(&t_sec, 0, sizeof(t_sec));
+	strcpy((char *)t_sec.name, ".text");
+	t_sec.virtual_sz = data_size;
+	t_sec.virtual_address = hdr_sz;
+	t_sec.raw_data_sz = t_sec.virtual_sz;
+	t_sec.raw_data = t_sec.virtual_address;
+	t_sec.characteristics = IMAGE_SCN_CNT_CODE |
+		IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
+		IMAGE_SCN_MEM_READ;
+	fwrite(&t_sec, sizeof(t_sec), 1, f);
+
+	/*
+	 * Add some padding to align the ELF as needed
+	 */
+	if (ftell(f) > t_sec.virtual_address) {
+		/* Don't rewind! hdr_sz need to be increased. */
+		fprintf(stderr, "PE32+ headers are too large.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	fseek(f, t_sec.virtual_address, SEEK_SET);
+}
+
+static void usage(char *progname)
+{
+	fprintf(stderr,	"usage: %s <ELF shared object> <output file>\n",
+		progname);
+}
+
+int main(int argc, char **argv)
+{
+	Elf32_Ehdr e32_hdr;
+	Elf64_Ehdr e64_hdr;
+	__uint32_t entry;
+	__uint8_t class;
+	__uint64_t phoff = 0;
+	__uint16_t phnum = 0, phentsize = 0;
+	unsigned char *id;
+	FILE *f_in, *f_out;
+	void *buf;
+	size_t datasz, memsz, rv;
+
+	if (argc < 3) {
+		usage(argv[0]);
+		exit(0);
+	}
+
+	f_in = fopen(argv[1], "r");
+	if (!f_in) {
+		perror("fopen");
+		exit(EXIT_FAILURE);
+	}
+
+	f_out = fopen(argv[2], "w");
+	if (!f_out) {
+		perror("fopen");
+		exit(EXIT_FAILURE);
+	}
+
+	/*
+	 * Parse the ELF header and find the entry point.
+	 */
+	fread((void *)&e32_hdr, sizeof(e32_hdr), 1, f_in);
+	if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS32) {
+		id = e32_hdr.e_ident;
+		class = ELFCLASS32;
+		entry = e32_hdr.e_entry;
+		phoff = e32_hdr.e_phoff;
+		phnum = e32_hdr.e_phnum;
+		phentsize = e32_hdr.e_phentsize;
+	}
+	else if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS64) {
+		/* read the header again for x86_64 
+		 * note that the elf header entry point is 64bit whereas
+		 * the entry point in PE/COFF format is 32bit!*/
+		class = ELFCLASS64;
+		rewind(f_in);
+		fread((void *)&e64_hdr, sizeof(e64_hdr), 1, f_in);
+		id = e64_hdr.e_ident;
+		entry = e64_hdr.e_entry;
+		phoff = e64_hdr.e_phoff;
+		phnum = e64_hdr.e_phnum;
+		phentsize = e64_hdr.e_phentsize;
+	} else {
+		fprintf(stderr, "Unsupported architecture\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (id[EI_MAG0] != ELFMAG0 ||
+	    id[EI_MAG1] != ELFMAG1 ||
+	    id[EI_MAG2] != ELFMAG2 ||
+	    id[EI_MAG3] != ELFMAG3) {
+		fprintf(stderr, "Input file not ELF shared object\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (!phoff || !phnum) {
+		fprintf(stderr, "Cannot find segment table\n");
+		exit(EXIT_FAILURE);
+	}
+
+	/*
+	 * Find the LOAD program header. Everything in this segment
+	 * is copied verbatim to the output file.
+	 * Although there may be several LOAD program headers, only
+	 * one is currently copied.
+	 */
+	if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS32) {
+		Elf32_Phdr phdr;
+		int i;
+
+		/* Find the first LOAD program header */
+		for (i = 0; i < phnum; i++) {
+			fseek(f_in, phoff + i * phentsize, SEEK_SET);
+			fread(&phdr, sizeof(phdr), 1, f_in);
+
+			if (phdr.p_type == PT_LOAD)
+				break;
+		}
+
+		datasz = phdr.p_filesz;
+		memsz = phdr.p_memsz;
+	} else if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS64) {
+		Elf64_Phdr phdr;
+		int i;
+
+		/* Find the first LOAD program header */
+		for (i = 0; i < phnum; i++) {
+			fseek(f_in, phoff + i * phentsize, SEEK_SET);
+			fread(&phdr, sizeof(phdr), 1, f_in);
+
+			if (phdr.p_type == PT_LOAD)
+				break;
+		}
+
+		datasz = phdr.p_filesz;
+		memsz = phdr.p_memsz;
+	}
+
+	buf = malloc(datasz);
+	if (!buf) {
+		perror("malloc");
+		exit(EXIT_FAILURE);
+	}
+
+	write_header(f_out, entry, datasz, memsz, class);
+
+	/* Write out the entire ELF shared object */
+	rewind(f_in);
+	rv = fread(buf, datasz, 1, f_in);
+	if (!rv && ferror(f_in)) {
+		fprintf(stderr, "Failed to read all bytes from input\n");
+		exit(EXIT_FAILURE);
+	}
+
+	fwrite(buf, datasz, rv, f_out);
+	free(buf);
+	fclose(f_out);
+	fclose(f_in);
+	return 0;
+}
Index: bootcd/isolinux/syslinux-6.03/efi/wrapper.h
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/wrapper.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/wrapper.h	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,170 @@
+#ifndef EFI_WRAPPER_H
+#define EFI_WRAPPER_H
+
+#define MSDOS_SIGNATURE	0x5a4d
+#define PE_SIGNATURE	0x4550
+#define PE32_FORMAT	0x10b
+#define PE32P_FORMAT	0x20b	/* PE32+ */
+
+#define IMAGE_FILE_MACHINE_I386			0x14c
+#define IMAGE_FILE_MACHINE_X86_64		0x8664
+#define IMAGE_FILE_EXECUTABLE_IMAGE		0x0002
+#define IMAGE_FILE_LINE_NUMBERS_STRIPPED	0x0004
+#define IMAGE_FILE_32BIT_MACHINE		0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED		0x0200
+
+#define IMAGE_SUBSYSTEM_EFI_APPLICATION		0x0a
+
+#define IMAGE_SCN_CNT_CODE		0x00000020
+#define IMAGE_SCN_CNT_INITIALIZED_DATA	0x00000040
+#define IMAGE_SCN_ALIGN_1BYTES		0x00100000
+#define IMAGE_SCN_ALIGN_16BYTES		0x00500000
+#define IMAGE_SCN_MEM_DISCARDABLE	0x02000000
+#define IMAGE_SCN_MEM_EXECUTE		0x20000000
+#define IMAGE_SCN_MEM_READ		0x40000000
+
+#define __packed	__attribute__((packed))
+#define OFFSETOF(t,m)	((size_t)&((t *)0)->m)
+
+struct header {
+	__uint16_t msdos_signature;
+	__uint8_t _pad1[0x16];
+	__uint16_t relocs_ptr;
+	__uint8_t __pad2[0x3c - 0x1a];
+	__uint32_t pe_hdr;
+	__uint16_t pe_signature;
+	__uint16_t _pad2;
+} __packed;
+
+/* FIXME: when setting up coff_hdr, set up optional_hdr_sz
+ * based on PE32 or PE32+ format
+ */
+/*
+ * COFF header
+ */
+struct coff_hdr {
+	__uint16_t arch;
+	__uint16_t nr_sections;
+	__uint32_t timedatestamp;
+	__uint32_t symtab;
+	__uint32_t nr_syms;
+	__uint16_t optional_hdr_sz;
+	__uint16_t characteristics;
+} __packed;
+
+struct optional_hdr {
+	__uint16_t format;
+	__uint8_t major_linker_version;
+	__uint8_t minor_linker_version;
+	__uint32_t code_sz;
+	__uint32_t initialized_data_sz;
+	__uint32_t uninitialized_data_sz;
+	__uint32_t entry_point;
+	__uint32_t base_code;
+	__uint32_t data;
+} __packed;
+
+/* For PE32+, the optional_header does NOT have
+ * data after base_code
+ */
+struct optional_hdr_pe32p {
+	__uint16_t format;
+	__uint8_t major_linker_version;
+	__uint8_t minor_linker_version;
+	__uint32_t code_sz;
+	__uint32_t initialized_data_sz;
+	__uint32_t uninitialized_data_sz;
+	__uint32_t entry_point;
+	__uint32_t base_code;
+} __packed;
+/*
+ * Extra header fields
+ */
+struct extra_hdr {
+	__uint32_t image_base;
+	__uint32_t section_align;
+	__uint32_t file_align;
+	__uint16_t major_os_version;
+	__uint16_t minor_os_version;
+	__uint16_t major_image_version;
+	__uint16_t minor_image_version;
+	__uint16_t major_subsystem_version;
+	__uint16_t minor_subsystem_version;
+	__uint32_t win32_version;
+	__uint32_t image_sz;
+	__uint32_t headers_sz;
+	__uint32_t checksum;
+	__uint16_t subsystem;
+	__uint16_t dll_characteristics;
+	__uint32_t stack_reserve_sz;
+	__uint32_t stack_commit_sz;
+	__uint32_t heap_reserve_sz;
+	__uint32_t heap_commit_sz;
+	__uint32_t loader_flags;
+	__uint32_t rva_and_sizes_nr;
+	struct {
+		__uint64_t export_table;
+		__uint64_t import_table;
+		__uint64_t resource_table;
+		__uint64_t exception_table;
+		__uint64_t certification_table;
+		__uint64_t base_relocation_table;
+	} data_directory;
+} __packed;
+
+/* Extra header for PE32+ format 
+ * FIXME: There are additional fields in Microsoft PE COFF v8
+ */
+
+struct extra_hdr_pe32p {
+	__uint64_t image_base;
+	__uint32_t section_align;
+	__uint32_t file_align;
+	__uint16_t major_os_version;
+	__uint16_t minor_os_version;
+	__uint16_t major_image_version;
+	__uint16_t minor_image_version;
+	__uint16_t major_subsystem_version;
+	__uint16_t minor_subsystem_version;
+	__uint32_t win32_version;
+	__uint32_t image_sz;
+	__uint32_t headers_sz;
+	__uint32_t checksum;
+	__uint16_t subsystem;
+	__uint16_t dll_characteristics;
+	__uint64_t stack_reserve_sz;
+	__uint64_t stack_commit_sz;
+	__uint64_t heap_reserve_sz;
+	__uint64_t heap_commit_sz;
+	__uint32_t loader_flags;
+	__uint32_t rva_and_sizes_nr;
+	struct {
+		__uint64_t export_table;
+		__uint64_t import_table;
+		__uint64_t resource_table;
+		__uint64_t exception_table;
+		__uint64_t certification_table;
+		__uint64_t base_relocation_table;
+	} data_directory;
+} __packed;
+
+struct section {
+	__uint8_t name[8];
+	__uint32_t virtual_sz;
+	__uint32_t virtual_address;
+	__uint32_t raw_data_sz;
+	__uint32_t raw_data;
+	__uint32_t relocs;
+	__uint32_t line_numbers;
+	__uint16_t relocs_nr;
+	__uint16_t line_numbers_nr;
+	__uint32_t characteristics;
+} __packed;
+
+struct coff_reloc {
+	__uint32_t virtual_address;
+	__uint32_t symtab_index;
+	__uint16_t type;
+};
+
+#endif /* EFI_WRAPPER_H */
Index: bootcd/isolinux/syslinux-6.03/efi/x86_64/linux.S
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/x86_64/linux.S	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/x86_64/linux.S	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,63 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2013 Intel Corporation; author: Matt Fleming
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#define CR0_PG_FLAG	0x80000000
+#define MSR_EFER	0xc0000080
+
+	.globl kernel_jump
+	.type kernel_jump,@function
+	.code64
+kernel_jump:
+	cli
+
+	/*
+	 * Setup our segment selector (0x10) and return address (%rdi)
+	 * on the stack in preparation for the far return below.
+	 */
+	mov	$0x1000000000, %rcx
+	addq	%rcx, %rdi
+	pushq	%rdi
+
+	.code32
+pm_code:
+
+	/* Disable IA-32e mode by clearing IA32_EFER.LME */
+	xorl	%eax, %eax
+	xorl	%edx, %edx
+	movl	$MSR_EFER, %ecx
+	wrmsr
+
+	/* Turn off paging to disable long mode */
+	movl	%cr0, %eax
+	andl	$~CR0_PG_FLAG, %eax
+	movl	%eax, %cr0
+
+	/* Far return */
+	lret
+
+	.code64
+	.align 4
+	.globl efi_handover_32
+	.type  efi_handover_32,@function
+efi_handover_32:
+	movl	$38, errno(%rip)	/* ENOSYS */
+	ret
+
+	.globl efi_handover_64
+	.globl efi_handover
+	.type  efi_handover_64,@function
+	.type  efi_handover,@function
+efi_handover_64:
+efi_handover:
+	add	$512, %rcx
+	cli
+	jmp	*%rcx
Index: bootcd/isolinux/syslinux-6.03/efi/x86_64/syslinux.ld
===================================================================
--- bootcd/isolinux/syslinux-6.03/efi/x86_64/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
+++ bootcd/isolinux/syslinux-6.03/efi/x86_64/syslinux.ld	(revision e16e8f2a41938d263af54a9fd6b4020d6c0d69fa)
@@ -0,0 +1,173 @@
+/* -----------------------------------------------------------------------
+ *   
+ *   Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Linker script for the SYSLINUX core
+ */
+
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+ENTRY(_start)
+
+SECTIONS
+{
+	. = 0;
+	ImageBase = .;		/* For gnu-efi's crt0 */
+	__module_start = .;
+	. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
+	.text : {
+		FILL(0x90909090)
+		__text_start = .;
+		*(.text)
+		*(.text.*)
+		__text_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+		*(.rodata.*)
+		__rodata_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.ctors : {
+		__ctors_start = .;
+		KEEP (*(SORT(.ctors.*)))
+		KEEP (*(.ctors))
+		__ctors_end = .;
+	}
+
+	.dtors : {
+		__dtors_start = .;
+		KEEP (*(SORT(.dtors.*)))
+		KEEP (*(.dtors))
+		__dtors_end = .;
+	}
+
+	. = ALIGN(4096);
+	.rel : {
+		*(.rel.got)
+		*(.rel.data)
+		*(.rel.data.*)
+		*(.rel.ctors)
+	}
+
+	. = ALIGN(4);
+
+	.gnu.hash : {
+		__gnu_hash_start = .;
+		*(.gnu.hash)
+		__gnu_hash_end = .;
+	}
+
+
+	.dynsym : {
+		__dynsym_start = .;
+		*(.dynsym)
+		__dynsym_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynstr : {
+		__dynstr_start = .;
+		*(.dynstr)
+		__dynstr_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynlink : {
+		__dynlink_start = .;
+		*(.dynlink)
+		__dynlink_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.got : {
+		__got_start = .;
+		KEEP (*(.got.plt))
+		KEEP (*(.got))
+		__got_end = .;
+	}
+
+	. = ALIGN(4);
+
+	.dynamic : {
+		__dynamic_start = .;
+		*(.dynamic)
+		__dynamic_end = .;
+	}
+
+	. = ALIGN(16);
+
+	.data : {
+		__data_start = .;
+		*(.data)
+		*(.data.*)
+		*(.lowmem)
+		__data_end = .;
+	}
+
+	.reloc : {
+		*(.reloc)
+	}
+
+	.symtab : {
+		*(.symtab)
+	}
+
+	.strtab : {
+		*(.strtab)
+	}
+
+	.bss (NOLOAD) : {
+		/* the EFI loader doesn't seem to like a .bss section,
+		   so we stick it all into .data: */
+		__bss_start = .;
+		*(.bss)
+		*(.bss.*)
+		*(.bss16)
+		*(.hugebss)
+		*(COMMON)
+		__bss_end = .;
+		*(.sbss)
+		*(.scommon)
+	}
+	__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
+	__bss_dwords = (__bss_len + 3) >> 2;
+
+	. = ALIGN(128);
+
+	/* Very large objects which don't need to be zeroed */
+
+	.hugebss : {
+		__hugebss_start = .;
+		*(.hugebss)
+		*(.hugebss.*)
+		__hugebss_end = .;
+	}
+
+	_end = .;
+
+	/* Stuff we don't need... */
+	/DISCARD/ : {
+		*(.eh_frame)
+		*(.comment)
+	}
+}
