Commit graph

44 commits

Author SHA1 Message Date
bunnei 5e77e2e1de WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup. 2015-01-21 18:41:58 -05:00
bunnei c22bac6398 Kernel: Added WaitObject and changed "waitable" objects inherit from it. 2015-01-21 18:41:00 -05:00
Yuri Kunde Schlesner 8ad41775cc Kernel: Start using boost::intrusive_ptr for lifetime management 2015-01-09 19:43:52 -02:00
Yuri Kunde Schlesner d751de7341 Kernel: Don't re-assign object's handle when duplicating one 2015-01-09 19:43:51 -02:00
Yuri Kunde Schlesner 9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 2015-01-09 04:02:15 -02:00
Subv 07044651ef SVC: Implemented the Timer service calls. 2015-01-08 21:22:14 -05: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 23f2142009 Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants 2014-12-28 11:52:53 -02:00
Yuri Kunde Schlesner 73fba22c01 Rename ObjectPool to HandleTable 2014-12-28 11:52:52 -02:00
bunnei 0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
2014-12-21 16:05:44 -05:00
purpasmart96 ebfd831ccb License change 2014-12-20 21:20:24 -08:00
bunnei 2e5869c939 Merge pull request #316 from yuriks/thread-handle
Kernel: Implement support for current thread pseudo-handle
2014-12-20 16:36:01 -05:00
Yuri Kunde Schlesner adee775f44 Kernel: Implement support for current thread pseudo-handle
This boots a few (mostly Nintendo 1st party) games further.
2014-12-20 03:27:47 -02:00
Subv ea9ce0fba7 Filesystem/Archives: Implemented the SaveData archive
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information

Got rid of the code duplication in File and Directory

Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive.

FS_U: Use the correct error code when a file wasn't found
2014-12-17 19:21:38 -05: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
Lioncash cfc0ee9c60 kernel: Remove unused log arguments 2014-12-13 10:15:58 -05:00
Yuri Kunde Schlesner 0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
Lioncash 9b68d5e074 kernel: Make some functions const 2014-12-03 19:48:34 -05: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
Lioncash 1a8f466217 Remove extraneous semicolons 2014-11-18 08:27:16 -05:00
Emmanuel Gil Peyrot c197ce2180 Kernel: Add a Directory object and a getter for it from an Archive object. 2014-09-17 14:35:46 +00:00
Lioncash ab4648d3ca Core: Use std::array for managing kernel object space
These avoid relying on memset for clearing the arrays.
2014-08-19 00:32:48 -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 3eb89f3e98 Kernel: Added preliminary support for address arbiters.
AddressArbiter: Added documentation comment, fixed whitespace issue.

AddressArbiter: Fixed incorrect comment, reordered if-statement to be more clear.

SVC: Removed trailing whitespace.
2014-07-08 18:46:38 -04:00
bunnei 8b8c8f4c13 Kernel: Added stubbed code to support creation of kernel Archive objects. 2014-06-27 16:58:30 -04:00
bunnei f49ac3a2d7 Kernel: Added freeing of kernel objects on emulator shutdown. 2014-06-13 09:51:19 -04:00
bunnei 8cac527c94 Kernel: Updated several member functions to be const 2014-06-13 09:51:10 -04:00
bunnei aae9fcf4a4 Kernel: Made SyncRequest not pure virtual, with a default implementation of error (as this is not required for all kernel objects) 2014-06-13 09:51:08 -04:00
bunnei 8c0f02a70c kernel: moved position of * for GetTypeName and GetName 2014-06-02 20:36:58 -04:00
bunnei 10447d1f48 kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedule 2014-06-01 21:42:50 -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 3d7693f75f kernel: added enum for known CurrentThread and CurrentProcess handles 2014-05-26 21:56:23 -04:00
bunnei d73d782ba7 kernel: add a SyncRequest method to KernelObject for use with svcSendSyncRequest 2014-05-26 21:01:27 -04:00
bunnei d26f3d4c1f kernel: refactored function naming to remove "__" prefix 2014-05-22 19:06:12 -04:00
bunnei 1c5802c35a kernel: fixed include, in general include "common.h" not "common_types.h" 2014-05-20 22:27:46 -04:00
bunnei 44336329ed - created a Kernel namespace
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues)
- added handle types for all different CTROS handles
2014-05-20 18:13:25 -04:00
bunnei eab6fd01d7 - updated service(s) to be KernelObject's
- various cleanups
2014-05-18 21:43:29 -04:00
bunnei 772abad778 - moved Handle/Result definitions to kernel.h
- added ResetType enum
2014-05-18 18:12:29 -04:00
bunnei 7cdb705059 - replaced KERNELOBJECT_MAX_NAME_LENGTH with KERNEL_MAX_NAME_LENGTH
- added KERNEL_DEFAULT_STACK_SIZE definition (0x4000)
2014-05-16 23:48:15 -04:00
bunnei a7cc430aa4 changed "UID" to "Handle" to be a little more consistent with CTR naming 2014-05-15 18:26:28 -04:00
bunnei 1583d2b6f3 - added __KernelLoadExec function
- fixed some logging
2014-05-13 21:57:12 -04:00
bunnei 6b264518a5 added initial kernel/thread modules 2014-05-09 22:11:18 -04:00