BIOS(9)
β¨ NAME β¨
bios_sigsearch, bios32_SDlookup, bios32, bios_oem_strings β interact with PC BIOS
okay so this is the BIOS(9) page from the Kernel Developer's Manual, and itβs literally all about talking to the PC BIOS, bestie. π
π οΈ SYNOPSIS π οΈ
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/pc/bios.h>
uint32_t
bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen,
int sigofs);
int
bios32_SDlookup(struct bios32_SDentry *ent);
int
bios32(struct bios_regs *br, u_int offset, u_short segment);
BIOS_PADDRTOVADDR(addr);
BIOS_VADDRTOPADDR(addr);
extern struct bios32_SDentry PCIbios;
extern struct SMBIOS_table SMBIOStable;
extern struct DMI_table DMItable;
int
bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);
struct bios_oem_signature {
char * anchor; /* search anchor string in BIOS memory */
size_t offset; /* offset from anchor (may be negative) */
size_t totlen; /* total length of BIOS string to copy */
};
struct bios_oem_range {
u_int from; /* shouldn't be below 0xe0000 */
u_int to; /* shouldn't be above 0xfffff */
};
struct bios_oem {
struct bios_oem_range range;
struct bios_oem_signature signature[];
};
π DESCRIPTION π
These functions give you a general-purpose interface for dealing with the BIOS functions and data you encounter on x86 PC-architecture systems. no cap, thatβs the whole vibe. π
bios_sigsearch()β searches the BIOS address space for a service signature, usually an uppercase ASCII sequence surrounded by underscores. The search begins atstart, or at the beginning of the BIOS ifstartis zero. It comparessiglenbytes of the BIOS image andsigatsigofsbytes offset from the current location. If no match is found, the current location is incremented byparalenbytes and the search is repeated. If the signature is found, its effective physical address is returned. If no signature is found, zero is returned. πbios_oem_strings()β searches a given BIOS memory range for one or more strings, and composes a printable concatenation of the ones it finds. The routine expects a structure describing the BIOS address range (within0xe0000-0xfffff), plus a{ NULL, 0, 0 }-terminated array ofbios_oem_signaturestructures. Those define the anchor string, an offset from the beginning of the match (which may be negative), andtotlennumber of bytes to be collected from BIOS memory starting at that offset. Unmatched anchors are ignored, whereas matches are copied from BIOS memory starting at their corresponding offset with unprintable characters being replaced with space, and consecutive spaces being suppressed. This composed string is stored inbufferup to the givenmaxlenbytes (including trailing'\0', and any trailing space suppressed). If an error is encountered, i.e. trying to read out of said BIOS range, other invalid input, or buffer overflow, a negative integer is returned, otherwise the length of the composed string is returned. In particular, a return value of0means that none of the given anchor strings were found in the specified BIOS memory range. πBIOS_VADDRTOPADDR()β returns the effective physical address which corresponds to the kernel virtual addressaddr. π¦BIOS_PADDRTOVADDR()β returns the kernel virtual address which corresponds to the effective physical addressaddr. β¨SMBIOStableβ if notNULL, points to astruct SMBIOS_tablestructure containing information read from the System Management BIOS table during system startup. πDMItableβ if notNULL, points to astruct DMI_tablestructure containing information read from the Desktop Management Interface parameter table during system startup. πΈ
π§ BIOS32 π§
At system startup, the BIOS is scanned for the BIOS32 Service Directory (part of the PCI specification), and the existence of the directory is recorded. This can then be used to locate other services. periodt. π
bios32_SDlookup()β attempts to locate the BIOS32 service matching the 4-byte identifier passed in theidentfield of theentargument. πbios32()β calls a bios32 function. This presumes that the function is capable of working within the kernel segment (normally the case). The virtual address of the entrypoint is supplied inentryand the register arguments to the function are supplied inargs. π οΈPCIbiosβ if notNULL, points to astruct bios32_SDentrystructure describing the PCI BIOS entrypoint which was found during system startup. π
source/version: Debian Β· date: August 9, 2005 β thatβs the whole vibe, bestie, go flex your BIOS knowledge π β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1997 Michael Smith
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms