Commit graph

56 commits

Author SHA1 Message Date
Yuri Kunde Schlesner
905fc92ce1 Merge pull request #2249 from Subv/sessions_v3
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
2016-12-14 20:35:33 -08:00
Subv
016307ae65 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:45:36 -05:00
Lioncash
963aedd8cc Add all services to the Service namespace
Previously there was a split where some of the services were in the
Service namespace and others were not.
2016-12-11 00:07:27 +00:00
Subv
f9bcf89510 Use std::move where appropriate. 2016-12-08 11:06:19 -05:00
Subv
c93c5a72bb Return an error code when connecting to a saturated port.
The error code was taken from the 3DS kernel.
2016-12-05 13:59:57 -05:00
Subv
dd8887c8cf 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
ed210c32b3 Threads do not wait for the server endpoint to call AcceptSession before returning from a ConnectToPort or GetServiceHandle call. 2016-12-01 10:47:06 -05:00
Subv
2eceee3a4c Fixed the rebase mistakes. 2016-11-30 23:28:31 -05:00
Subv
009b15b3aa 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
073653e858 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
Yuri Kunde Schlesner
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Lectem
a94fb932ff fix #1942 and adds a few IPC functions for descriptors 2016-08-02 16:45:15 +02:00
mailwl
e85b22320a Fix parameter name in EnableNotification 2016-05-31 10:06:00 +03:00
mailwl
eea08f281d Fix mistakes, add output header codes 2016-05-31 10:06:00 +03:00
mailwl
eb231cb19d remove ugly function 2016-05-31 10:06:00 +03:00
mailwl
dc338ccecf srv: Update according 3dbrew 2016-05-31 10:06:00 +03:00
Lioncash
856a1d0386 svc: Move ResetType enum to the kernel event header 2016-03-12 21:47:41 -05:00
Lioncash
12e92f17de svc: Make ResetType an enum class 2016-03-12 15:06:31 -05:00
Lioncash
0937bed8d8 services: Get rid of unnecessary includes 2016-02-02 01:40:23 -05:00
Yuri Kunde Schlesner
dc39d06950 Ensure all kernel objects are released during shutdown
This commit fixes several kernel object leaks. The most severe of them
was threads not being removed from the private handle table used for
CoreTiming events. This resulted in Threads never being released, which
in turn held references to Process, causing CodeSets to never be freed
when loading other applications.
2015-07-17 02:24:13 -03:00
Yuri Kunde Schlesner
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner
88a4a808c6 Kernel: Stop creating useless Handles during object creation
They're finally unnecessary, and will stop cluttering the application's
handle table.
2015-02-02 15:37:09 -02:00
Yuri Kunde Schlesner
a79d21c83e Service: Clean-up Interface 2015-02-02 15:36:59 -02:00
Yuri Kunde Schlesner
8779b31fe6 Make Port/Service registration and querying more HW-accurate 2015-02-02 15:36:59 -02:00
Yuri Kunde Schlesner
d52d859936 Kernel: Convert Event to not use Handles 2015-01-30 11:49:43 -02:00
bunnei
e4a5d8ad4f Event: Fixed some bugs and cleanup (Subv) 2015-01-21 18:43:50 -05:00
archshift
228843c43e Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance. 2015-01-10 14:32:10 -08:00
purpasmart96
379b39e583 Services: Clean up a few things and add a few function names 2015-01-05 16:07:15 -08:00
purpasmart96
9796bc1fa2 More services & small clean ups 2014-12-25 19:08:33 -08:00
purpasmart96
ebfd831ccb License change 2014-12-20 21:20:24 -08:00
Yuri Kunde Schlesner
e321decf98 Remove SyncRequest from K::Object and create a new K::Session type
This is a first step at fixing the conceptual insanity that is our
handling of service and IPC calls. For now, interfaces still directly
derived from Session because we don't have the infrastructure to do it
properly. (That is, Processes and scheduling them.)
2014-12-15 18:26:17 -02:00
Yuri Kunde Schlesner
0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
Yuri Kunde Schlesner
c2588403c0 HLE: Revamp error handling throrough the HLE code
All service calls in the CTR OS return result codes indicating the
success or failure of the call. Previous to this commit, Citra's HLE
emulation of services and the kernel universally either ignored errors
or returned dummy -1 error codes.

This commit makes an initial effort to provide an infrastructure for
error reporting and propagation which can be use going forward to make
HLE calls accurately return errors as the original system. A few parts
of the code have been updated to use the new system where applicable.

One part of this effort is the definition of the `ResultCode` type,
which provides facilities for constructing and parsing error codes in
the structured format used by the CTR.

The `ResultVal` type builds on `ResultCode` by providing a container for
values returned by function that can report errors. It enforces that
correct error checking will be done on function returns by preventing
the use of the return value if the function returned an error code.

Currently this change is mostly internal since errors are still
suppressed on the ARM<->HLE border, as a temporary compatibility hack.
As functionality is implemented and tested this hack can be eventually
removed.
2014-11-24 17:08:36 -02:00
Lioncash
7cbecde2ca Add static to some variables 2014-11-18 20:04:00 -05:00
Lioncash
72846c418e core: Mark some hle functions as static
These functions are not referred to by their linkage name outside of the translation unit, so they can be marked as static.
2014-11-17 22:41:49 -05:00
archshift
40a84833ae Added ReceiveNotification, PublishToSubscriber unimplemented functions to SRV 2014-11-01 23:15:38 -07:00
archshift
6e606c515f core: Prune redundant includes 2014-09-08 17:54:14 -07:00
bunnei
fb908b9395 srv::Initialize: Return "success" status code. 2014-08-28 17:51:41 -04:00
bunnei
1b247b8031 SRV: Updated GetProcSemaphore to create an event instead of a mutex. 2014-08-05 23:54:27 -04:00
bunnei
c95972275e HLE: Updated all uses of NULL to nullptr (to be C++11 compliant) 2014-06-13 09:51:13 -04:00
bunnei
b78aff8585 svc: added optional name field to Event and Mutex (used for debugging) 2014-06-02 20:38:34 -04:00
bunnei
007b7edada srv: fix to log unimplemented service (instead of crash) 2014-05-29 23:54:09 -04:00
bunnei
c404d22036 hle: cleaned up log messages 2014-05-29 23:26:58 -04:00
bunnei
b08b3c154f srv: changed a NOTICE_LOG to DEBUG_LOG 2014-05-29 18:53:45 -04:00
bunnei
96b2105524 srv: added a real mutex for GetProcSemaphore (instead of stubbed) 2014-05-26 21:55:55 -04:00
bunnei
725d240bf7 renamed "UID" to "Handle" where appropriate 2014-05-18 18:24:24 -04:00
bunnei
772abad778 - moved Handle/Result definitions to kernel.h
- added ResetType enum
2014-05-18 18:12:29 -04:00
bunnei
39ee75fc8d added stubbed GetProcSemaphore - does nothing but avoids an exception 2014-05-16 23:25:16 -04:00