Commit Graph

213 Commits

Author SHA1 Message Date
bunnei 3af6ad6bb9 svc: Implement svcUnmapMemory. 2017-12-31 15:22:49 -05:00
bunnei f10d490c94 svc: Minor cleanups. 2017-12-30 13:40:28 -05:00
bunnei 7a612ba7dd svc: Implement svcStartThread. 2017-12-30 13:37:07 -05:00
bunnei 8fdafee314 kernel: Add SyncObject primitive, use it for ClientSession. 2017-12-28 23:12:28 -05:00
bunnei 58cf9d847a svc: Implement MapMemory. 2017-12-28 21:38:38 -05:00
bunnei 4678ba1e18 svc: Implement SetHeapSize. 2017-12-28 15:29:52 -05:00
bunnei bfd01c7c71 svc: Implement GetThreadId and GetProcessId. 2017-10-23 00:15:45 -04:00
bunnei bf69f3d1eb hle: Fix QueryMemory response for MemoryInfo. 2017-10-19 23:00:46 -04:00
bunnei 2ea8867549 hle: Initial implementation of NX service framework and IPC. 2017-10-14 22:18:42 -04:00
bunnei 0176bad5b2 svc: Some logging cleanup. 2017-10-14 17:35:21 -04:00
bunnei bdc3ccc8ac svc: Initial nx impl. for QueryMemory, ConnectToPort, SendSyncRequest, etc. 2017-10-14 17:30:07 -04:00
Sebastian Valle 4f7e8c6f1e Merge pull request #2793 from Subv/replyandreceive
Kernel/SVC: Partially implemented svcReplyAndReceive
2017-06-29 17:05:22 -05:00
Subv 4a8de6bb00 Kernel/SVC: Pass the current thread as a parameter to ClientSession::SendSyncRequest. 2017-06-29 12:30:34 -05:00
Subv 820509103c Kernel/SVC: Partially implemented svcReplyAndReceive.
It behaves mostly as WaitSynchronizationN with wait_all = false, except for IPC buffer translation.

The target thread of an IPC response will now wake up when responding.
IPC buffer translation is currently not implemented.
Error passing back to svcSendSyncRequest is currently not implemented.
2017-06-25 23:38:28 -05:00
Yuri Kunde Schlesner afa851d0a4 Kernel: Implement AcceptSession SVC 2017-06-23 11:26:37 -07:00
Yuri Kunde Schlesner cf12983372 Kernel: Implement CreateSessionToPort SVC 2017-06-23 11:22:02 -07:00
Yuri Kunde Schlesner 364ef24f77 Kernel: Implement CreateSession SVC 2017-06-22 00:39:27 -07:00
Yuri Kunde Schlesner ecfda5317e Kernel: Move HandleTable to a separate file 2017-05-29 17:34:39 -07:00
Yuri Kunde Schlesner 6f662625d3 Kernel: Move WaitObject to a separate file
Now that HandleTable doesn't directly depend on WaitObject anymore, this
can be separated from the main kernel.h header.
2017-05-29 16:16:46 -07:00
Yuri Kunde Schlesner ddbf9cec1b Kernel: Removed HandleTable::GetWaitObject
This isn't necessary anymore since plain Get works correctly for
WaitObjects.
2017-05-29 15:10:06 -07:00
Yuri Kunde Schlesner 467545ed48 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner 88fddcbce4 Remove ability to load symbol maps
This was now mostly unused except by thread creation, which used a
symbol of the entrypoint, if available, to name the thread.
2017-05-07 15:33:07 -07:00
Michael Theall 775ae0634e Fix OutputDebugString syscall 2017-04-01 04:09:39 -05:00
Fernando Sahmkow b302e3e34d Refined thread launch on syscore error messages 2017-03-09 08:18:18 -05:00
Subv be2b4057e5 Timers: Return an error when calling SetTimer with negative timeouts. 2017-02-21 20:51:56 -05:00
Subv a81290ffb4 Threads: Check the process' resource limit for the max allowed priority when creating a thread and remove the priority clamping code. 2017-01-11 16:38:05 -05:00
Subv fbe090645c Thread: Added priority range checking to svcSetThreadPriority and removed priority clamping code from Thread::SetPriority. 2017-01-11 16:38:04 -05:00
bunnei 961bb24cf9 Merge pull request #2410 from Subv/sleepthread
Don't yield execution in SleepThread(0) if there are no available threads to run
2017-01-06 22:01:33 -05:00
Hyper 82ed89eec2 Kernel: Fix SharedMemory objects always returning error when addr = 0 (#2404)
Closes #2400
2017-01-06 08:21:22 -05:00
Subv 6c6117868a Kernel: Don't attempt to yield execution in SleepThread(0) if there are no available threads to run.
With this we avoid an useless temporary deschedule of the current thread.
2017-01-05 19:11:34 -05:00
Subv 3ce2c24665 Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on. 2017-01-05 09:40:14 -05:00
Subv bcad1d6f12 Kernel: Use different thread statuses when a thread calls WaitSynchronization1 and WaitSynchronizationN with wait_all = true.
This commit removes the overly general THREADSTATUS_WAIT_SYNCH and replaces it with two more granular statuses:

THREADSTATUS_WAIT_SYNCH_ANY when a thread waits on objects via WaitSynchronization1 or WaitSynchronizationN with wait_all = false.

THREADSTATUS_WAIT_SYNCH_ALL when a thread waits on objects via WaitSynchronizationN with wait_all = true.
2017-01-04 15:58:50 -05:00
Subv 8503e56689 Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes 2017-01-04 15:58:48 -05:00
Subv d33885b60b Kernel/Mutex: Update a mutex priority when a thread stops waiting on it. 2017-01-04 15:58:47 -05:00
Subv 4e6369d41d Kernel/Mutex: Implemented priority inheritance.
The implementation is based on reverse engineering of the 3DS's kernel.

A mutex holder's priority will be temporarily boosted to the best priority among any threads that want to acquire any of its held mutexes.
When the holder releases the mutex, it's priority will be boosted to the best priority among the threads that want to acquire any of its remaining held mutexes.
2017-01-04 15:58:46 -05:00
Subv 90570c153b Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.
This will be useful when implementing mutex priority inheritance.
2017-01-04 15:58:45 -05:00
Subv a1718862e3 Kernel/Synch: Do not attempt a reschedule on every syscall.
Not all syscalls should cause reschedules, this commit attempts to remedy that, however, it still does not cover all cases.
2017-01-04 15:58:44 -05:00
bunnei 8cfd0762fd core: Replace "AppCore" nomenclature with just "CPU". 2016-12-22 00:27:46 -05:00
bunnei 1fd7cfb69e Address clang-format issues. 2016-12-21 23:48:14 -05:00
bunnei 5d22844f3e core: Remove HLE module, consolidate code & various cleanups. 2016-12-21 23:48:13 -05:00
bunnei d504f6cf08 core: Consolidate core and system state, remove system module & cleanups. 2016-12-21 23:29:13 -05:00
wwylele c62bc4e616 Thread: remove the thread from the thread list when exiting 2016-12-17 19:23:52 +02:00
bunnei 034651fa7f Merge pull request #2260 from Subv/scheduling
Threading: Reworked the way our scheduler works.
2016-12-16 00:41:22 -05:00
Subv 3e80a1a1c1 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:45:36 -05:00
Subv 00decc1180 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:35:01 -05:00
Subv 7066deff78 Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout. 2016-12-10 13:29:31 -05:00
Subv d4815e828d WaitSynch: Removed unused variables and reduced SharedPtr copies.
Define a variable with the value of the sync timeout error code.

Use a boost::flat_map instead of an unordered_map to hold the equivalence of objects and wait indices in a WaitSynchN call.
2016-12-09 12:23:09 -05:00
Subv 021e732815 Use std::move where appropriate. 2016-12-08 11:06:19 -05:00
Subv 06b2b80d31 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 977039e722 KServerPorts now have an HLE handler "template", which is inherited by all ServerSessions created from it. 2016-12-05 11:02:08 -05:00