From owner-svn-src-projects@FreeBSD.ORG Thu Jul 31 18:54:41 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 489A8524; Thu, 31 Jul 2014 18:54:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36B8C2859; Thu, 31 Jul 2014 18:54:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VIsfsB049109; Thu, 31 Jul 2014 18:54:41 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VIsfDC049108; Thu, 31 Jul 2014 18:54:41 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201407311854.s6VIsfDC049108@svn.freebsd.org> From: Andrew Turner Date: Thu, 31 Jul 2014 18:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r269346 - projects/arm64/sys/boot/efi/libefi X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 18:54:41 -0000 Author: andrew Date: Thu Jul 31 18:54:40 2014 New Revision: 269346 URL: http://svnweb.freebsd.org/changeset/base/269346 Log: Work around a bug with the Semihosting FS driver where it returns EFI_ABORTED there is no data to read. Modified: projects/arm64/sys/boot/efi/libefi/efisimplefs.c Modified: projects/arm64/sys/boot/efi/libefi/efisimplefs.c ============================================================================== --- projects/arm64/sys/boot/efi/libefi/efisimplefs.c Thu Jul 31 18:02:38 2014 (r269345) +++ projects/arm64/sys/boot/efi/libefi/efisimplefs.c Thu Jul 31 18:54:40 2014 (r269346) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define SEMIHOSTING_HACKS + static EFI_GUID sfs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL; static EFI_GUID file_info_guid = EFI_FILE_INFO_ID; @@ -145,6 +147,16 @@ efifs_read(struct open_file *f, void *bu read_size = size; status = file->Read(file, &read_size, buf); +#ifdef SEMIHOSTING_HACKS + if (status == EFI_ABORTED) { + /* + * Semihosting incorrectly returns EFI_ABORTED on EOF + * with nothing to read. + */ + *resid = size; + return (0); + } +#endif if (EFI_ERROR(status)) return (efi_status_to_errno(status));