These changes are needed to allow initram to chain to subsequent
stage1 phases, per the earlier discussion.
The chaining is needed since initram is going to call disable_car,
which may, among other things, move the stack around
or even lose the contents of stack. Support a return from disable_car
is a very difficult proposition.
The intent is that I can do this:
ret = execute_in_place(&archive, "normal/initram/segment0", main_ram_working);
or similar and thus chain from initram to the second part of main,
with a new stack and working dram.
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,17 @@
#endif
/**
- * run_address is passed the address of a function taking no parameters and
+ * run_address is passed the address of a function taking a single void * parameter
* jumps to it, returning the result.
* @param v the address to call as a function.
* returns value returned by the function.
*/
-int run_address(void *f)
+int run_address(void *f, void *param)
{
- int (*v) (void);
+ int (*v) (void *);
v = f;
- return v();
+ return v(param);
}
/**
@@ -123,7 +123,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 +263,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 param void * parameter
* 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 *param)
{
struct mem_file result;
int ret;
@@ -283,7 +284,7 @@
}
where = result.start + (u32)result.entry;
printk(BIOS_SPEW, "Entry point is %p\n", where);
- ret = run_address(where);
+ ret = run_address(where, param);
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 *param);
+int run_address(void *f, void *param);
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
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios