My interpretation is that ROM 'listens' on the address bus like RAM or any other device. However what happens when an instruction, say from my bootloader code, tries to write to an area located within ROM. Does the instruction cycles for that instruction complete, but nothing is actually written? Is a machine check generated?
Thanks
Simple question about ROM
Re: Simple question about ROM
Why not just try it and see what happens?
Re: Simple question about ROM
It's too chipset-specific.
On rather modern PCs you don't have direct access to ROM. There's some slow read access for early boot stage when BIOS image is unpacked to RAM and then you're working with RAM only (+ some chipset-specific access via some 'firmware hub' part).
If you can address ROM directly then it depends on how it's wired: may be WE# (write enable) line is not connected to memory chip at all (so nothing happens); may be we have some kind of EEPROM, they (parallel ones, not SPI-programmable) usually interpet write access as a command (you can find exact information in datasheets), so you can easily screw things up.
I can also recommend you to study source code of Uniflash or flashrom (sorry, i don't have exact link right now but you can start from http://flashrom.org/Uniflash).
On rather modern PCs you don't have direct access to ROM. There's some slow read access for early boot stage when BIOS image is unpacked to RAM and then you're working with RAM only (+ some chipset-specific access via some 'firmware hub' part).
If you can address ROM directly then it depends on how it's wired: may be WE# (write enable) line is not connected to memory chip at all (so nothing happens); may be we have some kind of EEPROM, they (parallel ones, not SPI-programmable) usually interpet write access as a command (you can find exact information in datasheets), so you can easily screw things up.
I can also recommend you to study source code of Uniflash or flashrom (sorry, i don't have exact link right now but you can start from http://flashrom.org/Uniflash).
Re: Simple question about ROM
iansjack wrote:Why not just try it and see what happens?
I have, but only in emulated environments. As expected, the instruction cycles finish without any interrupt but the write is not reflected. I just didn't assume that in this case that the emulated environment could account for a real machine. I don't know what to expect in this case.
Re: Simple question about ROM
Nable wrote:It's too chipset-specific.
On rather modern PCs you don't have direct access to ROM. There's some slow read access for early boot stage when BIOS image is unpacked to RAM and then you're working with RAM only (+ some chipset-specific access via some 'firmware hub' part).
If you can address ROM directly then it depends on how it's wired: may be WE# (write enable) line is not connected to memory chip at all (so nothing happens); may be we have some kind of EEPROM, they (parallel ones, not SPI-programmable) usually interpet write access as a command (you can find exact information in datasheets), so you can easily screw things up.
I can also recommend you to study source code of Uniflash or flashrom (sorry, i don't have exact link right now but you can start from http://flashrom.org/Uniflash).
cool. thank you for the link