News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

what is bios

Started by xiahan, October 08, 2012, 05:51:30 AM

Previous topic - Next topic

xiahan

i know bios is a silicon chip, here is my question:
1. dose bios can execute codes, like copy some bytes from rom to ram;
2. how does bios address ram and rom, how does it know where ram and rom is;
3. when power on, why bios knows what to do, and how does it do it.


help!!!!!
thanks advance.

K_F

This is a head-banger  :bgrin:

Sorry xiahan - just my sense of humor  :biggrin:

BIOS - Basic Input Output System

Bios is essentially the startup code for the motherboard - to get it working.
When you power-up (or reset) your PC,  the processor (CPU) has to start somewhere, as at this stage it is 'clueless'
The BIOS ... sets up a very 'basic' system for the next stage of the BOOT process

Times have changed, but generally the next stage is reading the CMOS which holds hardware configuration info and other details.
From this BIOS now starts loading boot information from hard disk, or by other means... then finally your Operating System (windoze or other)

BIOS is an executable in the most lowest level of the PC and is the realm of hardware and system programmers.
If you don't know the hardware like the back of your hand - do not touch the BIOS  ;)

Ram/Rom
Every motherboard is designed by a manufacturer. In the design there are different types of chips which control different aspects of the computer.
Each of these chips have datasheets a gazillion pages long, describing how to correctly program them - This is what the manufacturers BIOS programmer does.
These chips are Memory management, communications, on-board video...ect.

Every manufacturers motherboard (mobo) is slightly different, but functionally the same through BIOS
BIOS is the mobo's hardware interface/connection for the Operating System (Windoze).
:t
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

xiahan

hi K_F, i see my post again,really some kind of twisted,hah hah!
but the time i write the post i was just follow the way the sites on the Internet explaining it.
dose u mean the CMOS  contains the specific info of the mobo whitch it atached ,so the cpu can has no knowledge of the hardware , it just execute instructions.

dedndave

when an intel x86 processor starts up - or when it is reset - it begins executing at a fixed address
the BIOS ROM (or flash) is located at that address and contains code to get things going

beyond that, the primary function of BIOS is to provide a standardized interface to the disk operating system
that is to say that it provides a layer of isolation between the hardware and the OS

Quote1. dose bios can execute codes, like copy some bytes from rom to ram
the bios does execute code and does initialize RAM

Quote2. how does bios address ram and rom, how does it know where ram and rom is
the memory map for intel compatible PC's is more-or-less standardized
some of the standardization came from intel
some came from IBM
some comes from the different companies that have written BIOS's over time

Quote3. when power on, why bios knows what to do, and how does it do it
refer to the intel manuals
it starts out at a fixed address and executes the code at that address
as i recall, most of the registers are initially set to 0, except EDX and EIP

xiahan

about the memory mapping,the BIOS ROM must have a address,to accelerate speed,the codes insides rom is copied to physical memory and then the addree of the BIOS ROM is redirect to the address in the physical memory,is that true,any docs will be preciated.

MichaelW

I have not checked any recent systems, but at one time there was a common BIOS option to "shadow" the system BIOS (and IIRC also the VGA BIOS) in memory, allowing the BIOS code to execute from there. I never investigated this, but I would guess that the address "redirection" was implemented by reprogramming the chipset address decoders. And I also recall an option to cache the BIOS, but I never investigated this either. In any case, with a PM OS that does not use the BIOS once it's up and running these options provide essentially no benefit, so they may have been eliminated in recent systems.
Well Microsoft, here's another nice mess you've gotten us into.

xiahan

now i have a more clear view of the bios,thanks guys!

dedndave

i think the shadow stuff basically copied the ROM into RAM and vectored the interrupts to appropriate addresses
a good section of the ROM is startup code, however
this is particularly true on newer systems, as the hardware requires a lot more initialization

you can get the intel manuals here...
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

this website has a lot of BIOS-related information...
http://www.bioscentral.com/

back in the day, Award and Phoenix were 2 companies that wrote generic BIOS
i understand they have now merged as 1 company and probably write for several manufacturers
AMI was another one that wrote BIOS
you can google those names and find more info

FORTRANS

Hi,

   I think MichaelW was correct about the shadowing of
the BIOS and VGA BIOS.  The code was copied to RAM
and then remapped that RAM to the ROM address space.
This was to speed things up for DOS programs and maybe
early versions of Windows (or the like).

   Most protected mode operating systems do not use
the BIOS, except in a "compatibility" mode for problematic
systems.  Presumably now an obsolete mode.  For example,
OS/2 would normally use protected mode code to access
the hard drive, but some systems did not work and forced
the use of a BIOS based driver for the "hard drive".  Usually
something emulating a hard drive, or an oddball really
old drive.  Using the BIOS to access anything in a PM OS
is/was a horrible performance hit.  And of no concern with
modern systems.  Modern probably meaning later than
the 486.

HTH,

Steve N.

mineiro

Basic Input Output System check hardware devices, in a process called POST (power on self test), like recognize ammount of memory, hard drivers and others devices...
The code (read code and/or data) inside bios are called firmware. So, bios offers a setup program to us configure devices on the motherboard.
The firmware offers too some interruptions, so, you can use bios code to reach some facilities while coding (using 'int' instruction).
When you wakeup you computer, bios get the control, check everything, if find some problems, it send a speaker sound (beeps), if not, it access the code on specific offset, on configured boot device, and that will wakeup the O.S.
The batery (cmos) hold your saved configuration, and if you like to reset that information, remove the batery and generate a short-circuit on specifc jumper (to discharge the capacitor).
Bios know a valid boot code by searching by a signature (55aah, or 0aa55h, I forgot), generaly on the first sector of that device.

One day, i was updating 5 same computer bios (same motherboard), and on the half of write process to bios, blackout ocurred. After, I was able to put computer on, but bios code does not work, appears to me like a standby mode. So, how can I update bios using an image inside floppy if I cannot access floppy?
So, I removed that chip (integrated circuit), put a good one (removed from other motherboard) on that motherboard, turn computer on, read their code to update, and before write, with much patience and carefully to not create a short-circuit, I removed the good bios chip, put the damaged (firmware) one, and after started the write process. I was able to restore the damaged bios code. This was my last choice, and worked.

So, if I was able to update that internally bios code, we can create functions too and insert in that bios, like let's supose, optimized strlen function, and access then using interruptions or probably other ways. Not the best place to put that function, but... . From ms-dos times, I remember one debug program that offers you an easy way to overwrite specific memory places (like video rom bios). In today days, I remember see some discussions on vmware board about bios code and testing.
Old bios have only a rom part, new ones offers you a writeable part.

xiahan

hi, eiro!

you are very familiar with the motherboard, can you explain more about the phrase

Quote
So, I removed that chip (integrated circuit), put a good one (removed from other motherboard) on that motherboard, turn computer on, read their code to update, and before write, with much patience and carefully to not create a short-circuit, I removed the good bios chip, put the damaged (firmware) one, and after started the write process. I was able to restore the damaged bios code. This was my last choice, and worked.


seems like u removed the bios chip, and when u put on a good one, u
Quote
read their code to update
read whos code? the code inside rom?update what?
Quote
with much patience and carefully to not create a short-circuit, I removed the good bios chip,
you replace the bios chip while the computor is on?
Quote
I was able to restore the damaged bios code.
can firmware be damaged? if so, how can you restore?

sorry for so many qustion mark, :biggrin:

maybe my question is very silly, please forgive me.

PsYcHoCoDe

heh, the BIOS/Firmware can always be damaged, when u do sth with it... so best practice, FIRST do a backup copy/dump, while being able to RESTORE it in case of an eventual failure, mate!

TouEnMasm


each firmware give all you need to update your bios.
Be sure to find the good , this could take a certain time (many differents CPU).
Dowload it,with it you have a prog who made a backup of your old bios.
To be sure not to do a mistake,run msconfig.
Look the tools in it,run them and you have the answer.
Fa is a musical note to play with CL

mineiro

Hello Sir xiahan;
Inside your motherboard cd-rom, have some utilities, like drivers to specific O.S. and an image of your bios, and an utility to you be able to update bios code (the code is stored inside the chip, firmware).
So you can update the code inside that chip. When I was updating that code, occurred a fail on source suplly. So, bios code cannot take on, like when you turn on your computer and press "del" or "f1" key, the code inside that chip was corrupted, so no response.
When you are updating bios code, the program ("afudos" to asus, forgot others) ask to you if you like to save the image inside bios as an file, and I saved it to floppy. When the program asked me to press a key to write the saved image (floppy) inside bios, I removed bios chip with computer on, put a fault on that place, and pressed a key to start writing the code to that chip. You can see this process like clonning a floppy disk, you need remove the original one and put other disk to write the image on that.
Some programs today permit you to update bios code while inside windows, but I have done that while inside ms-dos.
If I do not have other same bios chip to that motherboard, so the solution is remove that chip and give that with image to an eletronic person, he probably have a writer (flashrom,eprom,..) to restore the code inside that chip.
I'm not updated with new technologies; I have read that you can export/import and share your overclock settings with others, mouse support inside bios setup, games inside bios, ... . My last reading was about uefi that is new to me.

xiahan

hi,mineiro,the good bios's code is shadowed into ram so it can run without bios chip present on the motherboard, and based on the same point, the bios code can be updated is possible.