Page 1 of 1

Bios code overwrite risk?

Posted: Sat Dec 27, 2008 1:11 am
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

Re: Bios code overwrite risk?

Posted: Sat Dec 27, 2008 2:07 am
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.

Re: Bios code overwrite risk?

Posted: Sat Dec 27, 2008 4:47 am
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