Commit graph

56 commits

Author SHA1 Message Date
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
Subv 1051795c32 Kernel/Semaphores: Fixed build 2014-12-13 13:43:01 -05:00
Subv 49b31badba SVC: Implemented ReleaseSemaphore.
This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
2014-12-13 13:40:10 -05:00
Subv 82c84883a5 SVC: Implemented svcCreateSemaphore
ToDo: Implement svcReleaseSemaphore
* Some testing against hardware needed
2014-12-13 13:40:09 -05:00
Yuri Kunde Schlesner 0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
bunnei 4cb7a44d4e MemMap: Renamed "GSP" heap to "linear", as this is not specific to GSP.
- Linear simply indicates that the mapped physical address is always MappedVAddr+0x0C000000, thus this memory can be used for hardware devices' DMA (such as the GPU).
2014-12-12 00:15:47 -05:00
Subv 029ff9f1fd SVC: Implemented GetThreadId.
For now threads are using their Handle value as their Id, it should not really cause any problems because Handle values are unique in Citra, but it should be changed. I left a ToDo there because this is not correct behavior as per hardware.
2014-12-04 00:25:35 -05:00
bunnei f985469901 SVC: Add debug log to ArbitrateAddress. 2014-11-26 15:04:07 -05:00
bunnei e0e7443517 SVC: SleepThread should yield to the next ready thread. 2014-11-26 15:04:07 -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 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
Sean 9a012ff007 Fix some warnings 2014-10-29 20:26:15 -04:00
bunnei 532a9e80a0 Merge pull request #99 from archshift/ext-check
loader.cpp: improved file extension checking, made Upper/LowerStr useful, moved string_util into Common namespace
2014-09-11 00:04:36 -04:00
archshift 6e606c515f core: Prune redundant includes 2014-09-08 17:54:14 -07:00
archshift 5472fd4d9b Added string_util to common, small changes in loader.cpp 2014-09-08 15:43:22 -07:00
bunnei e9c5c563a5 Merge pull request #55 from lioncash/string
Core: Alter the kernel string functions to use std::string instead of const char*.
2014-08-18 21:42:44 -04:00
bunnei 10f25866e2 SVC: Added support for svc_GetSystemTick.
Changed HLE function return methods to be static inline functions.
2014-08-18 21:26:20 -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
Lioncash 986dd27392 Core: Fix a formatting error in svc.cpp
entry_point would not be added to the string. Also used StringFromFormat
so that the buffer is unnecessary.
2014-08-17 14:28:39 -04:00
bunnei 66f91b4346 SVC: Fixed typo with MapMemoryBlock DEBUG_LOG call. 2014-08-07 20:27:11 -04:00
bunnei 4d4607041b SVC: Removed ArbitrateAddress log message that spams to much. 2014-08-05 23:53:58 -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 7ff92c36ed SharedMemory: Updated MapSharedMemory to use an enum for permissions.
- Also added some safety checks to MapSharedMemory.
2014-07-05 10:24:54 -04:00
bunnei 7b7a435094 GSP: Fixed to use real shared memory object, various cleanups.
- Previously, used a hard-coded shared memory handle of 0x10002000 (as used by libctru homebrew)

GSP: Added name for shared memory.

GSP: Cleaned up assertion message.
2014-07-05 10:24:52 -04:00
bunnei 8957622d10 SVC: Renamed all function wrapper templates to Wrap, moved to HLE namespace. 2014-06-13 09:51:17 -04:00
bunnei 862db811f0 SVC: Cleaned up function wrappers to pass in correct argument types. 2014-06-13 09:51:15 -04:00
bunnei 4d6c96b7d8 SVC: Moved declaration of "wait" variable in SendSyncRequest for improved readability. 2014-06-13 09:51:13 -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 d7363322c7 HLE: Updated various handle debug assertions to be more clear. 2014-06-13 09:51:11 -04:00
bunnei f5c7c15434 Kernel: Added real support for thread and event blocking
- SVC: Added ExitThread support
- SVC: Added SignalEvent support
- Thread: Added WAITTYPE_EVENT for waiting threads for event signals
- Thread: Added support for blocking on other threads to finish (e.g. Thread::Join)
- Thread: Added debug function for printing current threads ready for execution
- Thread: Removed hack/broken thread ready state code from Kernel::Reschedule
- Mutex: Moved WaitCurrentThread from SVC to Mutex::WaitSynchronization
- Event: Added support for blocking threads on event signalling

Kernel: Added missing algorithm #include for use of std::find on non-Windows platforms.
2014-06-13 09:51:02 -04:00
bunnei 477b0caca4 svc: updated WaitSynchronizationN to properly use first pointer argument 2014-06-02 17:54:07 -04:00
bunnei 4819e9a60f svc: changed DuplicateHandle log message from "error" to "debug" 2014-06-01 22:33:53 -04:00
bunnei 3fb31fbc57 svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle support 2014-06-01 22:12:54 -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 15c7d81706 svc: cleaned up function_wrappers, updated various SVCs to make use of pointer arguments 2014-06-01 20:48:29 -04:00
bunnei f2f638492b svc: updated waitSychronization to not overwrite handle on return, added stub for SleepThread (does nothing) 2014-06-01 10:37:19 -04:00
bunnei c404d22036 hle: cleaned up log messages 2014-05-29 23:26:58 -04:00
bunnei b0bad47c0e svc: updated OutputDebugString to use OS_LOG 2014-05-29 23:04:18 -04:00
bunnei 6d267142ad svc: changed unimplemented SVC log messages from "debug" messages to "error" messages 2014-05-29 20:26:27 -04:00
bunnei 58af0da792 svc: added svcClearEvent, stubbed function for svcArbitrateAddress, and various fixes
- force kernel reschedule after svcWaitSynchronization
- fixed some bugs with passing in pointer arguments
- cleaned up some comments and log messages
2014-05-29 20:24:51 -04:00
bunnei 47e781e80a svc: implemented WaitSynchronization1, WaitSynchronizationN, and CreateEvent 2014-05-27 22:41:09 -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 6e51c56fe4 svc: added some assertions 2014-05-26 21:57:10 -04:00
bunnei 9f7ed2d027 svc: changed SendSyncRequest to use Kernel::Object SyncRequest (instead of just service Interface class) 2014-05-26 21:17:10 -04:00
bunnei 15d2ab1b33 svc: added stub for DuplicateHandle SVC call 2014-05-26 20:55:48 -04:00
bunnei f8a98ab022 svc: added a check to ensure that a service was implemented before attempting to connect to its port 2014-05-22 22:49:29 -04:00
bunnei b99ac2c3d6 thread: renamed "WaitCurThread" to "WaitCurrentThread", removed unused "reason" argument 2014-05-22 19:36:56 -04:00
bunnei 7c0b006076 thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThread 2014-05-22 19:32:45 -04:00
bunnei 06e3c3d55a svc: added Kernel::Reschedule to svc WaitSynchronization1, updated log messages to include newly created handles 2014-05-21 21:41:40 -04:00