summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/bios.c15
-rw-r--r--sys/amd64/include/pc/bios.h8
-rw-r--r--sys/i386/i386/bios.c15
-rw-r--r--sys/i386/include/pc/bios.h8
4 files changed, 46 insertions, 0 deletions
diff --git a/sys/amd64/amd64/bios.c b/sys/amd64/amd64/bios.c
index 98c39ba..65f79da 100644
--- a/sys/amd64/amd64/bios.c
+++ b/sys/amd64/amd64/bios.c
@@ -474,6 +474,21 @@ bios16(struct bios_args *args, char *fmt, ...)
return (i);
}
+const u_char *
+bios_string(u_int from, u_int to, const u_char *string, int len)
+{
+ const char *t, *te;
+
+ if (len == 0)
+ len = strlen(string);
+ t = (const char *)(KERNBASE + from);
+ te = (const char *)(KERNBASE + to);
+ for (; t <= te; t++)
+ if (!memcmp(string, t, len))
+ return (t);
+ return (NULL);
+}
+
#ifdef DEV_ISA
/*
* PnP BIOS interface; enumerate devices only known to the system
diff --git a/sys/amd64/include/pc/bios.h b/sys/amd64/include/pc/bios.h
index fe1f703..32b6a52 100644
--- a/sys/amd64/include/pc/bios.h
+++ b/sys/amd64/include/pc/bios.h
@@ -27,6 +27,9 @@
* $FreeBSD$
*/
+#ifndef _MACHINE_PC_BIOS_H_
+#define _MACHINE_PC_BIOS_H_
+
/*
* Signature structure for the BIOS32 Service Directory header
*/
@@ -278,3 +281,8 @@ struct bios_smap {
u_int64_t length;
u_int32_t type;
} __packed;
+
+const u_char *bios_string(u_int from, u_int to, const u_char *string, int len);
+
+
+#endif /* _MACHINE_PC_BIOS_H_ */
diff --git a/sys/i386/i386/bios.c b/sys/i386/i386/bios.c
index 98c39ba..65f79da 100644
--- a/sys/i386/i386/bios.c
+++ b/sys/i386/i386/bios.c
@@ -474,6 +474,21 @@ bios16(struct bios_args *args, char *fmt, ...)
return (i);
}
+const u_char *
+bios_string(u_int from, u_int to, const u_char *string, int len)
+{
+ const char *t, *te;
+
+ if (len == 0)
+ len = strlen(string);
+ t = (const char *)(KERNBASE + from);
+ te = (const char *)(KERNBASE + to);
+ for (; t <= te; t++)
+ if (!memcmp(string, t, len))
+ return (t);
+ return (NULL);
+}
+
#ifdef DEV_ISA
/*
* PnP BIOS interface; enumerate devices only known to the system
diff --git a/sys/i386/include/pc/bios.h b/sys/i386/include/pc/bios.h
index fe1f703..32b6a52 100644
--- a/sys/i386/include/pc/bios.h
+++ b/sys/i386/include/pc/bios.h
@@ -27,6 +27,9 @@
* $FreeBSD$
*/
+#ifndef _MACHINE_PC_BIOS_H_
+#define _MACHINE_PC_BIOS_H_
+
/*
* Signature structure for the BIOS32 Service Directory header
*/
@@ -278,3 +281,8 @@ struct bios_smap {
u_int64_t length;
u_int32_t type;
} __packed;
+
+const u_char *bios_string(u_int from, u_int to, const u_char *string, int len);
+
+
+#endif /* _MACHINE_PC_BIOS_H_ */
OpenPOWER on IntegriCloud