okay peter how's this?

ron
This change allows code to pass a single void * parameter to an XIP function. 
It is needed for a proposed fix for the disable_car() changes.

Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>

Index: lib/lar.c
===================================================================
--- lib/lar.c	(revision 542)
+++ lib/lar.c	(working copy)
@@ -32,17 +32,19 @@
 #endif
 
 /**
- * run_address is passed the address of a function taking no parameters and
- * jumps to it, returning the result. 
- * @param v the address to call as a function. 
+ * run_address is passed the address of a function taking a single void * parameter
+ * jumps to it, returning the result. Note that there is no requirement that the called
+ * function ever return. 
+ * @param f The function to call
+ * @param parameter An opaque parameter, passed as a void *, usually NULL
  * returns value returned by the function. 
  */
 
-int run_address(void *f)
+int run_address(void *f, void *parameter)
 {
-	int (*v) (void);
+	int (*v) (void *);
 	v = f;
-	return v();
+	return v(parameter);
 }
 
 /**
@@ -123,7 +125,7 @@
 			result->entry = (void *)ntohl((u32)header->entry);
 			result->loadaddress = (void *)ntohl((u32)header->loadaddress);
 			printk(BIOS_SPEW, 
-			"start %p len %d reallen %d compression %x entry %p loadaddress %p\n", 
+			"FOUND: start %p len %d reallen %d compression %x entry %p loadaddress %p\n", 
 				result->start, result->len, result->reallen, 
 				result->compression, result->entry, result->loadaddress);
 			return 0;
@@ -263,9 +265,10 @@
  * Given a file name in the LAR , search for it, and execute it in place. 
  * @param archive A descriptor for current archive.
  * @param filename filename to find
+ * @param parameter An opaque parameter, passed as a void *, usually NULL
  * returns 0 on success, -1 otherwise
  */
-int execute_in_place(const struct mem_file *archive, const char *filename)
+int execute_in_place(const struct mem_file *archive, const char *filename, void *parameter)
 {
 	struct mem_file result;
 	int ret;
@@ -283,7 +286,7 @@
 	}
 	where = result.start + (u32)result.entry;
 	printk(BIOS_SPEW, "Entry point is %p\n", where);
-	ret = run_address(where);
+	ret = run_address(where, parameter);
 	printk(BIOS_SPEW, "run_file returns with %d\n", ret);
 	return ret;
 }
Index: include/lar.h
===================================================================
--- include/lar.h	(revision 542)
+++ include/lar.h	(working copy)
@@ -85,8 +85,8 @@
 int find_file(const struct mem_file *archive, const char *filename, struct mem_file *result);
 int copy_file(const struct mem_file *archive, const char *filename, void *where);
 int run_file(const struct mem_file *archive, const char *filename, void *where);
-int execute_in_place(const struct mem_file *archive, const char *filename);
-int run_address(void *f);
+int execute_in_place(const struct mem_file *archive, const char *filename, void *parameter);
+int run_address(void *f, void *parameter);
 void *load_file(const struct mem_file *archive, const char *filename);
 void *load_file_segments(const struct mem_file *archive, const char *filename);
 #endif /* LAR_H */
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to