PERFORCE change 46197 for review

Andrew Reisse areisse at FreeBSD.org
Fri Jan 30 16:35:14 GMT 2004


http://perforce.freebsd.org/chv.cgi?CH=46197

Change 46197 by areisse at areisse_ibook on 2004/01/30 08:34:18

	Support loading files that are made available to the kernel. To use this,
	add entries with the nvram command load_<name>=<path>. From the kernel,
	use preload_find_data to retrive the contents. Don't put symbolic links
	in the path, which must use \ instead of /.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin/apsl/BootX/bootx.tproj/include.subproj/boot_args.h#2 edit
.. //depot/projects/trustedbsd/sedarwin/apsl/BootX/bootx.tproj/sl.subproj/main.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin/apsl/BootX/bootx.tproj/include.subproj/boot_args.h#2 (text+ko) ====

@@ -58,7 +58,7 @@
 
 // Boot argument structure - passed into kernel at boot time.
 
-#define kBootArgsRevision (1)
+#define kBootArgsRevision (2)
 #define kBootArgsVersion  (1)
 
 #define BOOT_LINE_LENGTH  (256)
@@ -73,6 +73,8 @@
   void           *deviceTreeP;            /* Base of flattened device tree */
   unsigned long  deviceTreeLength;        /* Length of flattened tree */
   unsigned long  topOfKernelData;         /* Last address of kernel data area*/
+  void           *exdata;
+  unsigned long  exdatalen;
 };
 typedef struct boot_args boot_args, *boot_args_ptr;
 

==== //depot/projects/trustedbsd/sedarwin/apsl/BootX/bootx.tproj/sl.subproj/main.c#2 (text+ko) ====

@@ -467,6 +467,39 @@
   
   args->deviceTreeP = (void *)gDeviceTreeAddr;
   args->deviceTreeLength = gDeviceTreeSize;
+
+  /* Load arbitrary data */
+  args->exdata = NULL;
+  args->exdatalen = 0;
+
+  char *prevname = "", *propname;
+  while (1) {
+    if (1 != NextProp (gOptionsPH, prevname, propname))
+      break;
+    prevname = propname;
+    if (!strncmp (propname, "load_", 5)) {
+      char pfilename[255];
+      size = GetProp(gOptionsPH, propname, pfilename, 255);
+
+      if (size > 0) {
+	char datfile[512];
+	strcpy (datfile, gRootDir);
+	strcat (datfile, pfilename);
+	size = LoadFile (datfile);
+	if (size > 0) {
+	  int *v = (int *) AllocateKernelMemory (size + sizeof (int) * 5);
+	  *v = size;
+	  strcpy ((char *) (v + 1), propname + 5);
+	  memcpy (v + 5, kLoadAddr, size);
+
+	  if (args->exdata == NULL)
+	    args->exdata = v;
+	  args->exdatalen += size + sizeof(int) * 5;
+	}
+      }
+    }
+  }
+
   args->topOfKernelData = AllocateKernelMemory(0);
   
   return 0;
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list