Commit Graph

73 Commits

Author SHA1 Message Date
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
7b445ddff0 Kernel/SVC: Implemented svcCreatePort. 2016-06-11 08:37:37 -05:00
3d9fbffbab Kernel: Added ClientPort and ServerPort classes.
This is part of an ongoing effort to implement support for multiple processes.
2016-06-05 09:35:31 -05:00
d4f35fd989 Kernel: Add CodeSet case to Object::IsWaitable 2015-07-12 18:15:16 -03:00
5c5cf2f8e0 Core: Properly configure address space when loading a binary
The code now properly configures the process image to match the loaded
binary segments (code, rodata, data) instead of just blindly allocating
a large chunk of dummy memory.
2015-07-11 23:54:42 -03:00
596b7c4f63 Common: Cleanup key_map includes. 2015-06-28 00:36:54 +01:00
71e8822d23 kernel: Fix svcWaitSynch to always acquire requested wait objects. 2015-06-16 22:34:39 -04:00
b8f93e6b18 Kernel: Fix a warning introduced with ResourceLimit, and remove the fallback code to prevent it from happening again. 2015-05-21 20:54:49 +02:00
d3634d4bf4 Core/ResourceLimits: Implemented the basic structure of ResourceLimits.
Implemented svcs GetResourceLimit, GetResourceLimitCurrentValues and GetResourceLimitLimitValues.

Note that the resource limits do not currently keep track of used objects, since we have no way to distinguish between an object created by the application, and an object created by some HLE module once we're inside Kernel::T::Create.
2015-05-14 22:50:13 -05:00
a5eba2f984 Kernel: Remove g_program_id
This has been obsoleted by the field in Process.
2015-05-08 22:11:03 -03:00
6d60acf0f1 Kernel: Introduce skeleton Process class to hold process data 2015-05-08 22:11:02 -03:00
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
c916bcf7b5 Move typedefs from kernel.h to more appropriate places 2015-05-06 23:45:05 -03:00
c7dc799e19 Kernel: Properly initialize and shutdown all modules. 2015-05-01 18:27:03 -04:00
8e2b248e05 Build: Fixed some warnings 2015-02-12 09:25:35 -05:00
52f58e64ef Kernel: Make WaitObjects share ownership of Threads waiting on them
During normal operation, a thread waiting on an WaitObject and the
object hold mutual references to each other for the duration of the
wait.

If a process is forcefully terminated (The CTR kernel has a SVC to do
this, TerminateProcess, though no equivalent exists for threads.) its
threads would also be stopped and destroyed, leaving dangling pointers
in the WaitObjects.

The solution is to simply have the Thread remove itself from WaitObjects
when it is stopped. The vector of Threads in WaitObject has also been
changed to hold SharedPtrs, just in case. (Better to have a reference
cycle than a crash.)
2015-02-02 15:37:08 -02:00
5354a479bc Kernel: Remove Object::GetHandle (it's not used anymore :D) 2015-02-02 15:37:04 -02:00
869ec46683 Kernel: Introduce unique Object ids for debugging 2015-02-02 15:37:03 -02:00
09ae6e1fa3 Remove result.h InvalidHandle
It was only being used in two places, where it was replaced by a local
constant.
2015-01-30 11:49:45 -02:00
b5ee4f9df9 Move VAddr/PAddr typedefs to kernel.h 2015-01-30 11:47:01 -02:00
f09806aed2 Kernel: Renamed some functions for clarity.
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-21 20:48:30 -05:00
15b6a4d9ad Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void. 2015-01-21 20:47:49 -05:00
c68eb15695 WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual. 2015-01-21 20:47:49 -05:00
9e6ec3b6cd Session: Change to a WaitObject. 2015-01-21 20:47:47 -05:00
9412996c8f Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely. 2015-01-21 20:47:46 -05:00
e5a9f1c644 Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks. 2015-01-21 20:47:38 -05:00
6643673f28 WaitSynchronizationN: Refactor to fix several bugs
- Separate wait checking from waiting the current thread
- Resume thread when wait_all=true only if all objects are available at once
- Set output to correct wait object index when there are duplicate handles
2015-01-21 19:11:47 -05:00
aa01c57ae9 Kernel: Separate WaitSynchronization into Wait and Acquire methods. 2015-01-21 19:10:24 -05:00
7faf2d8e06 WaitSynchronizationN: Implement return values 2015-01-21 19:09:03 -05:00
5e77e2e1de WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup. 2015-01-21 18:41:58 -05:00
c22bac6398 Kernel: Added WaitObject and changed "waitable" objects inherit from it. 2015-01-21 18:41:00 -05:00
8ad41775cc Kernel: Start using boost::intrusive_ptr for lifetime management 2015-01-09 19:43:52 -02:00
d751de7341 Kernel: Don't re-assign object's handle when duplicating one 2015-01-09 19:43:51 -02:00
9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 2015-01-09 04:02:15 -02:00
07044651ef SVC: Implemented the Timer service calls. 2015-01-08 21:22:14 -05:00
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
23f2142009 Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants 2014-12-28 11:52:53 -02:00
73fba22c01 Rename ObjectPool to HandleTable 2014-12-28 11:52:52 -02:00
0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
2014-12-21 16:05:44 -05:00
ebfd831ccb License change 2014-12-20 21:20:24 -08:00
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
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
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
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
cfc0ee9c60 kernel: Remove unused log arguments 2014-12-13 10:15:58 -05:00
0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
9b68d5e074 kernel: Make some functions const 2014-12-03 19:48:34 -05:00
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
f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
1a8f466217 Remove extraneous semicolons 2014-11-18 08:27:16 -05:00