In the following levels of a computer system, on which level does firmware (e.g. BIOS) run?
I guess:
-
BIOS doesn’t depend on OS, so it must run on some level lower than level 3.
-
BIOS is written in machine language, so is it a program running no level 2?
Thanks.
1
Firmware doesn’t really fit into that hierarchy. Firmware is really just a place where a library of machine code (in the sense of level 2) is stored. Often the code stored in firmware is for the management of the motherboard and IO channels, but it need not be. I’ve got an old Tandy laptop that has Multiplan, a text editor, a BASIC interpreter, and a calendar in firmware.
I’m not quite sure if the image is accurate enough to expose such details as Firmware. For example the top 2 levels usually happen well before rest, the OS is not interpreting the program in usual sense of the word… unless we mean loader etc.
In the end the model does not have straightforward mapping to a ‘real life’ computer – I would even consider it more as a model of computation contracts then of computer as physical machine. There are some gaps between those two – for example virtually no OS is interpreting the program – it’s done in silicon/by microcode directly while OS is handling error conditions and syscalls with ISA sitting in between microcode and both OS and program.
Depending on what you mean by of firmware, you may get different answers:
- The firmware of various components may be executed on their chips. They roughly corresponds to levels 1 to 5 of ‘computers’ (i.e. processors) located on the harddrives etc.
- The firmware can be used as a synonym of OS on mobile phones. In this sense it corresponds to Level 3.
- Microcode is kind of firmware so it corresponds to Level 2.
- Finally the firmware such as UEFI or BIOS can mean various functions provided for OS in the address space. They would correspond to Level 2(a) while true OS would correspond to Level 2(b)
- Conceptually the firmware would belong to Level 1 if we treat it as model of computation and not of computer.
3
Firmware is software that runs on Read-Only Memory (ROM) or something similar. Firmware is firmer than software because software can be changed somewhere along the chain from where it is stored in some Read-Write media and loaded into writable memory and executed from there.
Firmware cannot work as in-place self-modifying code. Software can run as in-place, self-modifying code.
If you can think of a ROM and as some form of programmable hardware, then “firmware” is a form of hardware. If you can think of an FPGA as some form of programmable hardware, then you can think of FPGA Verilog and the like as a form of “firmware”.
As time marches on, the lines between software, firmware, hardware get blurred more and more.