Tuesday, January 25, 2011

BIOS

In IBM PC Compatible computers, the basic input/output system (BIOS), also known as the System BIOS, is a de facto standard defining a firmware interface(SONY VGP-BPS8 battery).

The BIOS software is built into the PC, and is the first code run by a PC when powered on ('boot firmware'). The primary function of the BIOS is to load and start an operating system(SONY VAIO VGN-FZ Battery). When the PC starts up, the first job for the BIOS is to initialize and identify system devices such as the video display card, keyboard and mouse, hard disk, CD/DVD drive and other hardware(SONY VAIO VGN-FZ11S Battery). The BIOS then locates software held on a peripheral device (designated as a 'boot device'), such as a hard disk or a CD, and loads and executes that software, giving it control of the PC. This process is known as booting, or booting up, which is short for bootstrapping(SONY vgp-bps9 battery).

BIOS software is stored on a non-volatile ROM chip built into the system on the mother board. The BIOS software is specifically designed to work with the particular type of system in question(sony vgp-bpl9 battery), including having a knowledge of the workings of various devices that make up the complementary chipset of the system. In modern computer systems, the BIOS chip's contents can be rewritten allowing BIOS software to be upgraded(SONY VAIO VGN-FZ32 Battery).

A BIOS will also have a user interface (or UI for short). Typically this is a menu system accessed by pressing a certain key on the keyboard when the PC starts. In the BIOS UI, a user can(SONY VAIO VGN-FZ440N Battery):

configure hardware

set the system clock

enable or disable system components

select which devices are eligible to be a potential boot device

set various password prompts, such as a password for securing access to the BIOS UI functions itself and preventing malicious users from booting the system from unauthorized peripheral devices(SONY VAIO VGN-FZ280E Battery).

The BIOS provides a small library of basic input/output functions used to operate and control the peripherals such as the keyboard, text display functions and so forth, and these software library functions are callable by external software(SONY VAIO VGN-FZ460E Battery). In the IBM PC and AT, certain peripheral cards such as hard-drive controllers and video display adapters carried their own BIOS extension ROM, which provided additional functionality. Operating systems and executive software, designed to supersede this basic firmware functionality, will provide replacement software interfaces to applications(SONY VAIO VGN-FZ190 Battery).

The role of the BIOS has changed over time; today BIOS is a legacy system, superseded by the more complex EFI (EFI), but BIOS remains in widespread use, and EFI booting has only been supported in Microsoft OS products supporting GPT and Linux Kernels 2.6.1 and greater builds(SONY VAIO VGN-FZ150E Battery).

BIOS is primarily associated with the 16-bit, 32-bit, and the beginning of the 64-bit architecture eras, while EFI is used for some newer 32-bit and 64-bit architectures. Today BIOS is primarily used for booting a system and for video initialization (in X.org) (SONY VAIO VGN-FZ260E Battery); but otherwise is not used during the ordinary running of a system, while in early systems (particularly in the 16-bit era), BIOS was used for hardware access – operating systems (notably MS-DOS) would call the BIOS rather than directly accessing the hardware(SONY VAIO VGN-FZ140E Battery). In the 32-bit era and later, operating systems instead generally directly accessed the hardware using their own device drivers. However, the distinction between BIOS and EFI is rarely made in terminology by the average computer user, making BIOS a catch-all term for both systems(SONY VAIO VGN-FZ11l Battery).

Terminology

The term first appeared in the CP/M operating system, describing the part of CP/M loaded during boot time that interfaced directly with the hardware (CP/M machines usually had only a simple boot loader in their ROM) (SONY VAIO VGN-FZ11z Battery). Most versions of DOS have a file called "IBMBIO.COM" or "IO.SYS" that is analogous to the CP/M BIOS.

Among other classes of computers, the generic terms boot monitor, boot loader or boot ROM were commonly used(SONY VAIO VGN-FZ11m Battery). Some Sun and PowerPC-based computers use Open Firmware for this purpose. There are a few alternatives for Legacy BIOS in the x86 world: Extensible Firmware Interface, Open Firmware (used on the OLPC XO-1) and coreboot(SONY VAIO VGN-FZ18m Battery).

IBM PC-compatible BIOS chips

In principle, the BIOS in ROM was customized to the particular manufacturer's hardware, allowing low-level services (such as reading a keystroke or writing a sector of data to diskette) to be provided in a standardized way to the operating system(SONY VAIO VGN-FZ21m Battery). For example, an IBM PC might have had either a monochrome or a color display adapter, using different display memory addresses and hardware - but the BIOS service to print a character on the screen in text mode would be the same(SONY VAIO VGN-FZ410 Battery).

Prior to the early 1990s, BIOSes were stored in ROM or PROM chips, which could not be altered by users. As its complexity and need for updates grew, and re-programmable parts became more available, BIOS firmware was most commonly stored on EEPROM or flash memory devices(SONY VAIO VGN-FZ21 Battery). According to Robert Braver, the president of the BIOS manufacturer Micro Firmware, Flash BIOS chips became common around 1995 because the electrically erasable PROM (EEPROM) chips are cheaper and easier to program than standard erasable PROM (EPROM) chips(SONY VAIO VGN-FZ160 Battery). EPROM chips may be erased by prolonged exposure to ultraviolet light, which accessed the chip via the window. Chip manufacturers use EPROM programmers (blasters) to program EPROM chips. Electrically erasable (EEPROM) chips come with the additional feature of allowing a BIOS reprogramming via higher-than-normal amounts of voltage(SONY VAIO VGN-FZ210CE Battery). BIOS versions are upgraded to take advantage of newer versions of hardware and to correct bugs in previous revisions of BIOSes.

Beginning with the IBM AT, PCs supported a hardware clock settable through BIOS. It had a century bit which allowed for manually changing the century when the year 2000 happened(SONY VAIO VGN-FZ38M Battery). Most BIOS revisions created in 1995 and nearly all BIOS revisions in 1997 supported the year 2000 by setting the century bit automatically when the clock rolled past midnight, December 31, 1999(SONY VAIO VGN-FZ31z Battery).

The first flash chips were attached to the ISA bus. Starting in 1997, the BIOS flash moved to the LPC bus, a functional replacement for ISA, following a new standard implementation known as "firmware hub" (FWH). In 2006, the first systems supporting a Serial Peripheral Interface (SPI) appeared, and the BIOS flash moved again(Sony Vaio VGN-FZ31S battery).

The size of the BIOS, and the capacities of the ROM, EEPROM and other media it may be stored on, has increased over time as new features have been added to the code; BIOS versions now exist with sizes up to 16 megabytes(SONY VAIO VGN-FZ31E Battery). Some modern motherboards are including even bigger NAND Flash ROM ICs on board which are capable of storing whole compact operating system distribution like some Linux distributions. For example, some recent ASUS motherboards included SplashTop Linux embedded into their NAND Flash ROM ICs(SONY VAIO VGN-FZ31J Battery).

Flashing the BIOS

In modern PCs the BIOS is stored in rewritable memory, allowing the contents to be replaced or 'rewritten'. This rewriting of the contents is sometimes termed 'flashing'. This is done by a special program, usually provided by the system's manufacturer. A file containing such contents is sometimes termed 'a BIOS image'(SONY VAIO VGN-FZ31M Battery). A BIOS might be reflashed in order to upgrade to a newer version to fix bugs or provide improved performance or to support newer hardware, or a reflashing operation might be needed to fix a damaged BIOS(SONY VAIO VGN-FZ31B Battery).

BIOS chip vulnerabilities

EEPROM chips are advantageous because they can be easily updated by the user; hardware manufacturers frequently issue BIOS updates to upgrade their products, improve compatibility and remove bugs(HP PAVILION DV6000 battery). However, this advantage had the risk that an improperly executed or aborted BIOS update could render the computer or device unusable. To avoid these situations, more recent BIOSes use a "boot block"; a portion of the BIOS which runs first and must be updated separately(SONY VGP-BPS13 Battery). This code verifies if the rest of the BIOS is intact (using hash checksums or other methods) before transferring control to it. If the boot block detects any corruption in the main BIOS, it will typically warn the user that a recovery process must be initiated by booting from removable media (floppy, CD or USB memory) so the user can try flashing the BIOS again(SONY VGP-BPS13B/B Battery). Some motherboards have a backup BIOS (sometimes referred to as DualBIOS boards) to recover from BIOS corruptions.

Overclocking

Some BIOS chips allow overclocking, an action in which the CPU is adjusted to a higher clock rate than its factory preset(Dell INSPIRON 1525 battery). Overclocking may, however, seriously compromise system reliability in insufficiently cooled computers and generally shorten component lifespan. Overclocking, incorrectly performed, may also cause component temperatures to rise so quickly that they destroy themselves(Dell INSPIRON E1505 battery).

Virus attacks

There are at least three known BIOS attack viruses, two of which were for demonstration purposes.

CIH

The first was a virus which was able to erase Flash ROM BIOS content, rendering computer systems unstable(SONY VGP-BPS13/B Battery). CIH, also known as "Chernobyl Virus", appeared for the first time in mid-1998 and became active in April 1999. It affected systems' BIOS's and often they could not be fixed on their own since they were no longer able to boot at all(Sony VAIO VGN-FZ15T Battery). To repair this, Flash ROM IC had to be removed from the motherboard to be reprogrammed elsewhere. Damage from CIH was possible since the virus was specifically targeted at the then widespread Intel i430TX motherboard chipset, and the most common operating systems of the time were based on the Windows 9x family allowing direct hardware access to all programs(Sony VAIO VGN-FZ15G Battery).

Modern systems are not vulnerable to CIH because of a variety of chipsets being used which are incompatible with the Intel i430TX chipset, and also other Flash ROM IC types. There is also extra protection from accidental BIOS rewrites in the form of boot blocks which are protected from accidental overwrite or dual and quad BIOS equipped systems which may, in the event of a crash, use a backup BIOS(SONY VGP-BPS13A/S Battery). Also, all modern operating systems like Linux, Mac OS X, Windows NT-based Windows OS like Windows 2000, Windows XP and newer, do not allow user mode programs to have direct hardware access. As a result, as of 2008, CIH has become essentially harmless(SONY VGP-BPS13AS Battery), at worst causing annoyance by infecting executable files and triggering alerts from antivirus software. Other BIOS viruses remain possible, however; since Windows users without Windows Vista/7's UAC run all applications with administrative privileges, a modern CIH-like virus could in principle still gain access to hardware(SONY VGP-BPS13S Battery).

Black Hat 2006

The second one was a technique presented by John Heasman, principal security consultant for UK based Next-Generation Security Software at the Black Hat Security Conference (2006), where he showed how to elevate privileges and read physical memory, using malicious procedures that replaced normal ACPI functions stored in flash memory(SONY VGP-BPS13B/S Battery).

Persistent BIOS Infection

The third one, known as "Persistent BIOS infection", was a method presented in CanSecWest Security Conference (Vancouver, 2009) and SyScan Security Conference (Singapore, 2009) where researchers Anibal Sacco and Alfredo Ortega, from Core Security Technologies(SONY VAIO PCG-5G2L battery), demonstrated insertion of malicious code into the decompression routines in the BIOS, allowing for nearly full control of the PC at every start-up, even before the operating system is booted(SONY VAIO VGN-FZ21E Battery).

The proof-of-concept does not exploit a flaw in the BIOS implementation, but only involves the normal BIOS flashing procedures. Thus, it requires physical access to the machine or for the user on the operating system to be root(SONY VAIO VGN-FZ21Z Battery). Despite this, however, researchers underline the profound implications of their discovery: “We can patch a driver to drop a fully working rootkit. We even have a little code that can remove or disable antivirus(SONY VAIO VGN-FZ21J Battery).”

Firmware on adapter cards

A computer system can contain several BIOS firmware chips. The motherboard BIOS typically contains code to access hardware components absolutely necessary for bootstrapping the system, such as the keyboard (either PS/2 or on a USB human interface device), and storage (floppy drives, if available, and IDE or SATA hard disk controllers) (SONY Vaio VGN-FW11 Battery). In addition, plug-in adapter cards such as SCSI, RAID, Network interface cards, and video boards often include their own BIOS (e.g. Video BIOS), complementing or replacing the system BIOS code for the given component(SONY Vaio VGN-FW11M Battery). (This code is generally referred to as an option ROM.) Even devices built into the motherboard can behave in this way; their option ROMs can be stored as separate code on the main BIOS flash chip, and upgraded either in tandem with, or separately to, the main BIOS(SONY Vaio VGN-FW11S Battery).

An add-in card usually only requires an option ROM if it:

Needs to be used before the operating system can be loaded (usually this means it is required in the bootstrapping process), and

Is too sophisticated or specific a device to be handled by the main BIOS

Older PC operating systems, such as MS-DOS (including all DOS-based versions of Microsoft Windows), and early-stage bootloaders, may continue to use the BIOS for input and output(SONY Vaio VGN-FW21E Battery). However, the restrictions of the BIOS environment means that modern OSes will almost always use their own device drivers to directly control the hardware. Generally, these device drivers only use BIOS and option ROM calls for very specific (non-performance-critical) tasks, such as preliminary device initialization(SONY Vaio VGN-FW21J Battery).

In order to discover memory-mapped ISA option ROMs during the boot process, PC BIOS implementations scan real memory from 0xC0000 to 0xF0000 on 2 KiB boundaries, looking for a ROM signature: 0xAA55 (0x55 followed by 0xAA, since the x86 architecture is little-endian) (SONY Vaio VGN-FW21L Battery). In a valid expansion ROM, this signature is immediately followed by a single byte indicating the number of 512-byte blocks it occupies in real memory. The next byte contains an offset describing the option ROM's entry point, to which the BIOS immediately transfers control(SONY Vaio VGN-FW21M Battery). At this point, the expansion ROM code takes over, using BIOS services to register interrupt vectors for use by post-boot applications, provide a user configuration interface, or display diagnostic information.

There are many methods and utilities for examining the contents of various motherboard BIOS and expansion ROMs, such as Microsoft DEBUG or the UNIX dd(SONY VGP-BPS13Q Battery).

BIOS boot specification

If the expansion ROM wishes to change the way the system boots (such as from a network device or a SCSI adapter for which the BIOS has no driver code), it can use the BIOS Boot Specification (BBS) API to register its ability to do so(SONY VGP-BPS13B/Q Battery). Once the expansion ROMs have registered using the BBS APIs, the user can select among the available boot options from within the BIOS's user interface. This is why most BBS compliant PC BIOS implementations will not allow the user to enter the BIOS's user interface until the expansion ROMs have finished executing and registering themselves with the BBS API(SONY VGN NR11S/S battery).

Changing role of the BIOS

Some operating systems, for example MS-DOS, rely on the BIOS to carry out most input/output tasks within the PC. A variety of technical reasons makes it inefficient for some recent operating systems written for 32-bit CPUs such as Linux and Microsoft Windows to invoke the BIOS directly(SONY VGN NR11M/S battery). Larger, more powerful, servers and workstations using PowerPC or SPARC CPUs by several manufacturers developed a platform-independent Open Firmware (IEEE-1275), based on the Forth programming language. It is included with Sun's SPARC computers, IBM's RS/6000 line, and other PowerPC CHRP motherboards(SONY VGN NR11Z/S battery). Later x86-based personal computer operating systems, like Windows NT, use their own, native drivers which also makes it much easier to extend support to new hardware, while the BIOS still relies on a legacy 16-bit real mode runtime interface(SONY VGN NR11Z/T battery).

There was a similar transition for the Apple Macintosh, where the system software originally relied heavily on the ToolBox—a set of drivers and other useful routines stored in ROM based on Motorola's 680x0 CPUs. These Apple ROMs were replaced by Open Firmware in the PowerPC Macintosh, then EFI in Intel Macintosh computers(SONY VGP-BPS13A/Q Battery).

Later BIOS took on more complex functions, by way of interfaces such as ACPI; these functions include power management, hot swapping, thermal management. To quote Linus Torvalds, the task of BIOS is "just load the OS and get the hell out of there"(SONY VGP-BPS21/S Battery). However BIOS limitations (16-bit processor mode, only 1 MiB addressable space, PC AT hardware dependencies, etc.) were seen as clearly unacceptable for the newer computer platforms(SONY VGP-BPS21 Battery). Extensible Firmware Interface (EFI) is a specification which replaces the runtime interface of the legacy BIOS. Initially written for the Itanium architecture, EFI is now available for x86 and x86-64 platforms; the specification development is driven by The Unified EFI Forum, an industry Special Interest Group(SONY VGP-BPS21B Battery).

Linux has supported EFI via the elilo and GRUB boot loaders. The Open Source community increased their effort to develop a replacement for proprietary BIOSes and their future incarnations with an open sourced counterpart through the coreboot and OpenBIOS/Open Firmware projects(SONY VGP-BPS21A/B Battery). AMD provided product specifications for some chipsets, and Google is sponsoring the project. Motherboard manufacturer Tyan offers coreboot next to the standard BIOS with their Opteron line of motherboards. MSI and Gigabyte Technology have followed suit with the MSI K9ND MS-9282 and MSI K9SD MS-9185 resp. the M57SLI-S4 models(SONY VAIO PCG-5K1L battery).

Some BIOSes contain a "SLIC", a digital signature placed inside the BIOS by the manufacturer, for example Dell. This SLIC is inserted in the ACPI table and contains no active code(SONY VAIO PCG-6W2L battery). Computer manufacturers that distribute OEM versions of Microsoft Windows and Microsoft application software can use the SLIC to authenticate licensing to the OEM Windows Installation disk and/or system recovery disc containing Windows software. Systems having a SLIC can be activated with an OEM Product Key, and they verify an XML formatted OEM certificate against the SLIC in the BIOS as a means of self-activating(SONY VAIO PCG-7112L battery). If a user performs a fresh install of Windows, they will need to have possession of both the OEM key and the digital certificate for their SLIC in order to bypass activation; in practice this is extremely unlikely and hence the only real way this can be achieved is if the user performs a restore using a pre-customised image provided by the OEM(SONY VAIO PCG-8Z1L battery).

Recent Intel processors (P6 and P7) have reprogrammable microcode. The BIOS may contain patches to the processor code to allow errors in the initial processor code to be fixed, updating the processor microcode each time the system is powered up(SONY VAIO PCG-8Z2L battery). Otherwise, an expensive processor swap would be required. For example, the Pentium FDIV bug became an expensive fiasco for Intel that required a product recall because the original Pentium did not have patchable microcode(SONY VAIO PCG-8Y2L battery).

The BIOS business

The vast majority of PC motherboard suppliers license a BIOS "core" and toolkit from a commercial third-party, known as an "independent BIOS vendor" or IBV. The motherboard manufacturer then customizes this BIOS to suit its own hardware. For this reason, updated BIOSes are normally obtained directly from the motherboard manufacturer(SONY VAIO PCG-8Y1L battery).

Major BIOS vendors include American Megatrends (AMI), Insyde Software, Phoenix Technologies and Byosoft. Former vendors include Award Software and Microid Research which were acquired by Phoenix Technologies in 1998. Phoenix has now phased out the Award Brand name. General Software, which was also acquired by Phoenix in 2007, sold BIOS for Intel processor based embedded systems(SONY VAIO PCG-7133L battery).

No comments:

Post a Comment