Commit Graph

30 Commits

Author SHA1 Message Date
Fernando Sahmkow
e6a8d31829 Kernel: Refactor synchronization to better match RE 2020-02-11 18:47:31 -04:00
Fernando Sahmkow
d206267c9b Kernel: Change WaitObject to Synchronization object. In order to better reflect RE. 2020-02-11 10:46:25 -04:00
bunnei
d9f03d3073 kernel: Implement a more accurate IPC dispatch. 2019-11-28 12:01:53 -05:00
Lioncash
e49cc19662 core: Prepare various classes for memory read/write migration
Amends a few interfaces to be able to handle the migration over to the
new Memory class by passing the class by reference as a function
parameter where necessary.

Notably, within the filesystem services, this eliminates two ReadBlock()
calls by using the helper functions of HLERequestContext to do that for
us.
2019-11-26 21:55:37 -05:00
bunnei
8a30b5ed5b kernel: Fix reference management for client/server session.
- Fixes shutdown crash and crash in Pokemon SwSh.
2019-11-25 18:17:49 -05:00
bunnei
467d60256b kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.

- See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-24 20:15:51 -05:00
Lioncash
f397d49ac1 kernel/server_session: Make data members private
Makes it much nicer to locally reason about server session behavior, as
part of its functionality isn't placed around other classes.
2019-03-05 20:10:07 -05:00
Lioncash
824133480c core/kernel: Remove unnecessary inclusions
Gets rid of a few unnecessary header dependencies in some source files.
2018-12-31 19:04:16 -05:00
Lioncash
7f6717b5aa kernel: Eliminate kernel global state
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-28 22:31:51 -04:00
Lioncash
2811d57c6e kernel: Remove unnecessary includes
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
2018-07-31 10:15:17 -04:00
James Rowe
7d396de27a Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
Subv
cd907b8cde Kernel/SVC: Pass the current thread as a parameter to ClientSession::SendSyncRequest. 2017-06-29 12:30:34 -05:00
Subv
059f8a8825 Kernel/Sessions: Clean up the list of pending request threads of a session when the client endpoint is closed. 2017-06-25 23:38:29 -05:00
Subv
ab78b9d946 Kernel/ServerSession: Keep track of which threads have issued sync requests. 2017-06-25 14:47:25 -05:00
Yuri Kunde Schlesner
4472d58f58 Session: Remove/add some forward declarations 2017-06-08 00:33:57 -07:00
Yuri Kunde Schlesner
5a7ac5a29a Kernel: Ensure objects are kept alive during ClientSession disconnection
Fixes #2760
2017-06-08 00:33:24 -07:00
Yuri Kunde Schlesner
2578ce5423 HLE: Move SessionRequestHandler from Service:: to Kernel::
Most of the code that works with this is or will be in the kernel, so
it's a more appropriate place for it to be.
2017-06-05 23:40:11 -07:00
Yuri Kunde Schlesner
fd8aeacfa1 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Subv
620c84a612 Kernel/Sessions: Remove the ClientSession::Create function.
It is not meant to be used by anything other than CreateSessionPair.
2017-05-21 18:52:42 -05:00
Subv
b666a71713 Kernel: Remove a now unused enum and variable regarding a session's status. 2017-05-15 11:22:16 -05:00
Subv
d21789195d Kernel: Use a Session object to keep track of the status of a Client/Server session pair.
Reduce the associated port's connection count when a ServerSession is destroyed.
2017-05-15 11:22:15 -05:00
Subv
517a16acb8 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:45:36 -05:00
Subv
ee6c03dfc6 Added a framework for partially handling Session disconnections.
Further implementation will happen in a future commit.

Fixes a regression.
2016-12-08 15:01:10 -05:00
Subv
41e5e714d5 Use std::move where appropriate. 2016-12-08 11:06:19 -05:00
Subv
7a18725662 KServerPorts now have an HLE handler "template", which is inherited by all ServerSessions created from it. 2016-12-05 11:02:08 -05:00
Subv
039c8a8fc5 Declare empty ServerSession and ClientSession constructors as default. 2016-12-02 22:58:02 -05:00
Subv
694df935a6 Fixed the rebase mistakes. 2016-11-30 23:28:31 -05:00
Subv
20f90896af A bit of a redesign.
Sessions and Ports are now detached from each other.
HLE services are handled by means of a SessionRequestHandler class, Interface now inherits from this class.
The File and Directory classes are no longer kernel objects, but SessionRequestHandlers instead, bound to a ServerSession when requested.
File::OpenLinkFile now creates a new session pair and binds the File instance to it.
2016-11-30 23:12:35 -05:00
Subv
856f8029d7 IPC/HLE: Associate the ClientSessions with their parent port's HLE interface if it exists.
Pass the triggering ServerSession to the HLE command handler to differentiate which session caused the request.
2016-11-30 23:04:00 -05:00
Subv
0d2f2880b9 Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
All handles obtained via srv::GetServiceHandle or svcConnectToPort are references to ClientSessions.
Service modules will wait on the counterpart of those ClientSessions (Called ServerSessions) using svcReplyAndReceive or svcWaitSynchronization[1|N], and will be awoken when a SyncRequest is performed.

HLE Interfaces are now ClientPorts which override the HandleSyncRequest virtual member function to perform command handling immediately.
2016-11-30 23:02:05 -05:00