aboutsummaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2018-09-18Merge pull request #1343 from lioncash/mutexbunnei
kernel/svc: Handle invalid address cases within svcArbitrateLock() and svcArbitrateUnlock()
2018-09-18Merge pull request #1344 from lioncash/armbunnei
arm_interface: Remove ARM11-isms from the CPU interface
2018-09-18arm_dynarmic: Correct ExclusiveWrite128()'s operationLioncash
Previously the second half of the value being written would overwrite the first half. Thankfully this wasn't a bug that was being encountered, as the function is currently unused.
2018-09-18arm_interface: Remove ARM11-isms from the CPU interfaceLioncash
This modifies the CPU interface to more accurately match an AArch64-supporting CPU as opposed to an ARM11 one. Two of the methods don't even make sense to keep around for this interface, as Adv Simd is used, rather than the VFP in the primary execution state. This is essentially a modernization change that should have occurred from the get-go.
2018-09-17kernel/mutex: Replace ResultCode construction for invalid addresses with the ↵Lioncash
named variant We already have a ResultCode constant for the case of an invalid address, so we can just use it instead of re-rolling that ResultCode type.
2018-09-17kernel/svc: Handle error cases for svcArbitrateLock() and svcArbitrateUnlock()Lioncash
The kernel does the equivalent of the following check before proceeding: if (address + 0x8000000000 < 0x7FFFE00000) { return ERR_INVALID_MEMORY_STATE; } which is essentially what our IsKernelVirtualAddress() function does. So we should also be checking for this. The kernel also checks if the given input addresses are 4-byte aligned, however our Mutex::TryAcquire() and Mutex::Release() functions already handle this, so we don't need to add code for this case.
2018-09-17Merge pull request #1312 from lioncash/fwdbunnei
service/vi: Replace includes with forward declarations where applicable
2018-09-17Merge pull request #1313 from lioncash/errorbunnei
kernel/errors: Amend error code for ERR_NOT_FOUND
2018-09-17Merge pull request #1318 from lioncash/errors-smbunnei
services/sm: Amend error code constants
2018-09-17Merge pull request #1315 from lioncash/sizebunnei
kernel/svc: Handle a few error cases within memory-related functions
2018-09-17Merge pull request #1328 from FearlessTobi/port-4192bunnei
Port #4192 from Citra: "svc: change unknown to thread in CreateThread"
2018-09-15Port # #4192 from Citra: "svc: change unknown to thread in CreateThread"Valentin Vanelslande
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi
2018-09-14services/sm: Amend error code constantsLioncash
Courtesy of @ogniK5377. This also moves them into the cpp file and limits the visibility to where they're directly used. It also gets rid of unused or duplicate error codes.
2018-09-13kernel/svc: Sanitize creation of shared memory via svcCreateSharedMemory()Lioncash
The kernel caps the size limit of shared memory to 8589930496 bytes (or (1GB - 512 bytes) * 8), so approximately 8GB, where every GB has a 512 byte sector taken off of it. It also ensures the shared memory is created with either read or read/write permissions for both permission types passed in, allowing the remote permissions to also be set as "don't care".
2018-09-13kernel/svc: Sanitize addresses, permissions, and sizes within ↵Lioncash
svcMapSharedMemory() and svcUnmapSharedMemory() Part of the checking done by the kernel is to check if the given address and size are 4KB aligned, as well as checking if the size isn't zero. It also only allows mapping shared memory as readable or read/write, but nothing else, and so we shouldn't allow mapping as anything else either.
2018-09-13kernel/svc: Sanitize addresses and sizes within svcMapMemory() and ↵Lioncash
svcUnmapMemory() The kernel checks if the addresses and given size is 4KB aligned before continuing onwards to map the memory.
2018-09-13kernel/svc: Sanitize heap sizes within svcSetHeapSize()Lioncash
The kernel checks if the given size is a multiple of 2MB and <= to 4GB before going ahead and attempting to allocate that much memory.
2018-09-13Merge pull request #1310 from lioncash/kernel-nsbunnei
kernel/thread: Include thread-related enums within the kernel namespace
2018-09-13Merge pull request #1309 from lioncash/nestedbunnei
service: Use nested namespace specifiers where applicable
2018-09-13Merge pull request #1307 from lioncash/plbunnei
services/pl_u: Add missing Korean font to the fallback case for shared fonts
2018-09-13kernel/errors: Amend error code for ERR_NOT_FOUNDLioncash
This is the value returned by the kernel for svcConnectToNamedPort() if the named port cannot be found.
2018-09-13service/vi: Replace includes with forward declarations where applicableLioncash
2018-09-13kernel/thread: Include thread-related enums within the kernel namespaceLioncash
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-09-13service: Use nested namespace specifiers where applicableLioncash
There were a few places where nested namespace specifiers weren't being used where they could be within the service code. This amends that to make the namespacing a tiny bit more compact.
2018-09-13ipc: minor fixValentin Vanelslande
2018-09-12services/pl_u: Add missing Korean font to the fallback case for shared fontsLioncash
Previously this wasn't using the Korean font at all.
2018-09-12Merge pull request #1163 from FearlessTobi/add-audio-stretchingbunnei
audio_core: Add audio stretching support
2018-09-12Merge pull request #1297 from lioncash/plbunnei
pl_u: Eliminate mutable file-scope state
2018-09-12Merge pull request #1303 from lioncash/errorbunnei
kernel/errors: Amend invalid thread priority and invalid processor ID error codes
2018-09-12svc: Return ERR_INVALID_PROCESSOR_ID in CreateThread() if an invalid ↵Lioncash
processor ID is given This is what the kernel does for an out-of-range processor ID.
2018-09-12kernel/errors: Correct error codes for invalid thread priority and invalid ↵Lioncash
processor ID
2018-09-12svc: Do nothing if svcOutputDebugString() is given a length of zeroLioncash
While unlikely, it does avoid constructing a std::string and unnecessarily calling into the memory code if a game or executable decides to be really silly about their logging.
2018-09-12svc: Correct parameter type for OutputDebugString()Lioncash
This should be a u64 to represent size.
2018-09-11Merge pull request #1296 from lioncash/prepobunnei
service/prepo: Move class into the cpp file
2018-09-11service/audio: Replace includes with forward declarations where applicableLioncash
A few headers were including other headers when a forward declaration can be used instead, allowing the include to be moved to the cpp file.
2018-09-11pl_u: Eliminate mutable file-scope stateLioncash
Converts the PL_U internals to use the PImpl idiom and makes the state part of the Impl struct, eliminating mutable global/file state.
2018-09-11service/prepo: Move class into the cpp fileLioncash
This doesn't need to be exposed within the header and be kept in the translation unit, eliminating the need to include anything within the header.
2018-09-11Merge pull request #1291 from lioncash/defaultbunnei
hle/service: Default constructors and destructors in the cpp file where applicable
2018-09-11externals: Place font data within cpp filesLioncash
This places the font data within cpp files, which mitigates the possibility of the font data being duplicated within the binary if it's referred to in more than one translation unit in the future. It also stores the data within a std::array, which is more flexible when it comes to operating with the standard library. Furthermore, it makes the data arrays const. This is what we want, as it allows the compiler to store the data within the read-only segment. As it is, having several large sections of mutable data like this just leaves spots in memory that we can accidentally write to (via accidental overruns, what have you) and actually have it work. This ensures the font data remains the same no matter what.
2018-09-10hle/service: Default constructors and destructors in the cpp file where ↵Lioncash
applicable When a destructor isn't defaulted into a cpp file, it can cause the use of forward declarations to seemingly fail to compile for non-obvious reasons. It also allows inlining of the construction/destruction logic all over the place where a constructor or destructor is invoked, which can lead to code bloat. This isn't so much a worry here, given the services won't be created and destroyed frequently. The cause of the above mentioned non-obvious errors can be demonstrated as follows: ------- Demonstrative example, if you know how the described error happens, skip forwards ------- Assume we have the following in the header, which we'll call "thing.h": \#include <memory> // Forward declaration. For example purposes, assume the definition // of Object is in some header named "object.h" class Object; class Thing { public: // assume no constructors or destructors are specified here, // or the constructors/destructors are defined as: // // Thing() = default; // ~Thing() = default; // // ... Some interface member functions would be defined here private: std::shared_ptr<Object> obj; }; If this header is included in a cpp file, (which we'll call "main.cpp"), this will result in a compilation error, because even though no destructor is specified, the destructor will still need to be generated by the compiler because std::shared_ptr's destructor is *not* trivial (in other words, it does something other than nothing), as std::shared_ptr's destructor needs to do two things: 1. Decrement the shared reference count of the object being pointed to, and if the reference count decrements to zero, 2. Free the Object instance's memory (aka deallocate the memory it's pointing to). And so the compiler generates the code for the destructor doing this inside main.cpp. Now, keep in mind, the Object forward declaration is not a complete type. All it does is tell the compiler "a type named Object exists" and allows us to use the name in certain situations to avoid a header dependency. So the compiler needs to generate destruction code for Object, but the compiler doesn't know *how* to destruct it. A forward declaration doesn't tell the compiler anything about Object's constructor or destructor. So, the compiler will issue an error in this case because it's undefined behavior to try and deallocate (or construct) an incomplete type and std::shared_ptr and std::unique_ptr make sure this isn't the case internally. Now, if we had defaulted the destructor in "thing.cpp", where we also include "object.h", this would never be an issue, as the destructor would only have its code generated in one place, and it would be in a place where the full class definition of Object would be visible to the compiler. ---------------------- End example ---------------------------- Given these service classes are more than certainly going to change in the future, this defaults the constructors and destructors into the relevant cpp files to make the construction and destruction of all of the services consistent and unlikely to run into cases where forward declarations are indirectly causing compilation errors. It also has the plus of avoiding the need to rebuild several services if destruction logic changes, since it would only be necessary to recompile the single cpp file.
2018-09-10Use open-source shared fonts if no dumped file is available (#1269)Tobias
* Add open-source shared fonts * Address review comments
2018-09-10video_core: Move command buffer loop.Markus Wick
This moves the hot loop into video_core. This refactoring shall reduce the CPU overhead of calling ProcessCommandList.
2018-09-09Merge pull request #1276 from FearlessTobi/fix-stupid-stubbunnei
hid: Implement ReloadInputDevices
2018-09-09service: Remove unused g_kernel_named_ports variableLioncash
With the named port functionality all migrated over to the kernel, there's no need to keep this around anymore.
2018-09-09hid: Implement ReloadInputDevicesfearlessTobi
2018-09-08Add audio stretching supportfearlessTobi
2018-09-06core: Migrate current_process pointer to the kernelLioncash
Given we now have the kernel as a class, it doesn't make sense to keep the current process pointer within the System class, as processes are related to the kernel. This also gets rid of a subtle case where memory wouldn't be freed on core shutdown, as the current_process pointer would never be reset, causing the pointed to contents to continue to live.
2018-09-06Merge pull request #1250 from lioncash/file-sysbunnei
file_sys/{nca_patch, patch_manager}: Amend unnecessary/missing includes.
2018-09-06core/core: Remove unnecessary sm/controller includeLioncash
The only reason this include was necessary, was because the constructor wasn't defaulted in the cpp file and the compiler would inline it wherever it was used. However, given Controller is forward declared, all those inlined constructors would see an incomplete type, causing a compilation failure. So, we just place the constructor in the cpp file, where it can see the complete type definition, allowing us to remove this include.