Skip to contentSkip to conversation

BSD fixes (make OpenBSD work again)

PATCH In review Vladimir 'phcoder' Serbinenko 1 participant 2 messages Aug 23, 2009 – Aug 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BSD fixes (make OpenBSD work again)

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +14 -0
index a00842c..f1a0447 100644
@@ -1,5 +1,19 @@
 2009-08-23  Vladimir Serbinenko  <[email protected]>
 
+	Fix OpenBSD and NetBSD support.
+
+	* include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve
+	memory address conflict.
+	(OPENBSD_MMAP_ACPI): New definition.
+	(OPENBSD_MMAP_NVS): Likewise.
+	* loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI
+	and OPENBSD_MMAP_NVS.
+	Add memory map terminator
+	Explicit cast when calling grub_unix_real_boot.
+	(grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot.
+
+2009-08-23  Vladimir Serbinenko  <[email protected]>
+
 	* commands/search.c (search_fs): Try searching without autoload first.
 	* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Load
 	filesystem module explicitly for faster booting.
include/grub/i386/bsd.h +3 -1
index 117ed5c..52cff23 100644
@@ -29,7 +29,7 @@ enum bsd_kernel_types
     KERNEL_TYPE_NETBSD,
   };
 
-#define GRUB_BSD_TEMP_BUFFER	0x68000
+#define GRUB_BSD_TEMP_BUFFER   0x80000
 
 #define FREEBSD_RB_ASKNAME	(1 << 0)  /* ask for file name to reboot from */
 #define FREEBSD_RB_SINGLE       (1 << 1)  /* reboot to single user only */
@@ -157,6 +157,8 @@ struct grub_openbsd_bios_mmap
   grub_uint64_t len;
 #define	OPENBSD_MMAP_AVAILABLE	1
 #define	OPENBSD_MMAP_RESERVED 2
+#define	OPENBSD_MMAP_ACPI	3
+#define	OPENBSD_MMAP_NVS 	4
   grub_uint32_t type;
 };
 
loader/i386/bsd.c +18 -4
index d5f677a..2d6fe48 100644
@@ -568,6 +568,14 @@ grub_openbsd_boot (void)
 	  pm->type = OPENBSD_MMAP_AVAILABLE;
 	  break;
 
+        case GRUB_MACHINE_MEMORY_ACPI:
+	  pm->type = OPENBSD_MMAP_ACPI;
+	  break;
+
+        case GRUB_MACHINE_MEMORY_NVS:
+	  pm->type = OPENBSD_MMAP_NVS;
+	  break;
+
 	default:
 	  pm->type = OPENBSD_MMAP_RESERVED;
 	  break;
@@ -583,6 +591,12 @@ grub_openbsd_boot (void)
   pm = (struct grub_openbsd_bios_mmap *) (pa + 1);
   grub_mmap_iterate (hook);
 
+  /* Memory map terminator.  */
+  pm->addr = 0;
+  pm->len = 0;
+  pm->type = 0;
+  pm++;
+
   pa->ba_size = (char *) pm - (char *) pa;
   pa->ba_next = (struct grub_openbsd_bootargs *) pm;
   pa = pa->ba_next;
@@ -594,8 +608,8 @@ grub_openbsd_boot (void)
 	     (part << OPENBSD_B_PARTSHIFT));
 
   grub_unix_real_boot (entry, bootflags, bootdev, OPENBSD_BOOTARG_APIVER,
-		       0, grub_mmap_get_upper () >> 10,
-		       grub_mmap_get_lower () >> 10,
+		       0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
+		       (grub_uint32_t) (grub_mmap_get_lower () >> 10),
 		       (char *) pa - buf, buf);
 
   /* Not reached.  */
@@ -623,8 +637,8 @@ grub_netbsd_boot (void)
   bootinfo->bi_data[0] = rootdev;
 
   grub_unix_real_boot (entry, bootflags, 0, bootinfo,
-		       0, grub_mmap_get_upper () >> 10,
-		       grub_mmap_get_lower () >> 10);
+		       0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
+		       (grub_uint32_t) (grub_mmap_get_lower () >> 10));
 
   /* Not reached.  */
   return GRUB_ERR_NONE;
#1 lore raw

Committed. Now NetBSD32, NetBSD64, OpenBSD32 and OpenBSD64 are all bootable by SVN.

Quoted 6 lines · Vladimir 'phcoder' Serbinenko

--
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git