summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/ldr_ro
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2016-09-19 03:01:46 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2016-09-19 06:14:25 +0200
commit396a8d91a4423d9c793eeff0798d544613647511 (patch)
treee0203961233db1ffcbbca2e15154d71d142c5822 /src/core/hle/service/ldr_ro
parentTweak formatting settings (diff)
downloadyuzu-396a8d91a4423d9c793eeff0798d544613647511.tar
yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.gz
yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.bz2
yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.lz
yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.xz
yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.zst
yuzu-396a8d91a4423d9c793eeff0798d544613647511.zip
Diffstat (limited to 'src/core/hle/service/ldr_ro')
-rw-r--r--src/core/hle/service/ldr_ro/cro_helper.cpp47
-rw-r--r--src/core/hle/service/ldr_ro/cro_helper.h9
-rw-r--r--src/core/hle/service/ldr_ro/ldr_ro.cpp14
3 files changed, 38 insertions, 32 deletions
diff --git a/src/core/hle/service/ldr_ro/cro_helper.cpp b/src/core/hle/service/ldr_ro/cro_helper.cpp
index 5757a4e64..b5da9a960 100644
--- a/src/core/hle/service/ldr_ro/cro_helper.cpp
+++ b/src/core/hle/service/ldr_ro/cro_helper.cpp
@@ -22,21 +22,23 @@ static ResultCode CROFormatError(u32 description) {
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
-const std::array<int, 17> CROHelper::ENTRY_SIZE{
- {1, // code
- 1, // data
- 1, // module name
- sizeof(SegmentEntry), sizeof(ExportNamedSymbolEntry), sizeof(ExportIndexedSymbolEntry),
- 1, // export strings
- sizeof(ExportTreeEntry), sizeof(ImportModuleEntry), sizeof(ExternalRelocationEntry),
- sizeof(ImportNamedSymbolEntry), sizeof(ImportIndexedSymbolEntry),
- sizeof(ImportAnonymousSymbolEntry),
- 1, // import strings
- sizeof(StaticAnonymousSymbolEntry), sizeof(InternalRelocationEntry),
- sizeof(StaticRelocationEntry)}};
-
-const std::array<CROHelper::HeaderField, 4> CROHelper::FIX_BARRIERS{
- {Fix0Barrier, Fix1Barrier, Fix2Barrier, Fix3Barrier}};
+const std::array<int, 17> CROHelper::ENTRY_SIZE{{
+ 1, // code
+ 1, // data
+ 1, // module name
+ sizeof(SegmentEntry), sizeof(ExportNamedSymbolEntry), sizeof(ExportIndexedSymbolEntry),
+ 1, // export strings
+ sizeof(ExportTreeEntry), sizeof(ImportModuleEntry), sizeof(ExternalRelocationEntry),
+ sizeof(ImportNamedSymbolEntry), sizeof(ImportIndexedSymbolEntry),
+ sizeof(ImportAnonymousSymbolEntry),
+ 1, // import strings
+ sizeof(StaticAnonymousSymbolEntry), sizeof(InternalRelocationEntry),
+ sizeof(StaticRelocationEntry),
+}};
+
+const std::array<CROHelper::HeaderField, 4> CROHelper::FIX_BARRIERS{{
+ Fix0Barrier, Fix1Barrier, Fix2Barrier, Fix3Barrier,
+}};
VAddr CROHelper::SegmentTagToAddress(SegmentTag segment_tag) const {
u32 segment_num = GetField(SegmentNum);
@@ -204,13 +206,14 @@ ResultCode CROHelper::RebaseHeader(u32 cro_size) {
return error;
// verifies that all offsets are in the correct order
- constexpr std::array<HeaderField, 18> OFFSET_ORDER = {
- {CodeOffset, ModuleNameOffset, SegmentTableOffset, ExportNamedSymbolTableOffset,
- ExportTreeTableOffset, ExportIndexedSymbolTableOffset, ExportStringsOffset,
- ImportModuleTableOffset, ExternalRelocationTableOffset, ImportNamedSymbolTableOffset,
- ImportIndexedSymbolTableOffset, ImportAnonymousSymbolTableOffset, ImportStringsOffset,
- StaticAnonymousSymbolTableOffset, InternalRelocationTableOffset,
- StaticRelocationTableOffset, DataOffset, FileSize}};
+ constexpr std::array<HeaderField, 18> OFFSET_ORDER = {{
+ CodeOffset, ModuleNameOffset, SegmentTableOffset, ExportNamedSymbolTableOffset,
+ ExportTreeTableOffset, ExportIndexedSymbolTableOffset, ExportStringsOffset,
+ ImportModuleTableOffset, ExternalRelocationTableOffset, ImportNamedSymbolTableOffset,
+ ImportIndexedSymbolTableOffset, ImportAnonymousSymbolTableOffset, ImportStringsOffset,
+ StaticAnonymousSymbolTableOffset, InternalRelocationTableOffset,
+ StaticRelocationTableOffset, DataOffset, FileSize,
+ }};
u32 prev_offset = GetField(OFFSET_ORDER[0]);
u32 cur_offset;
diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h
index e4457d4be..e1b8221bd 100644
--- a/src/core/hle/service/ldr_ro/cro_helper.h
+++ b/src/core/hle/service/ldr_ro/cro_helper.h
@@ -40,8 +40,7 @@ static constexpr u32 CRO_HASH_SIZE = 0x80;
/// Represents a loaded module (CRO) with interfaces manipulating it.
class CROHelper final {
public:
- explicit CROHelper(VAddr cro_address) : module_address(cro_address) {
- }
+ explicit CROHelper(VAddr cro_address) : module_address(cro_address) {}
std::string ModuleName() const {
return Memory::ReadCString(GetField(ModuleNameOffset), GetField(ModuleNameSize));
@@ -152,8 +151,7 @@ private:
/**
* Each item in this enum represents a u32 field in the header begin from address+0x80,
- * successively.
- * We don't directly use a struct here, to avoid GetPointer, reinterpret_cast, or
+ * successively. We don't directly use a struct here, to avoid GetPointer, reinterpret_cast, or
* Read/WriteBlock repeatedly.
*/
enum HeaderField {
@@ -234,8 +232,7 @@ private:
BitField<4, 28, u32_le> offset_into_segment;
SegmentTag() = default;
- explicit SegmentTag(u32 raw_) : raw(raw_) {
- }
+ explicit SegmentTag(u32 raw_) : raw(raw_) {}
};
/// Information of a segment in this module.
diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp
index ae5d3921f..a8fc2c015 100644
--- a/src/core/hle/service/ldr_ro/ldr_ro.cpp
+++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp
@@ -750,11 +750,17 @@ static void Shutdown(Service::Interface* self) {
}
const Interface::FunctionInfo FunctionTable[] = {
- {0x000100C2, Initialize, "Initialize"}, {0x00020082, LoadCRR, "LoadCRR"},
- {0x00030042, UnloadCRR, "UnloadCRR"}, {0x000402C2, LoadCRO<false>, "LoadCRO"},
- {0x000500C2, UnloadCRO, "UnloadCRO"}, {0x00060042, LinkCRO, "LinkCRO"},
- {0x00070042, UnlinkCRO, "UnlinkCRO"}, {0x00080042, Shutdown, "Shutdown"},
+ // clang-format off
+ {0x000100C2, Initialize, "Initialize"},
+ {0x00020082, LoadCRR, "LoadCRR"},
+ {0x00030042, UnloadCRR, "UnloadCRR"},
+ {0x000402C2, LoadCRO<false>, "LoadCRO"},
+ {0x000500C2, UnloadCRO, "UnloadCRO"},
+ {0x00060042, LinkCRO, "LinkCRO"},
+ {0x00070042, UnlinkCRO, "UnlinkCRO"},
+ {0x00080042, Shutdown, "Shutdown"},
{0x000902C2, LoadCRO<true>, "LoadCRO_New"},
+ // clang-format on
};
////////////////////////////////////////////////////////////////////////////////////////////////////