summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nso.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-02-19hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable.bunnei1-1/+1
2021-01-29hle: kernel: KThread: Reorganize thread priority defaults.bunnei1-2/+2
2021-01-29core: hle: kernel: Rename Thread to KThread.bunnei1-1/+1
2020-11-27core: Eliminate remaining usages of the global system instanceLioncash1-4/+1
Removes all remaining usages of the global system instance. After this, migration can begin to migrate to being constructed and managed entirely by the various frontends.
2020-11-18patch_manager: Remove usages of the global system instanceLioncash1-1/+1
With this, only 19 usages of the global system instance remain within the core library. We're almost there.
2020-10-13core/CMakeLists: Make some warnings errorsLioncash1-1/+1
Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
2020-09-22General: Make use of std::nullopt where applicableLioncash1-3/+3
Allows some implementations to avoid completely zeroing out the internal buffer of the optional, and instead only set the validity byte within the structure. This also makes it consistent how we return empty optionals.
2020-09-17loader/nso: Remove unnecessary [[maybe_unused]]Lioncash1-2/+1
2020-09-16core/loader: Remove dependencies on the global system instanceLioncash1-4/+4
Now all that remains is: 18 instances in file_sys code 14 instances in GDB stub code (this can be tossed wholesale) 4 instances in HLE code 2 instances in settings code.
2020-04-18loader/nso: Resolve moves not occurring in DecompressSegmentLioncash1-1/+1
Given the std::vector was const, an automatic move out of the function could not occur. We can allow automatic return value optimizations to occur by making the buffer non-const.
2020-04-17loader: nso: Fix loader size and arguments.bunnei1-10/+12
2020-04-17core: memory: Move to Core::Memory namespace.bunnei1-2/+2
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17loader: nso: Fix loading of static objects to be properly sized and aligned.bunnei1-19/+9
2020-01-23loader: provide default arguments (zero byte) to NSOsMichael Scire1-3/+8
Certain newer unity games (Terraria, Pokemon Mystery Dungeon) require that the argument region be populated. Failure to do so results in an integer underflow in argument count, and eventually an unmapped read at 0x800000000. Providing this default fixes this. Note that the behavior of official software is as yet unverified, arguments-wise.
2020-01-18core/loaders: Simplify PhysicalMemory usage.Markus Wick1-5/+7
It is currently a std::vector, however we might want to replace it with a more fancy allocator. So we can't use the C++ iterators any more.
2019-09-30core/loader: Track the NSO build ID of the current processZach Hilman1-0/+1
2019-09-22nso: Pass build ID directlyZach Hilman1-2/+1
As opposed to converting to string and then back to hex array
2019-07-19VM_Manager: Align allocated memory to 256bytesFernando Sahmkow1-1/+1
This commit ensures that all backing memory allocated for the Guest CPU is aligned to 256 bytes. This due to how gpu memory works and the heavy constraints it has in the alignment of physical memory.
2019-06-12common/hex_util: Combine HexVectorToString() and HexArrayToString()Lioncash1-2/+2
These can be generified together by using a concept type to designate them. This also has the benefit of not making copies of potentially very large arrays.
2019-05-26loader: Move NSO module tracking to AppLoaderZach Hilman1-3/+9
Also cleanup of general stuff
2019-05-25loader/nso: Silence sign-comparison warningLioncash1-1/+1
This was previously performing a size_t == int comparison. Silences a -Wsign-compare warning.
2019-05-25core: Track load offsets of NSO modulesZach Hilman1-0/+3
Needed for backtrace decomposition
2019-05-01loader/nso: Remove left-in debug pragmaLioncash1-2/+0
Unintentionally introduced in 552d5071fa171165e4054392d8bb6bf2ecc924e2
2019-04-12core/core: Move process execution start to System's Load()Lioncash1-6/+5
This gives us significantly more control over where in the initialization process we start execution of the main process. Previously we were running the main process before the CPU or GPU threads were initialized (not good). This amends execution to start after all of our threads are properly set up.
2019-03-29Addressed feedbackunknown1-1/+0
2019-03-29core: Do not link LZ4 to core. Use common/data_compression for nso segment decompression instead.unknown1-0/+1
2019-03-29Addressed feedbackunknown1-4/+4
2019-03-29core: Do not link LZ4 to core. Use common/data_compression for nso segment decompression instead.unknown1-10/+7
2019-03-28patch_manager: Dump NSO name with build IDZach Hilman1-2/+4
2019-03-22kernel/codeset: Make CodeSet's memory data member a regular std::vectorLioncash1-1/+1
The use of a shared_ptr is an implementation detail of the VMManager itself when mapping memory. Because of that, we shouldn't require all users of the CodeSet to have to allocate the shared_ptr ahead of time. It's intended that CodeSet simply pass in the required direct data, and that the memory manager takes care of it from that point on. This means we just do the shared pointer allocation in a single place, when loading modules, as opposed to in each loader.
2019-03-22loader/nso: Place translation unit specific functions into an anonymous namespaceLioncash1-20/+21
Makes it impossible to indirectly violate the ODR in some other translation unit due to these existing.
2019-03-22file_sys/cheat_engine: Remove use of global system accessorsLioncash1-4/+4
Instead, pass in the core timing instance and make the dependency explicit in the interface.
2019-03-22loader/nso: Clean up use of magic constantsLioncash1-4/+6
Now that the NSO header has the proper size, we can just use sizeof on it instead of having magic constants.
2019-03-22file_sys/patch_manager: Deduplicate NSO headerLioncash1-50/+18
This source file was utilizing its own version of the NSO header. Instead of keeping this around, we can have the patch manager also use the version of the header that we have defined in loader/nso.h
2019-03-22loader/nso: Fix definition of the NSO header structLioncash1-3/+15
The total struct itself is 0x100 (256) bytes in size, so we should be providing that amount of data. Without the data, this can result in omitted data from the final loaded NSO file.
2019-03-20kernel: Move CodeSet structure to its own source filesLioncash1-0/+1
Given this is utilized by the loaders, this allows avoiding inclusion of the kernel process definitions where avoidable. This also keeps the loading format for all executable data separate from the kernel objects.
2019-03-05vm_manager: Remove cheat-specific ranges from VMManagerZach Hilman1-7/+3
2019-03-05loader/nso: Set main code region in VMManagerZach Hilman1-1/+17
For rom directories (and by extension, XCI/NSP/NAX/NCA) this is for the NSO with name 'main', for regular NSOs, this is the NSO.
2018-12-03loader/nso: Remove dependency on the System classLioncash1-4/+4
Similar to the NRO changes, we can also pass the process explicitly as a parameter from Load instead of indirecting through the System class.
2018-10-29patch_manager: Add support for dumping decompressed NSOsZach Hilman1-1/+1
When enabled in settings, PatchNSO will dump the unmodified NSO that it was passed to a file named <build id>.nso in the dump root for the current title ID.
2018-10-15nso: Return an optional address from LoadModuleLioncash1-5/+7
If a malformed NSO is attempted to be loaded, we shouldn't continue onwards. We should be reporting an error and bailing out.
2018-10-15nso: Make LoadModule take a VfsFile by const referenceLioncash1-9/+6
2018-10-12kernel/process: Make CodeSet a regular non-inherited objectLioncash1-12/+9
These only exist to ferry data into a Process instance and end up going out of scope quite early. Because of this, we can just make it a plain struct for holding things and just std::move it into the relevant function. There's no need to make this inherit from the kernel's Object type.
2018-10-07nso/nro: Use default allocation size for arg_dataZach Hilman1-6/+8
2018-10-07cmd: Support passing game arguments from command lineZach Hilman1-1/+1
Uses -p (--program) and following string as args.
2018-10-07nso/nro: Add NSO arguments structure to data sectionZach Hilman1-1/+14
Only added if arguments string is non-empty and a pass is requested by loader.
2018-10-02nso: Optimize loading of IPS patchesZach Hilman1-2/+2
Avoid resource-heavy classes and remove quasi-duplicated code.
2018-10-01nso: Add framework to support patching of uncompressed NSOsZach Hilman1-1/+14
2018-10-01nso: Replace NSOHeader padding bytes with build IDZach Hilman1-2/+1
2018-09-30kernel/process: Make data member variables privateLioncash1-1/+1
Makes the public interface consistent in terms of how accesses are done on a process object. It also makes it slightly nicer to reason about the logic of the process class, as we don't want to expose everything to external code.
2018-09-29loader: Make the Load() function take a process as a regular reference, not a SharedPtrLioncash1-3/+3
A process should never require being reference counted in this situation. If the handle to a process is freed before this function is called, it's definitely a bug with our lifetime management, so we can put the requirement in place for the API that the process must be a valid instance.
2018-09-25memory: Dehardcode the use of fixed memory range constantsLioncash1-4/+5
The locations of these can actually vary depending on the address space layout, so we shouldn't be using these when determining where to map memory or be using them as offsets for calculations. This keeps all the memory ranges flexible and malleable based off of the virtual memory manager instance state.
2018-09-24process/vm_manager: Amend API to allow reading parameters from NPDM metadataLioncash1-5/+0
Rather than hard-code the address range to be 36-bit, we can derive the parameters from supplied NPDM metadata if the supplied exectuable supports it. This is the bare minimum necessary for this to be possible. The following commits will rework the memory code further to adjust to this.
2018-09-21Added support for uncompressed NSOs (#1374)David1-3/+12
* Added support for uncompressed NSOs * Moved compressed section check to NsoHeader
2018-09-13kernel/thread: Include thread-related enums within the kernel namespaceLioncash1-1/+2
Previously, these were sitting outside of the Kernel namespace, which doesn't really make sense, given they're related to the Thread class which is within the Kernel namespace.
2018-08-31core/core: Replace includes with forward declarations where applicableLioncash1-0/+1
The follow-up to e2457418dae19b889b2ad85255bb95d4cd0e4bff, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
2018-08-29kernel: Eliminate kernel global stateLioncash1-2/+4
As means to pave the way for getting rid of global state within core, This eliminates kernel global state by removing all globals. Instead this introduces a KernelCore class which acts as a kernel instance. This instance lives in the System class, which keeps its lifetime contained to the lifetime of the System class. This also forces the kernel types to actually interact with the main kernel instance itself instead of having transient kernel state placed all over several translation units, keeping everything together. It also has a nice consequence of making dependencies much more explicit. This also makes our initialization a tad bit more correct. Previously we were creating a kernel process before the actual kernel was initialized, which doesn't really make much sense. The KernelCore class itself follows the PImpl idiom, which allows keeping all the implementation details sealed away from everything else, which forces the use of the exposed API and allows us to avoid any unnecessary inclusions within the main kernel header.
2018-08-15loader: Remove address mapping remnants from citraLioncash1-1/+0
These mappings are leftovers from citra and don't apply to the Switch.
2018-08-03kernel/process: Use accessors instead of class members for referencing segment arrayLioncash1-1/+1
Using member variables for referencing the segments array increases the size of the class in memory for little benefit. The same behavior can be achieved through the use of accessors that just return the relevant segment.
2018-07-20nso: Silence implicit sign conversion warningsLioncash1-4/+6
2018-07-20nso: Remove unused function ReadSegment()Lioncash1-13/+0
2018-07-19loader/nso: Check if read succeeded in IdentifyFile() before checking magic valueLioncash1-4/+6
We should always assume the filesystem is volatile and check each IO operation. While we're at it reorganize checks so that early-out errors are near one another.
2018-07-19loader/nso: Remove unnecessary vector resizesLioncash1-4/+2
We can just initialize these vectors directly via their constructor.
2018-07-19loader/nso: Resolve sign mismatch warningsLioncash1-1/+1
2018-07-19Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman1-76/+17
* Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
2018-07-17General Filesystem and Save Data Fixes (#670)Zach Hilman1-1/+1
2018-07-13More improvements to GDBStub (#653)Hedges1-0/+4
* More improvements to GDBStub - Debugging of threads should work correctly with source and assembly level stepping and modifying registers and memory, meaning threads and callstacks are fully clickable in VS. - List of modules is available to the client, with assumption that .nro and .nso are backed up by an .elf with symbols, while deconstructed ROMs keep N names. - Initial support for floating point registers. * Tidy up as requested in PR feedback * Tidy up as requested in PR feedback
2018-07-08Revert "Virtual Filesystem (#597)"bunnei1-16/+75
This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
2018-07-06Virtual Filesystem (#597)Zach Hilman1-75/+16
* Add VfsFile and VfsDirectory classes * Finish abstract Vfs classes * Implement RealVfsFile (computer fs backend) * Finish RealVfsFile and RealVfsDirectory * Finished OffsetVfsFile * More changes * Fix import paths * Major refactor * Remove double const * Use experimental/filesystem or filesystem depending on compiler * Port partition_filesystem * More changes * More Overhaul * FSP_SRV fixes * Fixes and testing * Try to get filesystem to compile * Filesystem on linux * Remove std::filesystem and document/test * Compile fixes * Missing include * Bug fixes * Fixes * Rename v_file and v_dir * clang-format fix * Rename NGLOG_* to LOG_* * Most review changes * Fix TODO * Guess 'main' to be Directory by filename
2018-07-03Rename logging macro back to LOG_*James Rowe1-2/+2
2018-06-21Add support for decrypted NCA files (#567)Zach Hilman1-11/+68
* Start to add NCA support in loader * More nca stuff * More changes to nca.cpp * Now identifies decrypted NCA cont. * Game list fixes and more structs and stuff * More updates to Nca class * Now reads ExeFs (i think) * ACTUALLY LOADS EXEFS! * RomFS loads and games execute * Cleanup and Finalize * plumbing, cleanup and testing * fix some things that i didnt think of before * Preliminary Review Changes * Review changes for bunnei and subv
2018-05-02general: Make formatting of logged hex values more straightforwardLioncash1-1/+1
This makes the formatting expectations more obvious (e.g. any zero padding specified is padding that's entirely dedicated to the value being printed, not any pretty-printing that also gets tacked on).
2018-04-27general: Convert assertion macros over to be fmt-compatibleLioncash1-1/+1
2018-04-25loader: Move old logging macros over to new fmt-capable onesLioncash1-3/+2
2018-04-21Kernel: Use 0x2C as default main thread priority for homebrew and lone NRO/NSOsSubv1-1/+1
2018-03-31memory: Fix stack region.bunnei1-1/+1
2018-03-16kernel: Move stack region outside of application heap.bunnei1-1/+1
2018-03-14core: Move process creation out of global state.bunnei1-3/+2
2018-03-02Kernel: Store the program id in the Process class instead of the CodeSet class.Subv1-4/+4
There may be many CodeSets per Process, so it's wasteful and overcomplicated to store the program id in each of them.
2018-02-25loader: Check error on NPDM load, use TID for CodeSetshinyquagsire231-3/+3
2018-02-14nso: Silence formatting specifier warningsLioncash1-2/+4
2018-01-20loader: Clean up ctors and includes.bunnei1-0/+4
2018-01-20loader: Refactor to also pass filepath into IdentifyType.bunnei1-2/+1
2018-01-20nso: Remove code specific to directory loading.bunnei1-16/+4
2018-01-17Remove relocation on NSO/NROgdkchan1-9/+1
2018-01-16clang-formatMerryMage1-1/+2
2018-01-16nso: Modify .bss size calculation logicRozlette1-3/+7
2018-01-15nso: Load subsdk4 if available.bunnei1-1/+1
2018-01-13yuzu: Update license text to be consistent across project.bunnei1-1/+1
2018-01-07nso: Always load the filepath specified by the user.bunnei1-1/+3
2017-10-23nso: Load more common submodules.bunnei1-15/+11
2017-10-23memory: Support 32-bit paging, move heap address space up.bunnei1-1/+1
2017-10-15core: Refactor MakeMagic usage and remove dead code.bunnei1-3/+4
2017-10-14nso: Add a log for loading submodules.bunnei1-0/+1
2017-10-10loader: Various improvements for NSO/NRO loaders.bunnei1-26/+24
2017-10-06loader: Add support for NRO, as well as various fixes and shared linker.bunnei1-128/+15
2017-10-04nso: Fixes to support homebrew NSOs without a MOD header.bunnei1-16/+22
2017-09-30nso: Refactor and allocate .bss section.bunnei1-112/+111
2017-09-30loader: Add support for loading an NSO.bunnei1-0/+295