mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 16:20:14 +00:00
LDR: CROHelper misc fucntion
This commit is contained in:
parent
c94d071534
commit
f7a12daa4c
@ -1679,6 +1679,17 @@ public:
|
||||
UnrebaseHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies module hash by CRR.
|
||||
* @param cro_size the size of the CRO
|
||||
* @param crr the virtual address of the CRR
|
||||
* @returns ResultCode RESULT_SUCCESS on success, otherwise error code.
|
||||
*/
|
||||
ResultCode VerifyHash(u32 cro_size, VAddr crr) const {
|
||||
// TODO(wwylele): actually verify the hash
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links this module with all registered auto-link module.
|
||||
* @param crs_address the virtual address of the static module
|
||||
@ -1971,6 +1982,33 @@ public:
|
||||
return GetField(FixedSize);
|
||||
}
|
||||
|
||||
bool IsLoaded() const {
|
||||
u32 magic = GetField(Magic);
|
||||
if (magic != MAGIC_CRO0 && magic != MAGIC_FIXD)
|
||||
return false;
|
||||
|
||||
// TODO(wwylele): verify memory state here after memory aliasing is implemented
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the page address and size of the code segment.
|
||||
* @returns a tuple of (address, size); (0, 0) if the code segment doesn't exist.
|
||||
*/
|
||||
std::tuple<VAddr, u32> GetExecutablePages() const {
|
||||
u32 segment_num = GetField(SegmentNum);
|
||||
for (u32 i = 0; i < segment_num; ++i) {
|
||||
SegmentEntry entry;
|
||||
GetEntry(i, entry);
|
||||
if (entry.type == SegmentType::Code && entry.size != 0) {
|
||||
VAddr begin = Common::AlignDown(entry.offset, Memory::PAGE_SIZE);
|
||||
VAddr end = Common::AlignUp(entry.offset + entry.size, Memory::PAGE_SIZE);
|
||||
return std::make_tuple(begin, end - begin);
|
||||
}
|
||||
}
|
||||
return std::make_tuple(0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
std::array<int, 17> CROHelper::ENTRY_SIZE {{
|
||||
|
Loading…
Reference in New Issue
Block a user