- Oct 24, 2018
-
-
Lioncash authored
Like with the previous change, the kernel doesn't return NOT_AUTHORIZED here. It returns INVALID_THREAD_PRIORITY.
-
Lioncash authored
kernel/svc: Move and correct returned error code for invalid thread priorities in SetThreadPriority() All priority checks are supposed to occur before checking the validity of the thread handle, we're also not supposed to return ERR_NOT_AUTHORIZED here.
-
- Oct 23, 2018
-
-
David Marcec authored
-
David Marcec authored
There seems to be more such as type 1, and 2. Unsure what these currently are but when a game hits them we can investigate and add the rest
-
- Oct 20, 2018
-
-
Lioncash authored
In the kernel, there isn't a singular handle table that everything gets tossed into or used, rather, each process gets its own handle table that it uses. This currently isn't an issue for us, since we only execute one process at the moment, but we may as well get this out of the way so it's not a headache later on.
-
Lioncash authored
This should be comparing against the queried process' vma_map, not the current process'. The only reason this hasn't become an issue yet is we currently only handle one process being active at any time.
-
- Oct 18, 2018
-
-
Lioncash authored
The kernel itself checks whether or not the provided addresses are word aligned before continuing, so we should be doing the same.
-
Lioncash authored
Aligning on 4KB pages isn't a Switch-specific thing, so this can be moved to common so it can be used with other things as well.
-
Lioncash authored
Now that the changes clarifying the address spaces has been merged, we can wrap the checks that the kernel performs when mapping shared memory (and other forms of memory) into its own helper function and then use those within MapSharedMemory and UnmapSharedMemory to complete the sanitizing checks that are supposed to be done.
-
- Oct 15, 2018
-
-
Lioncash authored
-
Lioncash authored
So, one thing that's puzzled me is why the kernel seemed to *not* use the direct code address ranges in some cases for some service functions. For example, in svcMapMemory, the full address space width is compared against for validity, but for svcMapSharedMemory, it compares against 0xFFE00000, 0xFF8000000, and 0x7FF8000000 as upper bounds, and uses either 0x200000 or 0x8000000 as the lower-bounds as the beginning of the compared range. Coincidentally, these exact same values are also used in svcGetInfo, and also when initializing the user address space, so this is actually retrieving the ASLR extents, not the extents of the address space in general.
-
- Oct 14, 2018
-
-
David Marcec authored
This should help diagnose crashes easier and prevent many users thinking that a game is still running when in fact it's just an audio thread still running(this is typically not killed when svcBreak is hit since the game expects us to do this)
-
- Oct 13, 2018
-
-
Lioncash authored
A fairly basic service function, which only appears to currently support retrieving the process state. This also alters the ProcessStatus enum to contain all of the values that a kernel process seems to be able of reporting with regards to state.
-
- Oct 12, 2018
-
-
Lioncash authored
-
- Oct 11, 2018
-
-
Lioncash authored
This adds the missing address range checking that the service functions do before attempting to map or unmap memory. Given that both service functions perform the same set of checks in the same order, we can wrap these into a function and just call it from both functions, which deduplicates a little bit of code.
-
- Oct 10, 2018
-
-
Lioncash authored
There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
-
David Marcec authored
signal_debugger seems like a more fitting name
-
David Marcec authored
svcBreak reason should be a u32, not a u64.
-
- Oct 09, 2018
-
-
David Marcec authored
-
David Marcec authored
-
David Marcec authored
When loading NROs, svcBreak is called to signal to the debugger that a new "module" is loaded. As no debugger is technically attached we shouldn't be killing the programs execution.
-
- Oct 04, 2018
-
-
Lioncash authored
Many of the member variables of the thread class aren't even used outside of the class itself, so there's no need to make those variables public. This change follows in the steps of the previous changes that made other kernel types' members private. The main motivation behind this is that the Thread class will likely change in the future as emulation becomes more accurate, and letting random bits of the emulator access data members of the Thread class directly makes it a pain to shuffle around and/or modify internals. Having all data members public like this also makes it difficult to reason about certain bits of behavior without first verifying what parts of the core actually use them. Everything being public also generally follows the tendency for changes to be introduced in completely different translation units that would otherwise be better introduced as an addition to the Thread class' public interface.
-
- Sep 30, 2018
-
-
Lioncash authored
Now that we have all of the rearranging and proper structure sizes in place, it's fairly trivial to implement svcGetThreadContext(). In the 64-bit case we can more or less just write out the context as is, minus some minor value sanitizing. In the 32-bit case we'll need to clear out the registers that wouldn't normally be accessible from a 32-bit AArch32 exectuable (or process).
-
Lioncash authored
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.
-
- Sep 25, 2018
-
-
Lioncash authored
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.
-
Lioncash authored
Previously, these were reporting hardcoded values, but given the regions can change depending on the requested address spaces, these need to report the values that the memory manager contains.
-
- Sep 24, 2018
-
-
tech4me authored
-
- Sep 21, 2018
-
-
Lioncash authored
Reduces the use of Process class members externally and keeps most code related to tearing down a process with the rest of the process code.
-
- Sep 18, 2018
-
-
Lioncash authored
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.
-
- Sep 15, 2018
-
-
Valentin Vanelslande authored
-
fearlessTobi authored
-
- Sep 14, 2018
-
-
Lioncash authored
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".
-
Lioncash authored
kernel/svc: Sanitize addresses, permissions, and sizes within 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.
-
Lioncash authored
The kernel checks if the addresses and given size is 4KB aligned before continuing onwards to map the memory.
-
Lioncash authored
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.
-
- Sep 12, 2018
-
-
Lioncash authored
This is what the kernel does for an out-of-range processor ID.
-
Lioncash authored
-
Lioncash authored
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.
-
Lioncash authored
This should be a u64 to represent size.
-
- Sep 02, 2018
-
-
Lioncash authored
Now that we have a class representing the kernel in some capacity, we now have a place to put the named port map, so we move it over and get rid of another piece of global state within the core.
-