PCSX2 Documentation/MMU mini-series: Difference between revisions
Jump to navigation
Jump to search
no edit summary
(Created page with "''Originally written by Gregory'' Hello PCSX2 followers, It's been a while since the last developer blog entry. I would like to resume this old tradition. I will present yo...") |
No edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 15: | Line 15: | ||
Let's begin with the root, the Operating System (OS). Hardware can run without any OS but it is often a necessary evil. The OS has 2 major goals: | Let's begin with the root, the Operating System (OS). Hardware can run without any OS but it is often a necessary evil. The OS has 2 major goals: | ||
1 | 1. The first goal of the OS is to control privilege access of processes. | ||
Maybe you want to keep a resource for the hardware or OS internal, for example a hardware watchdog. Maybe you only want to check the validity of a command. It could be as simple as only allowing a stop command after a start command. | Maybe you want to keep a resource for the hardware or OS internal, for example a hardware watchdog. Maybe you only want to check the validity of a command. It could be as simple as only allowing a stop command after a start command. | ||
Let's see a basic example: starting some hardware counters | Let's see a basic example: starting some hardware counters | ||
[[File:Blog_Entry_23_November_2014.png]] | |||
As you can see, without any OS you could easily kill your system. The OS allows the separation of privileged and standard resources. | As you can see, without any OS you could easily kill your system. The OS allows the separation of privileged and standard resources. | ||
2 | 2. The second goal is to share the resources between processes | ||
You need to understand that processes are independent for coding simplicity and security. | You need to understand that processes are independent for coding simplicity and security. | ||
Let's reuse our hardware counter example | Let's reuse our hardware counter example | ||
[[File:mmu-schematic2.png]] | |||
mmu- | |||
This time we want to start the same counter from two different threads. Unfortunately process 1 will be corrupted by process 2. It's pretty bad, process 1 will likely crash. Again the OS is the solution. It replaces the corruption with an error that can be handled by the process. | This time we want to start the same counter from two different threads. Unfortunately process 1 will be corrupted by process 2. It's pretty bad, process 1 will likely crash. Again the OS is the solution. It replaces the corruption with an error that can be handled by the process. | ||
Line 43: | Line 41: | ||
Let's redo the previous example with a virtualization layer in the OS. | Let's redo the previous example with a virtualization layer in the OS. | ||
mmu- | [[File:mmu-schematic3.png]] | ||
As a side note, virtualization is a common solution for resource management. On the internet you have a logical IP address instead of using the Mac address directly. HDD access can be virtualized too with a tool like LVM http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29 . Sometimes the whole machine is virtual, see VirtualBox or even PCSX2. | As a side note, virtualization is a common solution for resource management. On the internet you have a logical IP address instead of using the Mac address directly. HDD access can be virtualized too with a tool like LVM http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29 . Sometimes the whole machine is virtual, see VirtualBox or even PCSX2. | ||
Line 57: | Line 56: | ||
See below a typical use model of the MMU: | See below a typical use model of the MMU: | ||
mmu- | [[File:mmu-schematic4.png]] | ||
Line 66: | Line 65: | ||
* The first 512KB of RAM is not virtually mapped because it is at the location of the OS, do you know how the kernel will access this location? | * The first 512KB of RAM is not virtually mapped because it is at the location of the OS, do you know how the kernel will access this location? | ||
* A hardware component needs to access the memory without the CPUs intervention. Do you know which one? Do you know how the addresses are handled? | * A hardware component needs to access the memory without the CPUs intervention. Do you know which one? Do you know how the addresses are handled? | ||
{{PCSX2 Documentation Navbox}} |