-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.json
More file actions
1 lines (1 loc) · 6.99 KB
/
index.json
File metadata and controls
1 lines (1 loc) · 6.99 KB
1
[{"content":"Today, we will be learning about exception levels.(have patience, we\u0026rsquo;ll write actual code too, but in the next post.) Exceptions levels define execution privilege at each level. There are 4 exception levels in ARMv8 architecture.\n Exception Level 0 (EL0): This Exception Level or Privilege Level is commonly used by userspace applications. Firefox, Libreoffice, VLC Media Player, and VirtualBox are a few examples of userspace applications. Exception Level 1 (EL1): Kernel and all privileged code associated with kernel works in EL1 execution level. Exception Level 2 (EL2): Hypervisor(including KVM) works in exception level. Exception Level 3 (EL3): Secure Monitor You might be wondering how we go from one exception level to another. Exception is any event that can cause the currently executing program to be suspended and cause a state change to execute code to handle that exception. Other processor architectures might describe this as an interrupt. Exception Levels would remain the same or increase when an exception occurs. Exceptions would always be handled at the same exception level or higher.\nLet\u0026rsquo;s understand this with a simple example. Imagine that you have developed an operating system kernel running at EL1 and you want to wake up a secondary CPU core(it is asleep at the start.). The code which makes it possible to wake up a secondary core is present at EL3 in the form of an exception handler. You would cause an exception to occur and EL3 would wake up the core for you. When the handler at EL3 does its magic, it would then return to your exception level.\nFollowing instructions can cause different exceptions to occur. (Assuming that hypervisor is not trapping exceptions, we\u0026rsquo;ll know more about SMC trapping in future posts.)\n SMC or Secure Monitor Call instruction in armv8 assembly can cause an exception to occur, which will normally be handled at EL3 or Secure Monitor. hvc or Hypervisor Call is another instruction that can cause an exception, to be handled at EL2 or Hypervisor. svc or Supervisor Call instruction can cause an exception to occur, which will be handled at EL1 or Kernel. Note that exceptions would increase either the exception level or the exception level would remain the same. The occurrence of an exception would never decrease the exception level. Conversely, returning from an exception would always cause the exception level to decrease or remain the same.\n eret instruction can be used to return to a lower exception level or remain on the same exception level. When an exception handler does what it has done, then it will end the exception by using the eret instruction. I hope you were able to digest everything. Please refer to this documentation, if you would like to know more. That is one of the excellent documentation I have seen. That is it for today. Now those basics are covered, we will try to write a bare-metal hypervisor binary at EL2 or Hypervisor Level!. Stay Tuned.\n","permalink":"http://arm64hypervisor.com/posts/exception_levels/","summary":"Today, we will be learning about exception levels.(have patience, we\u0026rsquo;ll write actual code too, but in the next post.) Exceptions levels define execution privilege at each level. There are 4 exception levels in ARMv8 architecture.\n Exception Level 0 (EL0): This Exception Level or Privilege Level is commonly used by userspace applications. Firefox, Libreoffice, VLC Media Player, and VirtualBox are a few examples of userspace applications. Exception Level 1 (EL1): Kernel and all privileged code associated with kernel works in EL1 execution level.","title":"Tutorial 1: Exception Levels"},{"content":"This is a series of tutorials that I never had a year ago when I decided to write a bare-metal hypervisor on Raspberry Pi 4, Leo Hypervisor. I did not have prior experience with bare-metal or even kernel development. Therefore, I will be sharing all that I have learned in the following series of tutorials. You are welcome to contribute to this project and I would also love to learn from you. I\u0026rsquo;m excited that we\u0026rsquo;re on this journey together.\nWhat is a hypervisor? The hypervisor is software that creates and runs virtual machines. There can two types of hypervisors. They can be classified into two categories: Type 1 or bare metal and Type 2.\n Type 1: Type 1, also known as bare-metal hypervisors, have direct access to the hardware and controls all the operating systems that are running on the system. Xen and Hyper-V are bare-metal hypervisors. Type 2: Type, also known as hosted hypervisors have to go through the host operating system to reach the hardware. An example of a Type 2 hypervisor is VirtualBox. What would be the scope? Bare metal hypervisors can be very complex. Therefore, we would limit our scope at first. We will be gradually writing a simple hypervisor, which can write to a serial console, successfully load a Linux kernel, trap exceptions or SMC calls and manage stage 2 memory management. Our hypervisor would only run a single virtual machine. Probably after accomplishing these milestones, we can go further. I will be writing a post at most every week and we\u0026rsquo;ll write this hypervisor together.\nHardware prerequisites An RPi4 with a dedicated power supply A micro-SD card to boot the RPi4 from A computer with a GNU/Linux distribution on it. UART to TTL cable Software prerequisites You will need a GNU/Linux distribution on your laptop/desktop. Please install one if you do not have it. GNU/Linux operating systems are open-source, free(as in freedom of speech as well as in free beer), and lightweight.\nYou should be able to flash the SD card with Raspbian, raspberry pi\u0026rsquo;s recommended operating system. For now, we only need this.\nWe will also use Trusted Firmware-A(TF-A) as the firmware implementation for Raspberry Pi 4. You can follow these instructions to compile and use it in your Raspberry Pi.\nYou will be using UART serial console to debug your hypervisor. You\u0026rsquo;ll need to learn to use a serial console with Raspberry Pi. Adafruit has great tutorial on it.\nFor now, this is all we need. In the next post, we will be learning about ARMv8 Exception Levels.\n","permalink":"http://arm64hypervisor.com/posts/intro/","summary":"This is a series of tutorials that I never had a year ago when I decided to write a bare-metal hypervisor on Raspberry Pi 4, Leo Hypervisor. I did not have prior experience with bare-metal or even kernel development. Therefore, I will be sharing all that I have learned in the following series of tutorials. You are welcome to contribute to this project and I would also love to learn from you.","title":"Tutorial 0: Introduction"},{"content":"Hi. I\u0026rsquo;m Mushahid Hussain. I have a passion for writing and learning about operating systems, hypervisors, and virtualization. I have created this blog to write about bare-metal hypervisors, specific to ARMv8-A architecture. You can learn more about my work on Github or reach out to me on Linkedin.\n","permalink":"http://arm64hypervisor.com/about/","summary":"archives","title":"About"}]