Bios code overwrite risk?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
gzaloprgm
Member
Member
Posts: 141
Joined: Sun Sep 23, 2007 4:53 pm
Location: Buenos Aires, Argentina
Contact:

Bios code overwrite risk?

Post by gzaloprgm »

Hi everyone!

I'd like to know if there's any risk of corrupting the bios by writing in it's memory directly, for example, by writing in C0000 - C7FFF or F0000 - FFFFF.

The Osdev Wiki says that that spaces are ROM, but in most bios the firmware can be upgraded (sort of an EEPROM or Flash).

Is there any risk by writing there?

Cheers,
Gonzalo
Visit https://gzalo.com : my web site with electronic circuits, articles, schematics, pcb, calculators, and other things related to electronics.
User avatar
david
Member
Member
Posts: 93
Joined: Tue Aug 21, 2007 4:22 am
Location: Beijing.China
Contact:

Re: Bios code overwrite risk?

Post by david »

VGA routiue and some BIOS ISR is in C0000h - FFFFFh.

you can not change it after int 19h.

but you can put some your codes in C0000h-DFFFFh(for example: Option ROM or firmware) before int 19h.
Just For Fun
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Bios code overwrite risk?

Post by Brendan »

Hi,
gzaloprgm wrote:I'd like to know if there's any risk of corrupting the bios by writing in it's memory directly, for example, by writing in C0000 - C7FFF or F0000 - FFFFF.

The Osdev Wiki says that that spaces are ROM, but in most bios the firmware can be upgraded (sort of an EEPROM or Flash).

Is there any risk by writing there?
First, on modern computers this area is actually RAM and the memory controller is configured to forward writes to this area to the PCI bus (where reads come from RAM), so that it's impossible for normal software to modify this RAM. If you mess with the memory controller it's usually possible to enable writes to this area and overwrite everything (but doing this may trash the BIOS's SMI handling and crash the computer); however even in this case the real ROM (just below 4 GiB) and the ROMs built into some PCI devices won't be effected and everything will work the same after a reboot.

Secondly, you can't modify the real ROM (just below 4 GiB) by writing directly to it. There's special hardware (and a special sequence of events to unlock the hardware) that needs to happen before flash memory can be changed. AFAIK this is done using a special serial bus (and not using writes to the physical addresses).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply