mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 04:21:38 +12:00
Memory: Rework FCRAM management entirely
Disables a lot of functionality... but I didn't want to commit too much to this commit Also reworks virtual memory management somewhat (but needs more work)
This commit is contained in:
parent
8e303d8d08
commit
f230384444
16 changed files with 411 additions and 251 deletions
47
include/kernel/fcram.hpp
Normal file
47
include/kernel/fcram.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include "kernel_types.hpp"
|
||||
|
||||
class Memory;
|
||||
|
||||
typedef std::list<FcramBlock> FcramBlockList;
|
||||
|
||||
class KFcram {
|
||||
struct Region {
|
||||
struct Block {
|
||||
s32 pages;
|
||||
s32 pageOffs;
|
||||
bool used;
|
||||
|
||||
Block(s32 pages, u32 pageOffs) : pages(pages), pageOffs(pageOffs), used(false) {}
|
||||
};
|
||||
|
||||
std::list<Block> blocks;
|
||||
u32 start;
|
||||
s32 pages;
|
||||
s32 freePages;
|
||||
public:
|
||||
Region() : start(0), pages(0) {}
|
||||
void reset(u32 start, size_t size);
|
||||
void alloc(std::list<FcramBlock>& out, s32 pages, bool linear);
|
||||
|
||||
u32 getUsedCount();
|
||||
u32 getFreeCount();
|
||||
};
|
||||
|
||||
Memory& mem;
|
||||
|
||||
Region appRegion, sysRegion, baseRegion;
|
||||
uint8_t* fcram;
|
||||
std::unique_ptr<u32> refs;
|
||||
public:
|
||||
KFcram(Memory& memory);
|
||||
void reset(size_t ramSize, size_t appSize, size_t sysSize, size_t baseSize);
|
||||
void alloc(FcramBlockList& out, s32 pages, FcramRegion region, bool linear);
|
||||
|
||||
void incRef(FcramBlockList& list);
|
||||
void decRef(FcramBlockList& list);
|
||||
|
||||
u32 getUsedCount(FcramRegion region);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue