diff --git a/Makefile.util.def b/Makefile.util.def
index 1ccf390..32b0d3d 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -116,6 +116,7 @@ library = {
   common = grub-core/partmap/dvh.c;
   common = grub-core/partmap/sunpc.c;
   common = grub-core/partmap/bsdlabel.c;
+  common = grub-core/partmap/dfly.c;
   common = grub-core/script/function.c;
   common = grub-core/script/lexer.c;
   common = grub-core/script/main.c;
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 3bcf662..fc5680d 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1581,6 +1581,11 @@ module = {
 };
 
 module = {
+  name = part_dfly;
+  common = partmap/dfly.c;
+};
+
+module = {
   name = msdospart;
   common = parttool/msdospart.c;
 };
diff --git a/grub-core/partmap/dfly.c b/grub-core/partmap/dfly.c
new file mode 100644
index 0000000..49a887f
--- /dev/null
+++ b/grub-core/partmap/dfly.c
@@ -0,0 +1,109 @@
+/* dfly.c - Read DragonFly BSD disklabel64.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2013  Free Software Foundation, Inc.
+ *
+ *  GRUB 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, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/disk.h>
+#include <grub/disklabel64.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/partition.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static struct grub_partition_map grub_dfly_partition_map;
+
+static grub_err_t
+dfly_partition_map_iterate (grub_disk_t disk,
+			    grub_partition_iterate_hook_t hook,
+			    void *hook_data)
+{
+  struct grub_partition part;
+  struct grub_partition_disklabel64 label;
+  struct grub_partition_disklabel64_entry dpart;
+  unsigned partno, pos;
+
+  part.partmap = &grub_dfly_partition_map;
+
+  if (grub_disk_read (disk, 0, 0, sizeof (label), &label))
+    return grub_errno;
+
+  if (label.magic != grub_cpu_to_le32_compile_time (GRUB_DISKLABEL64_MAGIC))
+    {
+      grub_dprintf ("partition",
+		    "bad magic (found 0x%" PRIxGRUB_UINT32_T "; "
+		    "wanted 0x%" PRIxGRUB_UINT32_T ")\n",
+                    grub_le_to_cpu32 (label.magic),
+                    GRUB_DISKLABEL64_MAGIC);
+      return grub_error (GRUB_ERR_BAD_PART_TABLE, "disklabel64 not found");
+    }
+
+  pos = sizeof (label);
+
+  for (partno = 0;
+       partno < grub_le_to_cpu32 (label.npartitions); ++partno)
+    {
+      grub_disk_addr_t sector = pos >> GRUB_DISK_SECTOR_BITS;
+      grub_off_t       offset = pos & (GRUB_DISK_SECTOR_SIZE - 1);
+      pos += sizeof (dpart);
+      if (grub_disk_read (disk, sector, offset, sizeof (dpart), &dpart))
+	return grub_errno;
+
+      grub_dprintf ("partition",
+		    "partition %2d: offset 0x%" PRIxGRUB_UINT64_T ", "
+		    "size 0x%" PRIxGRUB_UINT64_T "\n",
+		    partno,
+		    grub_le_to_cpu64 (dpart.boffset),
+		    grub_le_to_cpu64 (dpart.bsize));
+
+      /* Is partition initialized? */
+      if (dpart.bsize == 0)
+	continue;
+
+      part.number = partno;
+      part.start = grub_le_to_cpu64 (dpart.boffset) >> GRUB_DISK_SECTOR_BITS;
+      part.len = grub_le_to_cpu64 (dpart.bsize) >> GRUB_DISK_SECTOR_BITS;
+
+      /* This is counter-intuitive, but part.offset and sector have
+       * the same type, and offset (NOT part.offset) is guaranteed
+       * to fit into part.index. */
+      part.offset = sector;
+      part.index = offset;
+
+      if (hook (disk, &part, hook_data))
+	return grub_errno;
+    }
+
+  return GRUB_ERR_NONE;
+}
+
+/* Partition map type.  */
+static struct grub_partition_map grub_dfly_partition_map =
+{
+    .name = "dfly",
+    .iterate = dfly_partition_map_iterate,
+};
+
+GRUB_MOD_INIT(part_dfly)
+{
+  grub_partition_map_register (&grub_dfly_partition_map);
+}
+
+GRUB_MOD_FINI(part_dfly)
+{
+  grub_partition_map_unregister (&grub_dfly_partition_map);
+}
diff --git a/include/grub/disklabel64.h b/include/grub/disklabel64.h
new file mode 100644
index 0000000..0105b96
--- /dev/null
+++ b/include/grub/disklabel64.h
@@ -0,0 +1,127 @@
+/*
+ * GRUB  --  GRand Unified Bootloader
+ * Copyright (C) 2013  Free Software Foundation, Inc.
+ * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
+ *
+ * This code is derived from software contributed to The DragonFly Project
+ * by Matthew Dillon <dillon@backplane.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name of The DragonFly Project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific, prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $DragonFly: src/sys/sys/disklabel64.h,v 1.4 2007/06/19 06:39:10 dillon Exp $
+ */
+
+#ifndef GRUB_DISKLABEL64_PARTITION_HEADER
+#define GRUB_DISKLABEL64_PARTITION_HEADER 1
+
+#define GRUB_DISKLABEL64_MAGIC		  ((grub_uint32_t)0xc4464c59)
+#define GRUB_DISKLABEL64_MAX_PARTITIONS	  16
+
+/*
+ * Note: offsets are relative to the base of the slice, NOT to
+ * pbase.  Unlike 32 bit disklabels the on-disk format for
+ * a 64 bit disklabel remains slice-relative.
+ *
+ * An uninitialized partition has a boffset and bsize of 0.
+ *
+ * If fstype is not supported for a live partition it is set
+ * to FS_OTHER.  This is typically the case when the filesystem
+ * is identified by its uuid.
+ */
+struct grub_partition_disklabel64_entry
+{
+  /* slice relative offset, in bytes */
+  grub_uint64_t   boffset;
+  /* size of partition, in bytes */
+  grub_uint64_t   bsize;
+  grub_uint8_t    fstype;
+  /* reserved, all must be 0 */
+  grub_uint8_t    unused01;
+  grub_uint8_t    unused02;
+  grub_uint8_t    unused03;
+  grub_uint32_t   unused04;
+  grub_uint32_t   unused05;
+  grub_uint32_t   unused06;
+  /* unused by GRUB struct uuid type_uuid */
+  grub_uint8_t    unused07[16];
+  /* unused by GRUB struct uuid stor_uuid */
+  grub_uint8_t    unused08[16];
+} __attribute__ ((packed));
+
+/*
+ * A disklabel64 starts at slice relative offset 0, NOT SECTOR 1.  In
+ * otherwords, magic is at byte offset 512 within the slice, regardless
+ * of the sector size.
+ *
+ * The reserved0 area is not included in the crc and any kernel writeback
+ * of the label will not change the reserved area on-disk.  It is purely
+ * a shim to allow us to avoid sector calculations when reading or
+ * writing the label.  Since byte offsets are used in our 64 bit disklabel,
+ * the entire disklabel and the I/O required to access it becomes
+ * sector-agnostic.
+ */
+struct grub_partition_disklabel64
+{
+  /* reserved or unused */
+  grub_int8_t     reserved0[512];
+  /* the magic number */
+  grub_uint32_t   magic;
+  /* crc32() magic thru last part */
+  grub_uint32_t   crc;
+  /* partition alignment requirement */
+  grub_uint32_t   align;
+  /* number of partitions */
+  grub_uint32_t   npartitions;
+  /* unused by GRUB struct uuid stor_uuid */
+  grub_uint8_t    unused01[16];
+
+  /* total size incl everything (bytes) */
+  grub_uint64_t   total_size;
+  /* boot area base offset (bytes) */
+  /* boot area is pbase - bbase */
+  grub_uint64_t   bbase;
+
+  /* first allocatable offset (bytes) */
+  grub_uint64_t   pbase;
+  /* last allocatable offset+1 (bytes) */
+  grub_uint64_t   pstop;
+  /* location of backup copy if not 0 */
+  grub_uint64_t   abase;
+
+  grub_uint8_t    packname[64];
+  grub_uint8_t    reserved[64];
+
+  /*
+   * Partition table entries follow. In original struct definition
+   * they were declared as part of this structure like:
+   * struct grub_partition_disklabel64_entry
+   *	partitions[GRUB_DISKLABEL64_MAX_PARTITIONS];
+   */
+} __attribute__ ((packed));
+
+#endif /* ! GRUB_DISKLABEL64_PARTITION_HEADER */
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 1507220..6875547 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -28,6 +28,12 @@ create_disk_image () {
     dd if=/dev/zero of="${name}" bs=512 count=1 seek=$((size * 2048 - 1)) status=noxfer > /dev/null
 }
 
+create_dfly_image () {
+    name="$1"
+    rm -f ${name}
+    dd if="@builddir@/tests/dfly-mbr-mbexample.img" of=${name} > /dev/null
+}
+
 check_output () {
     outfile=$1
     shift
@@ -289,3 +295,13 @@ create_disk_image "${imgfile}" 128
 ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M mkpart f 50M 60M
 list_parts part_apple "${imgfile}" "${outfile}"
 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7 $disk,apple8
+
+#
+# DragonFly BSD disklabel64
+#
+
+echo "Checking DragonFly BSD disklabel64..."
+
+create_dfly_image "${imgfile}"
+list_parts part_dfly "${imgfile}" "${outfile}"
+check_output "${outfile}" $disk $disk,msdos1 $disk,msdos1,dfly1 $disk,msdos1,dfly2 $disk,msdos1,dfly3
