Commit graph

1179 commits

Author SHA1 Message Date
Subv
fc2266130b 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
Sebastian Valle
f20d872643 Merge pull request #2393 from Subv/synch
Kernel: Mutex priority inheritance and synchronization improvements.
2017-01-05 12:55:01 -05:00
Subv
dda4ec93be Kernel: Add some asserts to enforce the invariants in the scheduler. 2017-01-05 09:40:18 -05:00
Subv
7f1dca8cd2 Kernel: Remove a thread from all of its waiting objects' waiting_threads list when it is awoken.
This fixes a potential bug where threads would not get removed from said list if they awoke after waiting with WaitSynchronizationN with wait_all = false
2017-01-05 09:40:15 -05:00
Subv
fd95b6ee26 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
cef5f45de2 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
d3ff5b91e1 Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes 2017-01-04 15:58:48 -05:00
Subv
b6a0355568 Kernel/Mutex: Update a mutex priority when a thread stops waiting on it. 2017-01-04 15:58:47 -05:00
Subv
7abf185390 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
e6a7723f2f 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
38a90882a4 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
Jonathan Hao
c18cb1b192 Fix some warnings (#2399) 2017-01-04 13:48:29 -03:00
mailwl
f2985f7080 Service/NFC: stub GetTagInRangeEvent
Fix Fatal Error in Mini-Mario & Friends - amiibo Challenge
2016-12-30 09:40:54 +03:00
bunnei
f556d6ee90 Merge pull request #2240 from wwylele/auto-region
Config: auto-select region and language
2016-12-29 22:09:01 -05:00
wwylele
f927beb5e2 Core: remove unused hle.cpp 2016-12-27 10:27:48 +02:00
MerryMage
64f98f4d0f core: Move emu_window and key_map into core
* Removes circular dependences (common should not depend on core)
2016-12-23 13:42:39 +00:00
mailwl
069a88dad7 Service/NWM: add nwm services 2016-12-22 22:51:27 +03:00
bunnei
aa47af7fb6 Merge pull request #2343 from bunnei/core-cleanup
Core: Top-level consolidate & misc cleanup
2016-12-22 11:47:44 -05:00
bunnei
17d740299a Merge pull request #2285 from mailwl/csnd-format
csnd:SND: Reformat source code
2016-12-22 00:47:50 -05:00
bunnei
8b1e269e58 ThreadContext: Move from "core" to "arm_interface". 2016-12-22 00:27:49 -05:00
bunnei
e26fbfd1d7 core: Replace "AppCore" nomenclature with just "CPU". 2016-12-22 00:27:46 -05:00
bunnei
5ac5cbeab7 Address clang-format issues. 2016-12-21 23:48:14 -05:00
bunnei
4fc8b8229e core: Remove HLE module, consolidate code & various cleanups. 2016-12-21 23:48:13 -05:00
bunnei
232ef55c1a core: Consolidate core and system state, remove system module & cleanups. 2016-12-21 23:29:13 -05:00
wwylele
5728e42634 Thread: remove the thread from the thread list when exiting 2016-12-17 19:23:52 +02:00
wwylele
4c9b80cee3 Kernel: remove object's waiting thread if it is dead 2016-12-16 12:33:18 +02:00
bunnei
cda7210fad Merge pull request #2260 from Subv/scheduling
Threading: Reworked the way our scheduler works.
2016-12-16 00:41:22 -05:00
Yuri Kunde Schlesner
2427a5e976 Merge pull request #2328 from wwylele/fix-trace
Fix debug build from #2249
2016-12-15 21:06:12 -08:00
Yuri Kunde Schlesner
63e8174caa Merge pull request #2320 from mailwl/cecd-update
Service/CECD: Add cecd:ndm service
2016-12-15 21:01:51 -08:00
bunnei
9dc43d3720 Merge pull request #2331 from lioncash/trunc
hid: Get rid of a double -> float truncation warning
2016-12-15 17:45:24 -05:00
wwylele
a7cd452ea1 FS: fix debug build from #2249 2016-12-16 00:22:36 +02:00
Sebastian Valle
3e4cc6b3d2 Merge pull request #2330 from lioncash/pragma
core: Add missing #pragma once directives where applicable
2016-12-15 16:06:43 -05:00
Lioncash
3faa675d6b hid: Get rid of a double -> float truncation warning
float literals need to have the 'f' prefix.
2016-12-15 15:52:15 -05:00
Lioncash
2f3c1bdfb4 core: Add missing #pragma once directives where applicable 2016-12-15 15:40:51 -05:00
Lioncash
d467b5ce4f act: Fix docstring typo
These aren't the AM services.
2016-12-15 14:51:45 -05:00
bunnei
bdb6956879 Merge pull request #2314 from mailwl/account
Service/ACT: move ACT services to folder
2016-12-15 13:51:29 -05:00
mailwl
7f27be1521 Service/CECD: Add cecd:ndm service 2016-12-15 09:52:40 +03:00
Yuri Kunde Schlesner
905fc92ce1 Merge pull request #2249 from Subv/sessions_v3
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
2016-12-14 20:35:33 -08:00
Subv
016307ae65 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:45:36 -05:00
Subv
5b1edc6ae7 Fixed the codestyle to match our clang-format rules. 2016-12-14 12:35:01 -05:00
mailwl
5dea1faedd Service/ACT: move ACT services to folder 2016-12-14 09:05:46 +03:00
JamePeng
ac2ed18a3b Minor amendment of GSP_GPU::ImportDisplayCaptureInfo code 2016-12-13 17:01:53 +08:00
mailwl
1238e48c58 csnd:SND reformat source code 2016-12-12 21:19:36 +03:00
mailwl
e53cd12c42 APT::GetStartupArgument: force clear startup argument 2016-12-11 22:36:12 +03:00
Lioncash
963aedd8cc Add all services to the Service namespace
Previously there was a split where some of the services were in the
Service namespace and others were not.
2016-12-11 00:07:27 +00:00
Subv
406907d570 Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout. 2016-12-10 13:29:31 -05:00
bunnei
6edb024d38 Merge pull request #2291 from lioncash/svc
service: Add the cfg:nor service
2016-12-09 14:15:20 -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
deb83c9fc5 Kernel/IPC: Small codestyle cleanup 2016-12-09 12:39:12 -05:00
Subv
17b29d8865 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