Commit Graph

43 Commits

Author SHA1 Message Date
Subv
db3a525166 Kernel: Actually wake up the requested number of threads in Semaphore::Release.
Also properly keep track of data in guest memory, this fixes managing the semaphore from userland.

It was found that Semaphores are actually Condition Variables, with Release(1) and Release(-1) being equivalent to notify_one and notify_all. We should change the name of the class to reflect this.
2018-01-08 21:12:54 -05:00
bunnei
4e33b4b42f semaphore: More changes for Switch. 2018-01-07 16:52:23 -05:00
bunnei
91f10a1460 semaphore: Updates for Switch. 2018-01-06 15:55:40 -05:00
bunnei
b1d5db1cf6 Merge remote-tracking branch 'upstream/master' into nx
# Conflicts:
#	src/core/CMakeLists.txt
#	src/core/arm/dynarmic/arm_dynarmic.cpp
#	src/core/arm/dyncom/arm_dyncom.cpp
#	src/core/hle/kernel/process.cpp
#	src/core/hle/kernel/thread.cpp
#	src/core/hle/kernel/thread.h
#	src/core/hle/kernel/vm_manager.cpp
#	src/core/loader/3dsx.cpp
#	src/core/loader/elf.cpp
#	src/core/loader/ncch.cpp
#	src/core/memory.cpp
#	src/core/memory.h
#	src/core/memory_setup.h
2017-10-09 23:56:20 -04:00
Yuri Kunde Schlesner
2cdb40d709 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Subv
4251eb26ec Kernel/Semaphore: Fixed a regression in semaphore waits.
The regression was caused by a missing check in #2260.

The new behavior is consistent with the real kernel.
2017-01-05 13:00:05 -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
Yuri Kunde Schlesner
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner
396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
bunnei
71e8822d23 kernel: Fix svcWaitSynch to always acquire requested wait objects. 2015-06-16 22:34:39 -04:00
Emmanuel Gil Peyrot
b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
bunnei
0b7d2941cf Kernel: Move reschedules from SVCs to actual mechanisms that reschedule. 2015-05-20 18:05:47 -04:00
Yuri Kunde Schlesner
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
archshift
ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
Yuri Kunde Schlesner
88a4a808c6 Kernel: Stop creating useless Handles during object creation
They're finally unnecessary, and will stop cluttering the application's
handle table.
2015-02-02 15:37:09 -02:00
Yuri Kunde Schlesner
7725256f64 Explicitly instantiate constructors/destructors for Kernel objects
This should speed up compile times a bit, as well as enable more liberal
use of forward declarations. (Due to SharedPtr not trying to emit the
destructor anymore.)
2015-02-02 15:37:07 -02:00
Yuri Kunde Schlesner
d9b19be1d9 Kernel: Convert Semaphore to not use Handles 2015-01-30 11:47:05 -02:00
bunnei
f09806aed2 Kernel: Renamed some functions for clarity.
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-21 20:48:30 -05:00
bunnei
15b6a4d9ad Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void. 2015-01-21 20:47:49 -05:00
bunnei
c68eb15695 WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual. 2015-01-21 20:47:49 -05:00
bunnei
e5a9f1c644 Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks. 2015-01-21 20:47:38 -05:00
bunnei
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
bunnei
aa01c57ae9 Kernel: Separate WaitSynchronization into Wait and Acquire methods. 2015-01-21 19:10:24 -05:00
bunnei
7faf2d8e06 WaitSynchronizationN: Implement return values 2015-01-21 19:09:03 -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
9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 2015-01-09 04:02:15 -02: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
Chin
e795692614 Clean up some warnings 2014-12-20 10:03:36 -05:00
Subv
ea95876431 Kernel/Semaphore: Small style change 2014-12-13 13:40:19 -05:00
Subv
effb181888 Kernel/Semaphores: Invert the available count checking.
Same semantics, idea by @yuriks
2014-12-13 13:40:18 -05:00
Subv
5e25986235 Kernel/Semaphores: Addressed some issues. 2014-12-13 13:40:16 -05:00
Subv
cc81a510e3 Semaphore: Removed an unneeded function 2014-12-13 13:40:15 -05:00
Subv
61434651d8 Semaphores: Addressed some style issues 2014-12-13 13:40:13 -05:00
Subv
abff4a7ee2 Semaphore: Implemented the initial_count parameter. 2014-12-13 13:40:12 -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