Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151584394
D5492.id13884.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5492.id13884.diff
View Options
Index: sys/boot/uboot/common/main.c
===================================================================
--- sys/boot/uboot/common/main.c
+++ sys/boot/uboot/common/main.c
@@ -387,7 +387,7 @@
}
int
-main(void)
+main(int argc, char **argv)
{
struct api_signature *sig = NULL;
int load_type, load_unit, load_slice, load_partition;
@@ -395,12 +395,15 @@
const char *ldev;
/*
+ * We first check if a command line argument was passed to us containing
+ * API's signature address. If it wasn't then we try to search for the
+ * API signature via the usual hinted address.
* If we can't find the magic signature and related info, exit with a
* unique error code that U-Boot reports as "## Application terminated,
* rc = 0xnnbadab1". Hopefully 'badab1' looks enough like "bad api" to
* provide a clue. It's better than 0xffffffff anyway.
*/
- if (!api_search_sig(&sig))
+ if (!api_parse_cmdline_sig(argc, argv, &sig) && !api_search_sig(&sig))
return (0x01badab1);
syscall_ptr = sig->syscall;
Index: sys/boot/uboot/lib/glue.h
===================================================================
--- sys/boot/uboot/lib/glue.h
+++ sys/boot/uboot/lib/glue.h
@@ -58,6 +58,7 @@
int syscall(int, int *, ...);
void *syscall_ptr;
+int api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig);
int api_search_sig(struct api_signature **sig);
#define UB_MAX_MR 16 /* max mem regions number */
Index: sys/boot/uboot/lib/glue.c
===================================================================
--- sys/boot/uboot/lib/glue.c
+++ sys/boot/uboot/lib/glue.c
@@ -68,6 +68,41 @@
}
/*
+ * Checks to see if API signature's address was given to us as a command line
+ * argument by U-Boot.
+ *
+ * returns 1/0 depending on found/not found result
+ */
+int
+api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig)
+{
+ unsigned long api_address;
+ int c;
+
+ api_address = 0;
+ opterr = 0;
+ optreset = 1;
+ optind = 1;
+
+ while ((c = getopt (argc, argv, "a:")) != -1)
+ switch (c) {
+ case 'a':
+ api_address = strtoul(optarg, NULL, 16);
+ break;
+ default:
+ break;
+ }
+
+ if (api_address != 0) {
+ *sig = (struct api_signature *)api_address;
+ if (valid_sig(*sig))
+ return (1);
+ }
+
+ return (0);
+}
+
+/*
* Searches for the U-Boot API signature
*
* returns 1/0 depending on found/not found result
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 8:23 AM (15 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31213050
Default Alt Text
D5492.id13884.diff (2 KB)
Attached To
Mode
D5492: Improve U-Boot API detection
Attached
Detach File
Event Timeline
Log In to Comment