Page MenuHomeFreeBSD

D15667.id43374.diff
No OneTemporary

D15667.id43374.diff

Index: sys/powerpc/ofw/ofw_machdep.c
===================================================================
--- sys/powerpc/ofw/ofw_machdep.c
+++ sys/powerpc/ofw/ofw_machdep.c
@@ -297,15 +297,42 @@
uint64_t start, end;
ssize_t size;
struct mem_region initrdmap[1];
+ /*
+ * We expect to read values that use either 1 or 2 pcell_t's, but we always try
+ * to read 3 instead, so we can easily detect if we had more data than we wanted
+ */
+ pcell_t cell[3];
chosen = OF_finddevice("/chosen");
- size = OF_getprop(chosen, "linux,initrd-start", &start, sizeof(start));
+
+ size = OF_getencprop(chosen, "linux,initrd-start", cell, sizeof(cell));
if (size <= 0)
return (asz);
+ if (size == 4)
+ start = cell[0];
+ else if (size == 8)
+ start = (uint64_t)cell[0] << 32 | cell[1];
+ else {
+ /* Invalid value length */
+ printf("WARNING: linux,initrd-start must be either 4 or 8 bytes long\n");
+ return (asz);
+ }
- size = OF_getprop(chosen, "linux,initrd-end", &end, sizeof(end));
+ size = OF_getencprop(chosen, "linux,initrd-end", cell, sizeof(cell));
if (size <= 0)
return (asz);
+ if (size == 4)
+ end = cell[0];
+ else if (size == 8)
+ end = (uint64_t)cell[0] << 32 | cell[1];
+ else {
+ /* Invalid value length */
+ printf("WARNING: linux,initrd-end must be either 4 or 8 bytes long\n");
+ return (asz);
+ }
+
+ if (end <= start)
+ return (asz);
initrdmap[0].mr_start = start;
initrdmap[0].mr_size = end - start;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 8, 3:18 PM (11 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29408860
Default Alt Text
D15667.id43374.diff (1 KB)

Event Timeline