aboutsummaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2019-03-15kernel/thread: Make bracing consistent within UpdatePriority()Lioncash
2019-03-15kernel/thread: Amend condition within UpdatePriority()Lioncash
This condition was checking against the nominal thread priority, whereas the kernel itself checks against the current priority instead. We were also assigning the nominal priority, when we should be assigning current_priority, which takes priority inheritance into account. This can lead to the incorrect priority being assigned to a thread. Given we recursively update the relevant threads, we don't need to go through the whole mutex waiter list. This matches what the kernel does as well (only accessing the first entry within the waiting list).
2019-03-15kernel/thread: Maintain priority ordering of added mutex waiting threadsLioncash
The kernel keeps the internal waiting list ordered by priority. This is trivial to do with std::find_if followed by an insertion.
2019-03-15gdbstub: Fix some bugs in IsMemoryBreak() and ServeBreak. Add workaround to ↵Dimitri A
let watchpoints break into GDB. (#4651) * gdbstub: fix IsMemoryBreak() returning false while connected to client As a result, the only existing codepath for a memory watchpoint hit to break into GDB (InterpeterMainLoop, GDB_BP_CHECK, ARMul_State::RecordBreak) is finally taken, which exposes incorrect logic* in both RecordBreak and ServeBreak. * a blank BreakpointAddress structure is passed, which sets r15 (PC) to NULL * gdbstub: DynCom: default-initialize two members/vars used in conditionals * gdbstub: DynCom: don't record memory watchpoint hits via RecordBreak() For now, instead check for GDBStub::IsMemoryBreak() in InterpreterMainLoop and ServeBreak. Fixes PC being set to a stale/unhit breakpoint address (often zero) when a memory watchpoint (rwatch, watch, awatch) is handled in ServeBreak() and generates a GDB trap. Reasons for removing a call to RecordBreak() for memory watchpoints: * The``breakpoint_data`` we pass is typed Execute or None. It describes the predicted next code breakpoint hit relative to PC; * GDBStub::IsMemoryBreak() returns true if a recent Read/Write operation hit a watchpoint. It doesn't specify which in return, nor does it trace it anywhere. Thus, the only data we could give RecordBreak() is a placeholder BreakpointAddress at offset NULL and type Access. I found the idea silly, compared to simply relying on GDBStub::IsMemoryBreak(). There is currently no measure in the code that remembers the addresses (and types) of any watchpoints that were hit by an instruction, in order to send them to GDB as "extended stop information." I'm considering an implementation for this. * gdbstub: Change an ASSERT to DEBUG_ASSERT I have never seen the (Reg[15] == last_bkpt.address) assert fail in practice, even after several weeks of (locally) developping various branches around GDB. Only leave it inside Debug builds.
2019-03-14gpu: Use host address for caching instead of guest address.bunnei
2019-03-14core/hle/kernel/mutex: Remove usages of global system accessorsLioncash
Removes the use of global system accessors, and instead uses the explicit interface provided.
2019-03-14core/hle/kernel: Make Mutex a per-process class.Lioncash
Makes it an instantiable class like it is in the actual kernel. This will also allow removing reliance on global accessors in a following change, now that we can encapsulate a reference to the system instance in the class.
2019-03-14Merge pull request #2230 from lioncash/globalbunnei
kernel/process: Remove use of global system accessors
2019-03-13Merge pull request #2226 from lioncash/privatebunnei
kernel/server_port: Make data members private
2019-03-13Merge pull request #2223 from lioncash/errorbunnei
core/hle/result: Tidy up the base error code result header.
2019-03-13Merge pull request #2166 from lioncash/vi-init-servicebunnei
service/vi: Unstub GetDisplayService
2019-03-13core/hle/kernel/svc: Implement svcUnmapTransferMemoryLioncash
Similarly, like svcMapTransferMemory, we can also implement svcUnmapTransferMemory fairly trivially as well.
2019-03-13core/hle/kernel/svc: Implement svcMapTransferMemoryLioncash
Now that transfer memory handling is separated from shared memory, we can implement svcMapTransferMemory pretty trivially.
2019-03-13core/hle/kernel: Split transfer memory handling out into its own classLioncash
Within the kernel, shared memory and transfer memory facilities exist as completely different kernel objects. They also have different validity checking as well. Therefore, we shouldn't be treating the two as the same kind of memory. They also differ in terms of their behavioral aspect as well. Shared memory is intended for sharing memory between processes, while transfer memory is intended to be for transferring memory to other processes. This breaks out the handling for transfer memory into its own class and treats it as its own kernel object. This is also important when we consider resource limits as well. Particularly because transfer memory is limited by the resource limit value set for it. While we currently don't handle resource limit testing against objects yet (but we do allow setting them), this will make implementing that behavior much easier in the future, as we don't need to distinguish between shared memory and transfer memory allocations in the same place.
2019-03-12kernel/process: Remove use of global system accessorsLioncash
Now that we pass in a reference to the system instance, we can utilize it to eliminate the global accessors in Process-related code.
2019-03-12Merge pull request #2211 from lioncash/arbiterbunnei
kernel: Make the address arbiter instance per-process
2019-03-11set_sys: Move constants to anonymous namespaceZach Hilman
2019-03-11kernel/server_port: Make data members privateLioncash
With this, all kernel objects finally have all of their data members behind an interface, making it nicer to reason about interactions with other code (as external code no longer has the freedom to totally alter internals and potentially messing up invariants).
2019-03-11hwopus: Leverage multistream API for decoding regular Opus packetsLioncash
After doing a little more reading up on the Opus codec, it turns out that the multistream API that is part of libopus can handle regular packets. Regular packets are just a degenerate case of multistream Opus packets, and all that's necessary is to pass the number of streams as 1 and provide a basic channel mapping, then everything works fine for that case. This allows us to get rid of the need to use both APIs in the future when implementing multistream variants in a follow-up PR, greatly simplifying the code that needs to be written.
2019-03-10set_sys: Use official nintendo version stringZach Hilman
2019-03-10system_version: Correct sizes on VectorVfsFile constructionZach Hilman
2019-03-10set_sys: Use correct error codes in GetFirmwareVersion*Zach Hilman
2019-03-10core/hle/result: Remove now-unnecessary manually defined copy assignment ↵Lioncash
operator Previously this was required, as BitField wasn't trivially copyable. BitField has since been made trivially copyable, so now this isn't required anymore.
2019-03-10core/hle/result: Amend error in comment description for ResultCodeLioncash
Gets rid of another holdover from Citra, and describes the OS on the Switch instead.
2019-03-10core/hle/result: Remove now-unused constructor for ResultCodeLioncash
Now that the final stray ErrorDescription member was relocated, we can finally remove it and its relevant constructor in the ResultCode union.
2019-03-10core/hle/result: Relocate IPC error code to ipc_helpersLioncash
Relocates the error code to where it's most related, similar to how all the other error codes are. Previously we were including a non-generic error in the main result code header.
2019-03-10service/service: Remove unncessary calls to c_str()Lioncash
These can just be passed regularly, now that we use fmt instead of our old logging system. While we're at it, make the parameters to MakeFunctionString std::string_views.
2019-03-10Merge pull request #2207 from lioncash/hwopusbunnei
service/audio/hwopus: Move decoder state to its own class
2019-03-10Merge pull request #2193 from lioncash/globalbunnei
kernel/scheduler: Pass in system instance in constructor
2019-03-10set_sys: Implement GetFirmwareVersion(2) for libnx hosversionZach Hilman
Uses the synthesized system archive 9 (SystemVersion) and reports v5.1.0-0.0
2019-03-09clang fixHexagon12
2019-03-09Log 2 new setting valuesHexagon12
2019-03-08Merge pull request #2210 from lioncash/optionalbunnei
kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optional
2019-03-07kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optionalLioncash
There's no real need to use a shared lifetime here, since we don't actually expose them to anything else. This is also kind of an unnecessary use of the heap given the objects themselves are so small; small enough, in fact that changing over to optionals actually reduces the overall size of the HLERequestContext struct (818 bytes to 808 bytes).
2019-03-07kernel: Make the address arbiter instance per-processLioncash
Now that we have the address arbiter extracted to its own class, we can fix an innaccuracy with the kernel. Said inaccuracy being that there isn't only one address arbiter. Each process instance contains its own AddressArbiter instance in the actual kernel. This fixes that and gets rid of another long-standing issue that could arise when attempting to create more than one process.
2019-03-07kernel/svc: Move address arbiter signaling behind a unified API functionLioncash
Similar to how WaitForAddress was isolated to its own function, we can also move the necessary conditional checking into the address arbiter class itself, allowing us to hide the implementation details of it from public use.
2019-03-07kernel/svc: Move address arbiter waiting behind a unified API functionLioncash
Rather than let the service call itself work out which function is the proper one to call, we can make that a behavior of the arbiter itself, so we don't need to directly expose those implementation details.
2019-03-07Merge pull request #2195 from lioncash/shared-globalbunnei
kernel/shared_memory: Get rid of the use of global accessor functions within Create()
2019-03-07Merge pull request #2202 from lioncash/port-privbunnei
kernel/client_session, kernel/server_session: Make data members private
2019-03-07Merge pull request #2206 from lioncash/audio-stopbunnei
service/audio/audout_u: Only actually stop the audio stream in StopAudioOut if the stream is playing
2019-03-07Merge pull request #2055 from bunnei/gpu-threadbunnei
Asynchronous GPU command processing
2019-03-07service/audio/hwopus: Move decoder state to its own classLioncash
Moves the non-multistream specific state to its own class. This will be necessary to support the multistream variants of opus decoding.
2019-03-07service/audio/hwopus: Provide a name for the second word of OpusPacketHeaderLioncash
This indicates the entropy coder's final range.
2019-03-07service/audio/hwopus: Move Opus packet header out of the ↵Lioncash
IHardwareOpusDecoderManager This will be utilized by more than just that class in the future. This also renames it from OpusHeader to OpusPacketHeader to be more specific about what kind of header it is.
2019-03-07service/audio/hwopus: Enclose internals in an anonymous namespaceLioncash
Makes it impossible to violate the ODR, as well as providing a place for future changes.
2019-03-07service/audio/audout_u: Only actually stop the audio stream in StopAudioOut ↵Lioncash
if the stream is playing The service itself only does further actions if the stream is playing. If the stream is already stopped, then it just exits successfully.
2019-03-06Merge pull request #2197 from lioncash/includebunnei
core/hle/ipc: Remove unnecessary includes
2019-03-06gpu: Refactor a/synchronous implementations into their own classes.bunnei
2019-03-06gpu: Move command processing to another thread.bunnei
2019-03-06Merge pull request #2190 from lioncash/ogl-globalbunnei
core: Remove the global telemetry accessor function