Commit graph

68 commits

Author SHA1 Message Date
Yuri Kunde Schlesner be031989ee Kernel: Move HandleTable to a separate file 2017-05-29 17:34:39 -07:00
Lectem 8baae9d982 IPC helpers example 2016-12-26 14:07:29 +01:00
Subv 016307ae65 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:45:36 -05:00
Subv ebbb55ec8f Moved the HLE command buffer translation task to ServerSession instead of the HLE handler superclass. 2016-12-09 12:52:12 -05:00
Subv 386112da32 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 f9bcf89510 Use std::move where appropriate. 2016-12-08 11:06:19 -05:00
Subv 61a2fe8c3b HLE: Use a member variable instead of a virtual function to retrieve the max number of sessions that can be connected to an HLE service at the same time. 2016-12-05 13:44:41 -05:00
Subv 00f0c77570 Split SessionRequestHandler::HandleSyncRequest into HandleSyncRequest, TranslateRequest and HandleSyncRequestImpl.
HandleSyncRequest now takes care of calling the command buffer translate function before actually invoking the command handler for HLE services.
2016-12-05 12:05:00 -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 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 c5e7e0fa26 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 c19afd2118 Kernel/HLE: Service::Interface no longer inherits from any Kernel object, and is now its own standalone class.
Interface is now used by aggregation in ClientPort, to forward service commands to their HLE implementation if needed.
2016-11-30 23:03:59 -05:00
Subv 0a33d915f8 fixup! Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication. 2016-11-30 23:02:06 -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
mailwl 5b136aa211 Set client SDK version to Service APIs 2016-11-30 09:51:14 +03: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
Emmanuel Gil Peyrot e5fcabdd69 Core: Cleanup file_sys includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 596b7c4f63 Common: Cleanup key_map includes. 2015-06-28 00:36:54 +01:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner ad3e25b414 De-inline functions from Interface, removing them from service.h
This reduces the time for a full recompile from 65.43s to 59.53s (~9%)
2015-04-14 15:34:28 -03:00
Subv 83a8975cb8 Services: Moved the PTM and APT services to their own folder
This coincidentally fixes an issue about the PTM service failing to create its SharedExtSaveData archive due to the FS service not being initialized by the time the creating code runs.

Ideally I'd like to move each process to its own folder, and have a single file per process that registers the service classes, which would be in their own files inside that folder. Then each service class would just call functions from the process to complete the commands.
2015-03-03 21:48:08 -05:00
Yuri Kunde Schlesner 6e11570862 Service: Store function names as const char* instead of std::string
Uses less memory (strings and function table is stored in constant data)
and speeds up start up (no need to allocate and copy strings).
2015-02-02 15:37:00 -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
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
Yuri Kunde Schlesner a6ad68190f Fix double-free in Service manager during shutdown
Fixes #423.
2015-01-07 17:32:31 -02:00
Yuri Kunde Schlesner 7e2903cb74 Kernel: New handle manager
This handle manager more closely mirrors the behaviour of the CTR-OS
one. In addition object ref-counts and support for DuplicateHandle have
been added.

Note that support for DuplicateHandle is still experimental, since parts
of the kernel still use Handles internally, which will likely cause
troubles if two different handles to the same object are used to e.g.
wait on a synchronization primitive.
2014-12-28 11:52:55 -02:00
Yuri Kunde Schlesner 73fba22c01 Rename ObjectPool to HandleTable 2014-12-28 11:52:52 -02: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
archshift 43a682a106 Log the cmd_buff arguments when citra comes across an unimplemented function 2014-11-24 15:51:48 -08:00
Yuri Kunde Schlesner 22c86824a4 Remove duplicated docs/update them for changed parameters. 2014-11-24 17:08:36 -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
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
Yuri Kunde Schlesner d72708c1f5 Add override keyword through the code.
This was automated using `clang-modernize`.
2014-10-26 16:18:05 -02:00
Lioncash d30747efea core: Pass string by reference in FetchFromPortName and DeleteService 2014-09-06 13:30:27 -04:00
Lioncash 98fa3f7cba Core: Alter the kernel string functions to use std::string instead of const char*.
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
2014-08-17 23:12:20 -04:00
bunnei 004df76795 Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts:
	src/core/hle/function_wrappers.h
	src/core/hle/service/gsp.cpp
2014-06-14 12:13:16 -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 8cac527c94 Kernel: Updated several member functions to be const 2014-06-13 09:51:10 -04:00
bunnei 870c6146e7 service: added a error log messages for unimplemented WaitSynchronization 2014-06-04 18:50:50 -04:00
bunnei c451ad2835 service: cleaned up log messages 2014-05-30 00:22:39 -04:00
bunnei 545e6919ce service: added additional hack to return success on unimplemented service calls 2014-05-29 18:54:59 -04:00
bunnei 70af9d620b service: changed interface to return 0 (no error) when a service method is unimplemented - hack to make apps boot further 2014-05-28 18:39:28 -04:00
bunnei a432dc8f39 kernel: added WaitSynchronization method to Kernel::Object 2014-05-26 22:17:49 -04:00
bunnei 58a3adcdd2 kernel: updated SyncRequest to take boolean thread wait result as a parameter 2014-05-26 22:12:46 -04:00
bunnei 16fea415d0 service: Renamed Sync to SyncRequest 2014-05-26 21:56:51 -04:00