user009122 user009122 - 7 days ago 6
Linux Question

Can we write into physical address linux

In linux,Is there a way to write data directly into a physical address(say 0x777777)?
Can we create a virtual address for a specific physical address( 0x777777)

Edit:
PS: I am not going to try doing this. This is just to clarify my understanding

Answer

It will cause a SIGSEGV. To accomplish that, you have to use a system specific function to map the region of memory that contains this exact address before trying to access it.

Anyways, you better know what you are doing this, but you can use

*(int*)0x7777777 = 2345

Mapping to physical location is already taken care by OS.

Comments