Kernel: reimplement memory management on physical FCRAM (#4392)
* Kernel: reimplement memory management on physical FCRAM * Kernel/Process: Unmap does not care the source memory permission What game usually does is after mapping the memory, they reprotect the source memory as no permission to avoid modification there * Kernel/SharedMemory: zero initialize new-allocated memory * Process/Thread: zero new TLS entry * Kernel: fix a bug where code segments memory usage are accumulated twice It is added to both misc and heap (done inside HeapAlloc), which results a doubled number reported by svcGetProcessInfo. While we are on it, we just merge the three number misc, heap and linear heap usage together, as there is no where they are distinguished. Question: is TLS page also added to this number? * Kernel/SharedMemory: add more object info on mapping error * Process: lower log level; SharedMemory: store phys offset * VMManager: add helper function to retrieve backing block list for a range
This commit is contained in:
parent
f852f9f219
commit
2067946f59
19 changed files with 389 additions and 208 deletions
|
@ -114,16 +114,12 @@ static ResultCode ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 add
|
|||
}
|
||||
|
||||
case MEMOP_MAP: {
|
||||
// TODO: This is just a hack to avoid regressions until memory aliasing is implemented
|
||||
CASCADE_RESULT(*out_addr, process.HeapAllocate(addr0, size, vma_permissions));
|
||||
CASCADE_CODE(process.Map(addr0, addr1, size, vma_permissions));
|
||||
break;
|
||||
}
|
||||
|
||||
case MEMOP_UNMAP: {
|
||||
// TODO: This is just a hack to avoid regressions until memory aliasing is implemented
|
||||
ResultCode result = process.HeapFree(addr0, size);
|
||||
if (result.IsError())
|
||||
return result;
|
||||
CASCADE_CODE(process.Unmap(addr0, addr1, size, vma_permissions));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1285,7 @@ static ResultCode GetProcessInfo(s64* out, Handle process_handle, u32 type) {
|
|||
case 2:
|
||||
// TODO(yuriks): Type 0 returns a slightly higher number than type 2, but I'm not sure
|
||||
// what's the difference between them.
|
||||
*out = process->heap_used + process->linear_heap_used + process->misc_memory_used;
|
||||
*out = process->memory_used;
|
||||
if (*out % Memory::PAGE_SIZE != 0) {
|
||||
LOG_ERROR(Kernel_SVC, "called, memory size not page-aligned");
|
||||
return ERR_MISALIGNED_SIZE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue