mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-18 19:51:30 +12:00
Memory: Fix double reset for FCRAM manager
Fix minor bug with permission tracking
This commit is contained in:
parent
352799b1a7
commit
1161703ed6
3 changed files with 4 additions and 5 deletions
|
@ -7,6 +7,7 @@ void KFcram::Region::reset(u32 start, size_t size) {
|
|||
freePages = pages;
|
||||
|
||||
Block initialBlock(pages, 0);
|
||||
blocks.clear();
|
||||
blocks.push_back(initialBlock);
|
||||
}
|
||||
|
||||
|
|
|
@ -140,9 +140,6 @@ void Kernel::reset() {
|
|||
threadCount = 0;
|
||||
aliveThreadCount = 0;
|
||||
|
||||
// TODO: These values should be derived from the memory type in an app's exheader
|
||||
fcramManager.reset(Memory::FCRAM_SIZE, Memory::FCRAM_APPLICATION_SIZE, Memory::FCRAM_SYSTEM_SIZE, Memory::FCRAM_BASE_SIZE);
|
||||
|
||||
for (auto& t : threads) {
|
||||
t.status = ThreadStatus::Dead;
|
||||
t.waitList.clear();
|
||||
|
|
|
@ -306,6 +306,7 @@ void Memory::changeMemoryState(u32 vaddr, s32 pages, const Operation& op) {
|
|||
|
||||
// Now that the block has been found, fill it with the necessary info
|
||||
auto oldState = it->state;
|
||||
u32 oldPerms = it->perms;
|
||||
it->baseAddr = reqStart;
|
||||
it->pages = pages;
|
||||
if (op.changePerms) it->perms = (op.r ? PERMISSION_R : 0) | (op.w ? PERMISSION_W : 0) | (op.x ? PERMISSION_X : 0);
|
||||
|
@ -313,13 +314,13 @@ void Memory::changeMemoryState(u32 vaddr, s32 pages, const Operation& op) {
|
|||
|
||||
// If the requested memory region is smaller than the block found, the block must be split
|
||||
if (blockStart < reqStart) {
|
||||
MemoryInfo startBlock(blockStart, (reqStart - blockStart) >> 12, 0, oldState);
|
||||
MemoryInfo startBlock(blockStart, (reqStart - blockStart) >> 12, oldPerms, oldState);
|
||||
memoryInfo.insert(it, startBlock);
|
||||
}
|
||||
|
||||
if (reqEnd < blockEnd) {
|
||||
auto itAfter = std::next(it);
|
||||
MemoryInfo endBlock(reqEnd, (blockEnd - reqEnd) >> 12, 0, oldState);
|
||||
MemoryInfo endBlock(reqEnd, (blockEnd - reqEnd) >> 12, oldPerms, oldState);
|
||||
memoryInfo.insert(itAfter, endBlock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue