svn commit: r293301 - stable/10/sys/boot/efi/loader

Ed Maste emaste at FreeBSD.org
Thu Jan 7 02:42:57 UTC 2016


Author: emaste
Date: Thu Jan  7 02:42:56 2016
New Revision: 293301
URL: https://svnweb.freebsd.org/changeset/base/293301

Log:
  MFC r288372: Use EFI page size constants instead of hardcoding 4096

Modified:
  stable/10/sys/boot/efi/loader/copy.c

Modified: stable/10/sys/boot/efi/loader/copy.c
==============================================================================
--- stable/10/sys/boot/efi/loader/copy.c	Thu Jan  7 02:41:57 2016	(r293300)
+++ stable/10/sys/boot/efi/loader/copy.c	Thu Jan  7 02:42:56 2016	(r293301)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 #define	EFI_STAGING_SIZE	48
 #endif
 
-#define	STAGE_PAGES	((EFI_STAGING_SIZE) * 1024 * 1024 / 4096)
+#define	STAGE_PAGES	EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024)
 
 EFI_PHYSICAL_ADDRESS	staging, staging_end;
 int			stage_offset_set = 0;
@@ -59,7 +59,7 @@ efi_copy_init(void)
 		    (unsigned long)(status & EFI_ERROR_MASK));
 		return (status);
 	}
-	staging_end = staging + STAGE_PAGES * 4096;
+	staging_end = staging + STAGE_PAGES * EFI_PAGE_SIZE;
 
 	return (0);
 }
@@ -114,7 +114,7 @@ efi_copy_finish(void)
 
 	src = (uint64_t *)staging;
 	dst = (uint64_t *)(staging - stage_offset);
-	last = (uint64_t *)(staging + STAGE_PAGES * EFI_PAGE_SIZE);
+	last = (uint64_t *)staging_end;
 
 	while (src < last)
 		*dst++ = *src++;


More information about the svn-src-all mailing list