Commit graph

176 commits

Author SHA1 Message Date
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
bunnei
cda7210fad Merge pull request #2260 from Subv/scheduling
Threading: Reworked the way our scheduler works.
2016-12-16 00:41:22 -05: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
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
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
Subv
f9bcf89510 Use std::move where appropriate. 2016-12-08 11:06:19 -05:00
Subv
c93c5a72bb 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
dd8887c8cf 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
bdad00c73f Threading: Added some utility functions and const correctness. 2016-12-04 09:58:36 -05:00
Subv
8634b8cb83 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
ed210c32b3 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
009b15b3aa 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
073653e858 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
wwylele
1c0179ad1b name objects 2016-09-22 13:52:52 +08: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
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
Subv
7b445ddff0 Kernel/SVC: Implemented svcCreatePort. 2016-06-11 08:37:37 -05:00
wwylele
86ea7995ad SVC::WaitSynchronizationN: Reschedule at the end 2016-05-21 18:29:38 +03:00
Jannik Vogel
af37dd0d52 Set fpscr for new threads 2016-05-17 08:59:52 +02:00
Subv
0fb6d2a247 Kernel: Implemented shared memory permissions. 2016-05-12 20:01:26 -05:00
Subv
1bd0cf542f 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
bunnei
282a2ad539 Merge pull request #1766 from Subv/log_cpu
Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1)
2016-05-08 15:03:08 -04:00
Subv
5b7f86708c 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
bunnei
15d21c0dc5 Merge pull request #1647 from mailwl/acu-closeasync
ac:u: stub CloseAsync; align memory size in svc:GetProcessInfo(type=2)
2016-04-30 00:11:08 -04:00
Yuri Kunde Schlesner
e3a8292495 Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-29 00:07:10 -07:00
mailwl
bd8cc69893 ac:u: stub CloseAsync; check memory size aling in svc:GetProcessInfo(type=2) 2016-04-21 10:34:45 +03:00
Lioncash
856a1d0386 svc: Move ResetType enum to the kernel event header 2016-03-12 21:47:41 -05:00
Kloen
1149e66820 ThreadProcessorId_All on SVC::CreateThread 2016-03-01 12:03:32 +01:00
Subv
d90d5a0ee6 HLE/SVC: Implement UnmapMemoryBlock.
This implementation will need to be (almost completely) changed when we implement multiprocess support.
2016-01-14 11:29:19 -05:00
Lioncash
270cbb0119 svc: Remove superfluous printf argument 2015-12-25 14:21:45 -05:00
Lioncash
84afaaa10c svc: Fix compilation with LOG_TRACE enabled 2015-12-12 18:14:36 -05:00
Yuri Kunde Schlesner
84a22cb594 Kernel: Implement svcGetSystemInfo
This makes smealum/ctrulib@b96dd51d33 work
with Citra.
2015-11-30 19:49:44 -08:00
Yuri Kunde Schlesner
18c1c39d5e SVC: Advance time when calling GetSystemTick to escape busy-wait loops
Cubic Ninja waited for the frame to end by spinning on a loop calling
GetSystemTick while doing nothing else. Since GetSystemTick doesn't
cause a reschedule (which advances time), this meant that very little
emulated time would pass inside that loop, causing the game to spend
most of the frame burning away CPU.
2015-08-30 00:07:02 -03:00
Yuri Kunde Schlesner
0fcabd2b11 Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
2015-08-24 22:16:28 -03:00
Yuri Kunde Schlesner
14eca982f4 Kernel: Implement svcGetProcessInfo in a basic way
This also adds some basic memory usage accounting. These two types are
used by Super Smash Bros. during startup.
2015-08-16 01:03:48 -03:00
Yuri Kunde Schlesner
74d4bc0af1 Kernel: Add more infrastructure to support different memory layouts
This adds some structures necessary to support multiple memory regions
in the future. It also adds support for different system memory types
and the new linear heap mapping at 0x30000000.
2015-08-16 01:03:47 -03:00
Yuri Kunde Schlesner
69c3021a8d Move core/mem_map.{cpp,h} => core/hle/kernel/memory.{cpp,h} 2015-08-16 01:03:46 -03:00
Yuri Kunde Schlesner
cdeeecf080 Kernel: Properly implement ControlMemory FREE and COMMIT 2015-08-16 01:03:45 -03:00
Yuri Kunde Schlesner
24d7c05c8d Merge pull request #888 from zawata/Warning-Fixes-2
Core\HLE : Fix Warning
2015-07-25 12:55:34 -07:00
Lioncash
c2689b8c2c dyncom: Pass SVC immediates directly.
Previously it would just re-read the already decoded instruction and extract the immediate value.
2015-07-21 03:56:29 -04:00
Subv
83fa3f977d Kernel/SVC: Implemented svcQueryProcessMemory 2015-07-17 14:55:35 -05:00
Subv
9e2962081a Kernel/SVC: Implemented svcQueryMemory. 2015-07-17 11:03:56 -05:00
zawata
f723a498e7 Core\HLE : Fix Warning
"signed/unsigned mismatch"
2015-07-17 00:50:53 -07: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