Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confused over memory mapping

I've recently started getting into low level stuff and looking into bootloaders and operating systems etc...

As I understand it, for ARM processors at least, peripherals are initialized by the bootloader and then they are mapped into the physical memory space. From here, code can access the peripherals by simply writing values to the memory space mapped to the peripherals registers. Later if the chip has a MMU, it can be used to further remap into virtual memory spaces. Am I right?

What I don't understand are (assuming what I have said above is correct):

  • How does the bootloader initialize the peripherals if they haven't been mapped to an address space yet?
  • With virtual memory mapping, there are tables that tell the MMU where to map what. But what determines where peripherals are mapped in physical memory?
like image 214
tangrs Avatar asked Jul 11 '11 10:07

tangrs


People also ask

What is the concept of memory mapping?

What Is Memory-Mapping? Memory-mapping is a mechanism that maps a portion of a file, or an entire file, on disk to a range of addresses within an application's address space. The application can then access files on disk in the same way it accesses dynamic memory.

Which are the methods of memory mapping?

There are three different types of mapping used for the purpose of cache memory which are as follows: Direct mapping, Associative mapping, and Set-Associative mapping.

What is the need of mapping in memory?

Memory mapped files provide a mechanism for a process to access files by directly incorporating file data into the process address space.

What is memory mapping and protection?

In Memory protection, we have to protect the operating system from user processes and which can be done by using a relocation register with a limit register. Here, the relocation register has the value of the smallest physical address whereas the limit register has the range of the logical addresses.


1 Answers

When a device boots, the MMU is turned off and you will be typically running in supervisor mode. This means that any addresses provide are physical addresses.

Each ARM SOC (system on Chip) will have a memory map. The correspondece of addresses to devices is determined by which physical data and address line are connect to which parts of the processor. All this information can be found in a Technical reference manual. For OMAP4 chips this can be found here.

There are several ways to connect off-chip device. One is using the GPMC. Here you will need to sepcify the address in the GPMC that you want to use on the chip.

When the MMU is then turned on, these addresses may change depending on how the MMU is programmed. Typically direct access to hardware will also only be available in kernel mode.

like image 188
doron Avatar answered Sep 21 '22 02:09

doron