Memory Management: Difference between revisions
PROOFREAD AND FACT CHECK PLZ. The previous comment wasn't helpful at all, being horribly confusing and possibly outright wrong. |
|||
Line 170: | Line 170: | ||
ControlProcessMemory maps memory in the specified process, this is the only SVC which allows mapping executable memory. Format of the permissions field for memory mapping SVCs: bit0=R, bit1=W, bit2=X. Type6 sets the Addr0 memory permissions to the input permissions, for already mapped memory. Type is the MemoryOperation enum, without the memory-type/memory-region. ControlProcessMemory only supports type4, type5, and type6. ControlProcessMemory does not support using the current KProcess handle alias. | ControlProcessMemory maps memory in the specified process, this is the only SVC which allows mapping executable memory. Format of the permissions field for memory mapping SVCs: bit0=R, bit1=W, bit2=X. Type6 sets the Addr0 memory permissions to the input permissions, for already mapped memory. Type is the MemoryOperation enum, without the memory-type/memory-region. ControlProcessMemory only supports type4, type5, and type6. ControlProcessMemory does not support using the current KProcess handle alias. | ||
MapProcessMemory maps | MapProcessMemory maps memory from a given process into the current process using a virtual memory address range that is offset by 0x07f00000 from the original address range. In other words, the memory range [StartAddr,EndAddr] is mapped to [StartAddr+0x07f00000,EndAddr+0x07f00000]. This is used by [[RO Services]] to map memory from 0x00100000 to 0x08000000. Memory mapped by MapProcessMemory is unmapped by UnmapProcessMemory. | ||
Note that with the MAP MemoryOperation, the kernel will refuse to MAP memory for the specified addr1, when addr1 was already used with another MAP operation as addr1. The kernel also doesn't allow memory to be freed via the FREE MemoryOperation, when other virtual-memory is mapped to this same memory(when the MAP MemoryOperation was used with this memory with addr1). | Note that with the MAP MemoryOperation, the kernel will refuse to MAP memory for the specified addr1, when addr1 was already used with another MAP operation as addr1. The kernel also doesn't allow memory to be freed via the FREE MemoryOperation, when other virtual-memory is mapped to this same memory(when the MAP MemoryOperation was used with this memory with addr1). |