aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-04-13 14:14:51 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-04-13 14:14:51 -0400
commit678234467f232b147bec7cda753bbced4e67da25 (patch)
tree24534384b3bc3101096d5e6b524fed2e7fbbc9d3 /src/util.c
parent4c0c85ab862bd042e84624ddc06cf87c0ed6cc47 (diff)
downloadseabios-hppa-678234467f232b147bec7cda753bbced4e67da25.zip
seabios-hppa-678234467f232b147bec7cda753bbced4e67da25.tar.gz
seabios-hppa-678234467f232b147bec7cda753bbced4e67da25.tar.bz2
Initial support for running CBFS payloads.
Add boot menu option for CBFS payloads. Rework "override" system so that it is done per BEV. Add file prefix scanning code to CBFS. Add CBFS payload launching support.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 2b46ea2..df0e993 100644
--- a/src/util.c
+++ b/src/util.c
@@ -117,9 +117,34 @@ checksum(void *buf, u32 len)
return checksum_far(GET_SEG(SS), buf, len);
}
+size_t
+strlen(const char *s)
+{
+ if (__builtin_constant_p(s))
+ return __builtin_strlen(s);
+ const char *p = s;
+ while (*p)
+ p++;
+ return p-s;
+}
+
+// Compare two areas of memory.
+int
+memeq(const void *s1, const void *s2, size_t n)
+{
+ while (n) {
+ if (*(u8*)s1 != *(u8*)s2)
+ return 0;
+ s1++;
+ s2++;
+ n--;
+ }
+ return 1;
+}
+
// Compare two strings.
int
-streq(char *s1, char *s2)
+streq(const char *s1, const char *s2)
{
for (;;) {
if (*s1 != *s2)