cvs commit: src/sys/i386/include/pc bios.h src/sys/i386/i386 bios.c

David Xu davidxu at freebsd.org
Fri Jun 4 01:25:00 GMT 2004


Nate Lawson wrote:
> On Thu, 3 Jun 2004, Poul-Henning Kamp wrote:
> 
>>phk         2004/06/03 15:36:24 PDT
>>
>>  FreeBSD src repository
>>
>>  Modified files:
>>    sys/i386/include/pc  bios.h
>>    sys/i386/i386        bios.c
>>  Log:
>>  Add new bios_string() which will hunt for a string inside a given
> 
> range
> 
>>  of the BIOS.  This can be used for finding arbitrary magic in the
> 
> BIOS
> 
>>  in order to recognize particular platforms.
>>
>>  Revision  Changes    Path
>>  1.66      +15 -0     src/sys/i386/i386/bios.c
>>  1.15      +8 -0      src/sys/i386/include/pc/bios.h
>>
>>--- src/sys/i386/i386/bios.c:1.65	Sun May 30 10:57:42 2004
>>+++ src/sys/i386/i386/bios.c	Thu Jun  3 15:36:24 2004
>>@@ -472,6 +472,21 @@
>> 	free(pte, M_TEMP);		/* ... and free it */
>>     }
>>     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);
>> }
> 
> 
> Many BIOS strings have alignment requirements.  That might be useful to
> add.  Is all of BIOS mapped into kernel memory or should this operate on
> physical addresses instead?
> 
> -Nate
> 
> 
First 4M bytes are mapped at KERNBASE, right ?
I saw KERNLOAD is 4M bytes, and from page 1 to KERNLOAD are mapped 
read-only, zero page is mapped R/W, all in locore.s.

David Xu



More information about the cvs-src mailing list