Bootstrapping is the process of taking a CPU just out of reset, fetching and executing instructions serially, to a more complex running environment. The program that does that is called a "Boot loader" or "Boot strap code" or simply "Boot code". First Instruction Fetch When power is applied to a processor and it comes out of reset, it fetches its first instruction from an address that is hardwired. This address is known as the " Boot Vector " or the " Reset Vector ". The MIPS processors' boot vector is located at physical address 0x1FC00000. The MIPS processors have MMU enabled as soon as they are powered on. The MIPS core thus presents a virtual address of 0xBFC00000. The MMU translates this address to physical address of 0x1FC00000, the boot vector. This translation again is hardwired. Typically, a boot device is present at this address and responds to the read request of the processor2. See Firgure 1. The offset 0 of bootstr...
MIPS is a wonderful architecture. But when it was design virtualization wasn't much in the air. As a result, this architecture isn't compleletly virtualizable. It isn't as notorious as x86. One requirement for virtualization is the access priviledges to syste registers. MIPS does provide this. All system registers are in CP0. Any access from user space will falt. Modification access to TLBs will also fault. Then what is the problem? The problem is with the way virtual address space is laid out. For 32 bit architecture 4 GB virtual address space is available. MIPS specification reserve upper 2 GB for kernel/supervisor mode. Any access to 3rd GB in kernel mode will go untranslated by MMU. The last 4th GB will go via MMU but is only usable in kernel mode. For running a guest, only first 2 GB is available. Both guest and its userspace programs can only have 2GB of virtual address space. Linux assumes many things about address space layout. It is linked in kseg0. Kmap a...
I believe every programmer must learn assembly programming. It brings the programmer and the machine closer and strengthens the bond between them. I learned the term GIGO (Garbage In Garbage Out) when I got first introduced to computer programming. Nothing has changed since. The languages and their environments have become better beyond doubt. Still, a computer and its resources are as good as its programmer. Assembly language makes you understand how the machine is working beyond all that glittery higher level languages. If you are a system programmer, learning assembly becomes a must because there are things that C can't handle. I will leave more discussion on "Why learning assembly is important" for later post. Every new architecture that I learn, I learn its assembler first. When I got first introduced to MIPS, I learned its assembly language. Below is a program that I wrote to achieve that. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
Comments
Post a Comment