Subv
43cf36a1d2
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
ca538e09f2
Thread: Added priority range checking to svcSetThreadPriority and removed priority clamping code from Thread::SetPriority.
2017-01-11 16:38:04 -05:00
Subv
6834c76aaf
Y2R: Use the proper error code when GetStandardCoefficient receives an invalid value.
2017-01-11 16:38:03 -05:00
Subv
9340e46590
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
8d3dc51f5e
Merge pull request #2409 from Subv/unused_funcs
...
Kernel: Remove some unused functions.
2017-01-05 14:17:36 -05:00
Subv
cbee82c371
Kernel: Remove some unused functions.
2017-01-05 13:17:06 -05:00
Subv
0af38a0ee3
Kernel: Removed the priority boost code for starved threads.
...
After hwtesting and reverse engineering the kernel, it was found that the CTROS scheduler performs no priority boosting for threads like this, although some other forms of scheduling priority-starved threads might take place.
For example, it was found that hardware interrupts might cause low-priority threads to run if the CPU is preempted in the middle of an SVC handler that deschedules the current (high priority) thread before scheduling it again.
2017-01-05 13:12:39 -05:00
Subv
2ff5768bc1
Kernel: Implemented Pulse event and timers.
...
Closes #1904
2017-01-05 13:06:17 -05:00
Subv
66020871a4
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
Sebastian Valle
4a6761062d
Merge pull request #2393 from Subv/synch
...
Kernel: Mutex priority inheritance and synchronization improvements.
2017-01-05 12:55:01 -05:00
Subv
c2ae798b33
Kernel: Add some asserts to enforce the invariants in the scheduler.
2017-01-05 09:40:18 -05:00
Subv
8d62714c87
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
cd9ba6b5df
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
cdca3666da
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
901d9e5c27
Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes
2017-01-04 15:58:48 -05:00
Subv
b67ee215dc
Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.
2017-01-04 15:58:47 -05:00
Subv
896e278c28
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
10e7ec47e2
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
cb21b68ddc
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
Sebastian Valle
0f3144062e
Merge pull request #2386 from bunnei/fix-bg-color
...
config: SDL: Move background color setting to correct section.
2016-12-30 09:51:56 -05:00
Sebastian Valle
edef7bf840
Merge pull request #2338 from wwylele/fix-dead
...
Kernel: remove object's waiting thread if it is dead
2016-12-16 08:48:22 -05:00
Sebastian Valle
8f8024f5f9
Merge pull request #2330 from lioncash/pragma
...
core: Add missing #pragma once directives where applicable
2016-12-15 16:06:43 -05:00
Sebastian Valle
8d40ca503f
Merge pull request #2317 from yuriks/vertex-copy
...
VideoCore: Eliminate an unnecessary copy in the drawcall loop
2016-12-15 00:16:04 -05:00
Subv
517a16acb8
Fixed the codestyle to match our clang-format rules.
2016-12-14 12:45:36 -05:00
Subv
c6a9bce77a
Fixed the codestyle to match our clang-format rules.
2016-12-14 12:35:01 -05:00
Sebastian Valle
6ac80feff1
Merge pull request #2166 from endrift/clang-detect
...
CMakeLists: Autodetect clang and only then use libc++
2016-12-13 12:46:42 -05:00
Sebastian Valle
155251f900
Merge pull request #2315 from JamePeng/fix-gsp_gpu-code
...
Minor amendment of GSP_GPU::ImportDisplayCaptureInfo code
2016-12-13 07:32:14 -05:00
Sebastian Valle
96361152c8
Merge pull request #2275 from jbeich/pthread
...
Unbreak QT-only build after 75ee2f8c67
2016-12-11 14:45:35 -05:00
Sebastian Valle
254203182d
Merge pull request #2267 from JayFoxRox/fix-mingw-cc
...
Support mingw cross-compilation
2016-12-11 14:44:21 -05:00
Sebastian Valle
ae881017a7
Merge pull request #2154 from mailwl/apt-getstartupargument
...
APT::GetStartupArgument: force clear startup argument
2016-12-11 14:40:44 -05:00
Subv
42fcf27f5c
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
9196e713f4
Moved the HLE command buffer translation task to ServerSession instead of the HLE handler superclass.
2016-12-09 12:52:12 -05:00
Subv
72d15ecf9d
Kernel/IPC: Small codestyle cleanup
2016-12-09 12:39:12 -05:00
Subv
93c592f312
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
Sebastian Valle
d106142067
Merge pull request #2280 from Subv/citrace_size
...
Fixed the gpu command list size when creating CiTraces.
2016-12-08 15:45:53 -05:00
Subv
4bed83417c
Fixed the gpu command list size when creating CiTraces.
2016-12-08 15:21:02 -05:00
Subv
ee6c03dfc6
Added a framework for partially handling Session disconnections.
...
Further implementation will happen in a future commit.
Fixes a regression.
2016-12-08 15:01:10 -05:00
Subv
41e5e714d5
Use std::move where appropriate.
2016-12-08 11:06:19 -05:00
Subv
0076acc3a9
Use boost remove_erase_if instead of the erase-remove idiom
2016-12-06 19:31:53 -05:00
Subv
415f13987e
Improved the algorithm for GetHighestPriorityReadyThread.
2016-12-06 19:15:32 -05:00
Subv
eb8b765178
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
209e6b060b
HLE: Use a member variable instead of a virtual function to retrieve the max number of sessions that can be connected to an HLE service at the same time.
2016-12-05 13:44:41 -05:00
Subv
7214f4986e
Split SessionRequestHandler::HandleSyncRequest into HandleSyncRequest, TranslateRequest and HandleSyncRequestImpl.
...
HandleSyncRequest now takes care of calling the command buffer translate function before actually invoking the command handler for HLE services.
2016-12-05 12:05:00 -05:00
Subv
824692849b
Kernel: Remove the Redirection handle type.
2016-12-05 11:13:22 -05:00
Subv
7a18725662
KServerPorts now have an HLE handler "template", which is inherited by all ServerSessions created from it.
2016-12-05 11:02:08 -05:00
Subv
7fd9b055bb
Dynarmic: Update dynarmic to version
...
54d051977f7a6af9c7596ba6a4e6eb467bd1e0bc
dynarmic log:
54d0519 emit_x64: Use movdqa instead of movaps in EmitPackedSubU8
52e1445 Implement USUB8:33 2016 +0000
5c1aab1 Implement CLZ
1a1646d Implement UADD8
7cad694 IR: Implement new pseudo-operation GetGEFromOp
370f654 fuzz_arm: Add tests for parallel add/subtract (modulo)
25f21b5 emit_x64: Inline nzcv computation into EmitFPCompare32 and EmitFPCompare64
52fdec5 CMakeLists: Add support for LLVM on Windows
cede5e4 emit_x64: Use xorps/xorpd when argument to TransferToFP32/TransferToFP64 is an immediate zero
e166965 Implement VCMP2:33 2016 +0000
f2fe376 Support 64-bit immediates
ff00b8c Document register allocator and return stack buffer optimization
95f34c6 reg_alloc: Remove unnecessary breaks after returns (#54 )
dc9707e externals: Update xbyak to 5.32
de1f831 microinstruction: Make use_count private (#53 )
3621a92 reg_alloc: Register allocator related constraints belong with the rest of the register allocator
2016-12-04 21:40:12 -05:00
Subv
7e5b90a04b
Threading: Added some utility functions and const correctness.
2016-12-04 09:58:36 -05:00
Subv
e3486361fd
Threading: Reworked the way our scheduler works.
...
Threads will now be awakened when the objects they're waiting on are signaled, instead of repeating the WaitSynchronization call every now and then.
The scheduler is now called once after every SVC call, and once after a thread is awakened from sleep by its timeout callback.
This new implementation is based off reverse-engineering of the real kernel.
See https://gist.github.com/Subv/02f29bd9f1e5deb7aceea1e8f019c8f4 for a more detailed description of how the real kernel handles rescheduling.
2016-12-03 22:38:14 -05:00
Subv
039c8a8fc5
Declare empty ServerSession and ClientSession constructors as default.
2016-12-02 22:58:02 -05:00
Subv
a15e34040a
Threads do not wait for the server endpoint to call AcceptSession before returning from a ConnectToPort or GetServiceHandle call.
2016-12-01 10:47:06 -05:00
Subv
694df935a6
Fixed the rebase mistakes.
2016-11-30 23:28:31 -05:00
Subv
20f90896af
A bit of a redesign.
...
Sessions and Ports are now detached from each other.
HLE services are handled by means of a SessionRequestHandler class, Interface now inherits from this class.
The File and Directory classes are no longer kernel objects, but SessionRequestHandlers instead, bound to a ServerSession when requested.
File::OpenLinkFile now creates a new session pair and binds the File instance to it.
2016-11-30 23:12:35 -05:00
Subv
856f8029d7
IPC/HLE: Associate the ClientSessions with their parent port's HLE interface if it exists.
...
Pass the triggering ServerSession to the HLE command handler to differentiate which session caused the request.
2016-11-30 23:04:00 -05:00
Subv
11daab060a
Kernel/HLE: Service::Interface no longer inherits from any Kernel object, and is now its own standalone class.
...
Interface is now used by aggregation in ClientPort, to forward service commands to their HLE implementation if needed.
2016-11-30 23:03:59 -05:00
Subv
d0093a8b40
fixup! Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
2016-11-30 23:02:06 -05:00
Subv
0d2f2880b9
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
...
All handles obtained via srv::GetServiceHandle or svcConnectToPort are references to ClientSessions.
Service modules will wait on the counterpart of those ClientSessions (Called ServerSessions) using svcReplyAndReceive or svcWaitSynchronization[1|N], and will be awoken when a SyncRequest is performed.
HLE Interfaces are now ClientPorts which override the HandleSyncRequest virtual member function to perform command handling immediately.
2016-11-30 23:02:05 -05:00
Sebastian Valle
a39f8f5338
Merge pull request #2243 from MerryMage/r15
...
dynarmic: Fix ABI violation
2016-11-30 17:41:20 -05:00
Subv
dfd1868ed9
ClangFormat: Fixed the clang-format errors
2016-11-30 09:37:37 -05:00
Sebastian Valle
01e8ac1fa4
Merge pull request #1820 from mailwl/service-ver
...
Set client SDK version to Service APIs
2016-11-30 08:04:23 -05:00
Subv
c9b02effb9
Build: Fixed a few warnings.
2016-11-29 16:51:53 -05:00
Sebastian Valle
8eaf432bee
Merge pull request #2132 from wwylele/fix-fs-err
...
Correct FS error codes & add path boundary checks
2016-11-27 18:56:56 -05:00
Subv
7199214c55
Kernel/Loader: Grab the system mode from the NCCH ExHeader.
...
3dsx and elf files default to system mode 2 (96MB allocated to the application).
This allows Home Menu to boot without modifications.
Closes #1849
2016-11-27 18:03:48 -05:00
Subv
487a9a37ba
RasterizerGL: Use GL_TRUE and 0xFF in the stencil and depth masks instead of simply true and -1
2016-11-27 13:09:11 -05:00
Subv
84dcb45053
Rasterizer/Memfill: Set the correct stencil write mask when clearing the stencil buffer.
2016-11-27 12:16:10 -05:00
Sebastian Valle
8b4835a14a
Merge pull request #2168 from mailwl/mic
...
MIC_U: Stub service funcions
2016-11-27 00:19:33 -05:00
Subv
8369e7b59f
Kernel/Loader: Grab the system mode from the NCCH ExHeader.
...
3dsx and elf files default to system mode 2 (96MB allocated to the application).
This allows Home Menu to boot without modifications.
Closes #1849
2016-11-19 20:40:04 -05:00
Sebastian Valle
b30fcdfd30
Merge pull request #2192 from Subv/applet_enums
...
APT/Applets: Renamed the members of the SignalType enum.
2016-11-19 20:30:26 -05:00
Subv
3d7a574e3f
GPU/CiTrace: Avoid calling GetTextures() when not necessary.
2016-11-19 19:27:00 -05:00
Subv
3841d6807a
Kernel/Events: Log an error when trying to create Pulse events and timers.
...
Related to #1904
2016-11-19 14:00:08 -05:00
Subv
e4e38e815b
APT/Applets: Renamed the members of the SignalType enum.
...
Names now make sense and match 3dbrew.
2016-11-19 13:42:07 -05:00
Sebastian Valle
5b03774ec3
Merge pull request #1921 from Subv/fs_funcs
...
HLE/FS: Document some command parameters and implemented command 0x08560240
2016-07-05 14:45:40 -07:00
Sebastian Valle
8eea45395b
Merge pull request #1850 from mailwl/erreula
...
HLE/Applets: Implement ErrEula applet
2016-07-04 08:52:42 -07:00
Subv
f4617ecd24
HLE/FS: Document some command parameters and implemented command 0x08560240 (CreateLegacySystemSaveData)
2016-07-03 13:42:52 -05:00
Sebastian Valle
4fa442e7c7
Merge pull request #1935 from wwylele/fix-result-module
...
Result: Update the ErrorModule enum
2016-07-03 07:24:29 -07:00
Subv
8548bcf697
PICA: Implement scissor test
2016-06-27 21:14:13 -07:00
Subv
c25dc87890
Kernel/SVC: Implemented svcCreatePort.
2016-06-11 08:37:37 -05:00
Subv
e717d569af
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
Subv
b1b3b24c3c
Memory: Handle RasterizerCachedMemory and RasterizerCachedSpecial page types in the memory block manipulation functions.
2016-05-28 13:52:50 -05:00
Subv
03c9f30ba0
Memory: Make ReadBlock and WriteBlock accept void pointers.
2016-05-28 13:52:49 -05:00
Subv
5bda6ddc07
SOC_U: Remove usage of GetPointer
2016-05-28 13:52:49 -05:00
Subv
751115d995
Memory: Fixed a regression caused by #1695 and #1689 .
...
Reserve enough space in the vector that holds the linear heap memory to prevent relocations of the backing memory when growing too much.
Closes #1790
2016-05-14 11:24:19 -05:00
Subv
ff3b1bf8fa
HLE/Applets: Give each applet its own block of heap memory, and use that when creating the framebuffer shared memory block.
2016-05-12 20:01:59 -05:00
Subv
4c39ed52ae
Kernel: Account for automatically-allocated shared memories in the amount of used linear heap memory.
2016-05-12 20:01:59 -05:00
Subv
1fa691c8ac
APT: Move the shared font loading and relocation functions to their own subdirectory services/apt/bcfnt.
2016-05-12 20:01:54 -05:00
Subv
79d5e41847
Kernel/SharedMemory: Log an error when Map fails.
2016-05-12 20:01:27 -05:00
Subv
4745e9b917
Kernel: Implemented shared memory permissions.
2016-05-12 20:01:26 -05:00
Subv
9d5298b38d
APT: Implement relocating the shared font to its true address.
2016-05-12 20:01:20 -05:00
Subv
75bb1e322a
Kernel/Memory: Remove the Shared Memory region from the legacy memory map.
2016-05-12 20:00:33 -05:00
Subv
5e39c5f6a5
Kernel/SharedMemory: Properly implemented shared memory support.
...
Applications can request the kernel to allocate a piece of the linear heap for them when creating a shared memory object.
Shared memory areas are now properly mapped into the target processes when calling svcMapMemoryBlock.
Removed the APT Shared Font hack as it is no longer needed.
2016-05-12 20:00:32 -05:00
Subv
92f55aff1c
Kernel/SVC: Fixed the register order for svcCreateMemoryBlock.
...
R0 is used as the last parameter instead of R4.
2016-05-12 20:00:29 -05:00
Subv
bfee7941e3
Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1).
...
We do not currently implement any cores other than the AppCore (Core 0).
2016-05-07 10:23:03 -05:00
Subv
d9baef11f2
Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.
...
Each thread gets a 0x200-byte area from the 0x1000-sized page, when all 8 thread slots in a single page are used up, the kernel allocates a new page to hold another 8 entries.
This is consistent with what the real kernel does.
2016-05-07 10:18:47 -05:00
Subv
0ae7542a1c
HLE/Applets: Use the correct size for the framebuffer SharedMemory in the swkbd and MiiSelector applets.
2016-05-07 10:01:40 -05:00
Sebastian Valle
3e2da12e39
Merge pull request #1706 from mailwl/mii-selector
...
Layout Mii parameters input/output, and return success as result of applet work
2016-05-05 12:56:36 -07:00
Subv
b94133bd71
HLE/FS: Change the error code returned when an ExtSaveData archive is not found.
...
This allows Fire Emblem to boot again.
2016-03-20 14:52:50 -05:00
Subv
438f0cb335
HLE/FS: Corrected some style concerns.
2016-03-20 14:52:26 -05:00
Subv
0e84970817
HLE/FS: Fixed creating the config savefile when it doesn't exist.
...
This fixes a regression.
2016-03-20 14:30:03 -05:00
Subv
9773d90363
HLE/FS: Implemented GetFormatInfo
...
Format information is currently only implemented for the ExtSaveData, SharedExtSaveData and SaveData archives, the information is stored in a file alongside the root folder of the archive.
2016-03-20 14:30:01 -05:00
Subv
90d5e8b597
HLE/FS: Don't return an error when deleting the ExtSaveData if it does not exist.
2016-03-20 14:28:24 -05:00
Subv
6983167205
HLE/FS: Return the proper error codes when opening files.
2016-03-20 14:28:22 -05:00