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
2ce61344d6
Declare empty ServerSession and ClientSession constructors as default.
2016-12-02 22:58:02 -05:00
Subv
2eceee3a4c
Fixed the rebase mistakes.
2016-11-30 23:28:31 -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
c5e7e0fa26
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
c19afd2118
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
0a33d915f8
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
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
Yuri Kunde Schlesner
3174bfd50c
Merge pull request #2196 from Subv/system_mode
...
Kernel/Loader: Grab the system mode from the NCCH ExHeader.
2016-11-27 17:04:11 -08:00
Subv
1323ab2f5f
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
Subv
4ab8692475
Kernel/Events: Log an error when trying to create Pulse events and timers.
...
Related to #1904
2016-11-19 14:00:08 -05:00
Ricardo de Almeida Gonzaga
13d46f6820
Fix typos
2016-10-20 12:26:59 -02:00
wwylele
85a83158fb
move ResetType to kernel.h
2016-09-22 13:52:52 +08:00
wwylele
f69a543110
implement wait tree widget
2016-09-22 13:52:52 +08: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
05e120a4cc
arm: ResetContext shouldn't be part of ARM_Interface.
2016-09-15 17:49:30 -04:00
Lectem
a94fb932ff
fix #1942 and adds a few IPC functions for descriptors
2016-08-02 16:45:15 +02:00
Yuri Kunde Schlesner
de79b6fc48
Merge pull request #1869 from wwylele/dont-be-lazy
...
Switch context to the same thread if necessary
2016-06-28 21:03:52 -07:00
bunnei
87c07643ff
Merge pull request #1867 from mailwl/srv-update
...
srv: Update according 3dbrew
2016-06-28 18:53:10 -04:00
bunnei
8f86cc4df9
Merge pull request #1877 from wwylele/wait-fix-timeout
...
Thread: update timeout when reruning WaitSynch
2016-06-18 01:08:22 -04:00
Subv
7b445ddff0
Kernel/SVC: Implemented svcCreatePort.
2016-06-11 08:37:37 -05:00
Subv
3d9fbffbab
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
wwylele
7d56e88369
Thread: update timeout when rerunning WaitSynch
2016-06-04 09:27:16 +03:00
mailwl
e85b22320a
Fix parameter name in EnableNotification
2016-05-31 10:06:00 +03:00
wwylele
81d3462a19
Switch context on the same thread if necessary
2016-05-30 07:34:53 +03:00
bunnei
ab4b27f0f5
Merge pull request #1692 from Subv/rm_getpointer2
...
Memory: Remove most usages of GetPointer
2016-05-29 21:57:07 -04:00
MerryMage
80abe6eb08
Memory: Added necessary headers and removed unnecessary header
2016-05-26 18:55:37 +01:00
MerryMage
1ebaaf9bb1
Kernel/Thread: Remove use of Memory::GetPointer
2016-05-21 11:14:11 -05:00
bunnei
a39144050b
Merge pull request #1800 from JayFoxRox/set-fpscr
...
Set fpscr for new threads
2016-05-17 21:24:57 -04:00
Jannik Vogel
af37dd0d52
Set fpscr for new threads
2016-05-17 08:59:52 +02:00
Subv
64da2bf0cd
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
bunnei
18b517e236
Merge pull request #1689 from Subv/shmem
...
Kernel: Implemented shared memory.
2016-05-13 15:33:44 -04:00
bunnei
0d8bd3ba36
Merge pull request #1695 from Subv/tls_alloc
...
Kernel/Threads: Dynamically allocate the TLS region for threads.
2016-05-12 21:51:35 -04:00
Subv
ac2de12ed8
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
d261984f54
Kernel: Account for automatically-allocated shared memories in the amount of used linear heap memory.
2016-05-12 20:01:59 -05:00
Subv
5679d066b5
Kernel/SharedMemory: Log an error when Map fails.
2016-05-12 20:01:27 -05:00
Subv
0fb6d2a247
Kernel: Implemented shared memory permissions.
2016-05-12 20:01:26 -05:00
Subv
f72bd57212
Kernel/Memory: Remove the Shared Memory region from the legacy memory map.
2016-05-12 20:00:33 -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
Subv
42a50da76b
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
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
Subv
d192fb066d
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
bunnei
75cbfeee58
Merge pull request #1762 from bunnei/global
...
hle: Get rid of direct global access to g_reschedule
2016-05-05 21:45:57 -04:00
Mathew Maidment
aa6380e5bc
Merge pull request #1643 from MerryMage/make_unique
...
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage
a06dcfeb61
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 13:31:17 +01:00
Lioncash
04f8d39a96
session: Make helper functions constexpr
2016-03-21 04:07:03 -04:00
Lioncash
6b7ebb3f82
hle: Get rid of global access to g_reschedule
...
This shouldn't be directly exposed if there's already a partial API that operates on it.
We can just provide the rest of that API.
2016-03-21 02:57:12 -04:00
Lioncash
856a1d0386
svc: Move ResetType enum to the kernel event header
2016-03-12 21:47:41 -05:00
Lioncash
12e92f17de
svc: Make ResetType an enum class
2016-03-12 15:06:31 -05:00
Yuri Kunde Schlesner
6aa90e13f9
Memory: Do correct Phys->Virt address translation for non-APP linheap
2016-03-05 22:09:59 -08:00
MerryMage
8b00954ec7
AudioCore: Skeleton Implementation
...
This commit:
* Adds a new subproject, audio_core.
* Defines structures that exist in DSP shared memory.
* Hooks up various other parts of the emulator into audio core.
This sets the foundation for a later HLE DSP implementation.
2016-02-21 13:13:52 +00:00
MerryMage
6c71858c5c
BitField: Make trivially copyable and remove assignment operator
2016-02-12 19:51:16 +00:00
MerryMage
2b93313348
Memory: Implement MMIO
2016-01-30 18:41:04 +00: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
Subv
6cccc36505
HLE/Timers: Reset OneShot timers when they are acquired instead of when they're triggered.
...
Closes #1139
2015-12-29 20:35:25 -05:00
Subv
29032ce9b6
SVC: Fixed ArbitrateAddress to behave as it does on hardware.
...
This was verified with hwtests that i plan to upload later on.
2015-12-27 18:44:42 -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
Rohit Nirmal
32391cffdd
Silence -Wsign-compare warnings.
2015-10-06 22:16:15 -05:00
Lioncash
751fbfdcc3
general: Silence some warnings when using clang
2015-09-16 08:51:53 -04:00
Lioncash
d3efa637b4
General: Fix up doxygen comments
2015-09-10 11:20:21 -04:00
Yuri Kunde Schlesner
0ee3e2c25e
Kernel: Fix wrong linear heap base on titles using newer kernels
...
Typo which sneaked in through review on #1025
2015-08-27 23:52:40 -03:00
Yuri Kunde Schlesner
12390eb155
Kernel: Fix assertion failure when ControlMemory is called with size=0
2015-08-26 21:29:05 -03:00
Yuri Kunde Schlesner
687d973980
Core: Improve APT Shared Font hack
...
Should fix invalid read loops in some games
2015-08-26 21:28:58 -03:00
Yuri Kunde Schlesner
840b85690b
Kernel: Remove unused legacy heap MapBlock_* functions
2015-08-16 01:03:49 -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
e2c7954be5
Memory: Move address type conversion routines to memory.cpp/h
...
These helpers aren't really part of the kernel, and mem_map.cpp/h is
going to be moved there next.
2015-08-16 01:03:46 -03:00
Yuri Kunde Schlesner
a12a30c9e0
Process: Store kernel compatibility version during loading
2015-08-16 01:03:45 -03:00
Yuri Kunde Schlesner
cdeeecf080
Kernel: Properly implement ControlMemory FREE and COMMIT
2015-08-16 01:03:45 -03:00
Yuri Kunde Schlesner
306408d174
VMManager: Introduce names for used ResultCodes
2015-08-16 01:03:44 -03:00
Yuri Kunde Schlesner
b9a9ad9742
VMManager: Make LogLayout log level configurable as a parameter
2015-08-16 01:03:43 -03:00
Yuri Kunde Schlesner
785407d06f
VMManager: Change block offsets to size_t
2015-08-16 01:03:43 -03:00
Lioncash
dfb424b6d1
dyncom: Rename armdefs.h to armstate.h
2015-07-25 22:10:44 -04:00
Subv
275aaeef9c
Kernel/Scheduling: Clean up a thread's wait_objects when its scheduled.
...
They'll be reset if needed during the next svcWaitSynchronization call (if there's any pending)
2015-07-20 17:15:54 -05:00
Yuri Kunde Schlesner
dc39d06950
Ensure all kernel objects are released during shutdown
...
This commit fixes several kernel object leaks. The most severe of them
was threads not being removed from the private handle table used for
CoreTiming events. This resulted in Threads never being released, which
in turn held references to Process, causing CodeSets to never be freed
when loading other applications.
2015-07-17 02:24:13 -03:00
bunnei
b6719ec922
Merge pull request #921 from linkmauve/fix-applet
...
Fix applet includes using iwyu
2015-07-12 17:25:55 -04:00
Yuri Kunde Schlesner
d4f35fd989
Kernel: Add CodeSet case to Object::IsWaitable
2015-07-12 18:15:16 -03:00
Emmanuel Gil Peyrot
fe909b3b5a
Core: Fix applet includes using iwyu.
2015-07-12 22:10:37 +01:00
Yuri Kunde Schlesner
5c5cf2f8e0
Core: Properly configure address space when loading a binary
...
The code now properly configures the process image to match the loaded
binary segments (code, rodata, data) instead of just blindly allocating
a large chunk of dummy memory.
2015-07-11 23:54:42 -03:00
Yuri Kunde Schlesner
d9556912b4
Kernel: Remove unused member from Event
2015-07-11 23:49:51 -03:00
Emmanuel Gil Peyrot
e5fcabdd69
Core: Cleanup file_sys includes.
2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot
aea15f5c73
Core: Cleanup core includes.
2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot
596b7c4f63
Common: Cleanup key_map includes.
2015-06-28 00:36:54 +01:00
Yuri Kunde Schlesner
81488d7a6a
Add helpers to create IPC command buffer headers and descriptors
2015-06-22 19:24:19 -03:00
bunnei
71e8822d23
kernel: Fix svcWaitSynch to always acquire requested wait objects.
2015-06-16 22:34:39 -04:00
Yuri Kunde Schlesner
8a04c65e20
Merge pull request #810 from yuriks/memmap
...
Kernel: Add VMManager to manage process address spaces
2015-05-29 18:00:17 -07:00
Emmanuel Gil Peyrot
b1503b2020
Remove every trailing whitespace from the project (but externals).
2015-05-29 21:59:29 +01:00
Yuri Kunde Schlesner
0a60aa75c2
Kernel: Add VMManager to manage process address spaces
...
This enables more dynamic management of the process address space,
compared to just directly configuring the page table for major areas.
This will serve as the foundation upon which the rest of the Kernel
memory management functions will be built.
2015-05-27 03:24:12 -03:00
Emmanuel Gil Peyrot
b8f93e6b18
Kernel: Fix a warning introduced with ResourceLimit, and remove the fallback code to prevent it from happening again.
2015-05-21 20:54:49 +02:00
bunnei
0b7d2941cf
Kernel: Move reschedules from SVCs to actual mechanisms that reschedule.
2015-05-20 18:05:47 -04:00
bunnei
f0365f28c2
Merge pull request #772 from lioncash/warn
...
core/video_core: Fix a few warnings when compiling on MSVC.
2015-05-18 08:08:49 -04:00
Subv
d3634d4bf4
Core/ResourceLimits: Implemented the basic structure of ResourceLimits.
...
Implemented svcs GetResourceLimit, GetResourceLimitCurrentValues and GetResourceLimitLimitValues.
Note that the resource limits do not currently keep track of used objects, since we have no way to distinguish between an object created by the application, and an object created by some HLE module once we're inside Kernel::T::Create.
2015-05-14 22:50:13 -05:00
Yuri Kunde Schlesner
7ada357b2d
Memmap: Re-organize memory function in two files
...
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Lioncash
150e700729
process: Get rid of warnings
...
Sign mismatches and "forcing value to bool" warnings.
2015-05-14 12:59:14 -04:00
Lioncash
207087c856
thread: Fix a conditional check in Reschedule
2015-05-14 11:10:04 -04:00