Commit Graph

523 Commits

Author SHA1 Message Date
bunnei 76a0814142 hle: kernel: svc: Migrate GetProcessId, CancelSynchronization, SetThreadActivity. 2021-05-05 16:40:51 -07:00
bunnei 269d233a94 hle: kernel: svc_results: Update naming.. 2021-05-05 16:40:51 -07:00
bunnei 2e8d6fe9a0 hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject. 2021-05-05 16:40:51 -07:00
bunnei 89edbe8aa2 hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps. 2021-05-05 16:40:51 -07:00
bunnei addc0bf037 hle: kernel: Migrate KEvent to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei 086db71e94 hle: kernel: Migrate KSharedMemory to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei 7ccbdd4d8d hle: kernel: Migrate KProcess to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei 5e5933256b hle: kernel: Refactor IPC interfaces to not use std::shared_ptr. 2021-05-05 16:40:50 -07:00
bunnei da7e9553de hle: kernel: Migrate more of KThread to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei 6fca1c82fd hle: kernel: svc: Migrate GetThreadPriority, StartThread, and ExitThread. 2021-05-05 16:40:50 -07:00
bunnei de4746ff69 hle: kernel: svc: Migrate CreateThread. 2021-05-05 16:40:50 -07:00
ameerj 2067115c78 k_resource_limit: Minor cleanup of member variables/headers 2021-04-14 00:40:33 -04:00
Lioncash 55fc808d64 svc: Expand SVC tables
12.x expanded the range of SVC entries from 0x7F to 0xBF (with all new
entries being unused), so we can expand it to also match.
2021-04-07 00:55:33 -04:00
bunnei 47af34003b hle: kernel: KThread: Rework dummy threads & fix memory leak.
- Dummy threads are created on thread local storage for all host threads.
- Fixes a leak by removing creation of fibers, which are not applicable here.
2021-03-05 17:10:57 -08:00
bunnei a5ab85ac37
Revert "core: Switch to unique_ptr for usage of Common::Fiber." 2021-03-05 17:08:17 -08:00
bunnei 51fb0a6f96 core: Switch to unique_ptr for usage of Common::Fiber.
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
2021-02-27 11:56:04 -08:00
bunnei 93e20867b0 hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable. 2021-02-18 16:16:25 -08:00
bunnei 65e0178cc0 hle: kernel: Migrate to KMemoryBlock, KMemoryBlockManager, and others. 2021-02-18 16:16:25 -08:00
bunnei 1d162f28d1 hle: kernel: Migrate MemoryLayout to KMemoryLayout. 2021-02-18 16:16:25 -08:00
bunnei 0d62f30b00 hle: kernel: Rename SharedMemory to KSharedMemory. 2021-02-18 16:16:12 -08:00
ameerj ec9b6641b1 kernel: More accurately reserve and release resources 2021-02-12 19:05:24 -05:00
ameerj 5fa6b15215 kernel: KScopedReservation implementation
This implements KScopedReservation, allowing resource limit reservations to be more HW accurate, and release upon failure without requiring too many conditionals.
2021-02-12 18:57:34 -05:00
Chloe 37939482fb
kernel: Unify result codes (#5890)
* kernel: Unify result codes

Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.

* oops

* rename errors to svc_results
2021-02-12 15:43:01 -08:00
Lioncash 75a60a6e22 svc: Provide more detailed error logs for svc functions
Allows SVC calls to have much more informative information during error
cases. This also doesn't hide control flow returns from the reader.
2021-02-06 02:03:40 -05:00
bunnei eba3c59a61 hle: kernel: svc: Cleanup KEvent/KReadableEvent/KWritableEvent SVCs. 2021-02-05 14:03:36 -08:00
bunnei ff3c7c068b hle: kernel: Reimplement KReadableEvent and KWritableEvent. 2021-02-05 14:03:32 -08:00
bunnei 3f942c01f0 hle: kernel: Rename WritableEvent to KWritableEvent. 2021-02-05 14:00:36 -08:00
bunnei e86a7e3691 hle: kernel: Rename ReadableEvent to KReadableEvent. 2021-02-05 14:00:36 -08:00
Chloe Marcec 2c6e940493 Simplify limitableresource names 2021-02-03 12:55:16 +11:00
Chloe Marcec 3bf62c7a8a Move to GetGlobalTimeNs, fix GetTotalPhysicalMemoryAvailable 2021-01-30 21:03:10 +11:00
Chloe Marcec 3be1a565f8 kernel: Rewrite resource limit to be more accurate
Matches closer to hardware
2021-01-30 20:40:49 +11:00
bunnei 3856564727 hle: kernel: process: Add state lock. 2021-01-28 21:42:26 -08:00
bunnei cdd14b03e5 hle: kernel: Recode implementation of KThread to be more accurate. 2021-01-28 21:42:26 -08:00
bunnei 4dbf3f4880 hle: kernel: KThread: Clean up thread priorities. 2021-01-28 21:42:25 -08:00
bunnei 1e55498110 hle: kernel: KThread: Reorganize thread priority defaults. 2021-01-28 21:42:25 -08:00
bunnei 0530292b97 hle: kernel: KThread: Fix ThreadType definition. 2021-01-28 21:42:25 -08:00
bunnei c0d3aef28c core: hle: kernel: Rename Thread to KThread. 2021-01-28 21:42:25 -08:00
bunnei 03dfc8d8e7 hle: kernel: thread: Preserve thread wait reason for debugging only.
- This is decoupled from core functionality and used for debugging only.
2021-01-11 14:23:17 -08:00
bunnei 912dd50146 core: hle: Integrate new KConditionVariable and KAddressArbiter implementations. 2021-01-11 14:23:16 -08:00
bunnei c3c43e32fc hle: kernel: thread: Replace ThreadStatus/ThreadSchedStatus with a single ThreadState.
- This is how the real kernel works, and is more accurate and simpler.
2021-01-11 14:23:16 -08:00
bunnei 35c3c078e3 core: hle: kernel: Update KSynchronizationObject. 2021-01-11 14:23:16 -08:00
ameerj 0383363a8f svc: demote SleepThread log to LOG_TRACE
This log is called often, and introduces a lot of noise when debug logging is enabled, making it difficult to see other debug logs.
2020-12-29 14:01:56 -05:00
bunnei 1279c7ce7a
Merge pull request #5131 from bunnei/scheduler-rewrite
Rewrite Kernel scheduler based on Atmosphere
2020-12-20 20:57:54 -08:00
Lioncash 2de124e223 svc: Remove unnecessary casts
Simplifies and removes some casts. In all cases, these were generally
widening from a 32-bit unsigned type to a 64-bit unsigned type, so no
information would be lost from the conversion.
2020-12-08 15:42:10 -05:00
bunnei ccce6cb3be hle: kernel: Migrate to KScopedSchedulerLock. 2020-12-06 00:03:24 -08:00
bunnei 4756cb203e hle: kernel: Separate KScopedSchedulerLockAndSleep from k_scheduler. 2020-12-06 00:03:24 -08:00
bunnei 9e29e36a78 hle: kernel: Rewrite scheduler implementation based on Mesopshere. 2020-12-06 00:03:24 -08:00
bunnei 39d356782e hle: kernel: svc: Remove reschedule on svcBreak.
- This breaks things, and is unnecessary, since emulation will be done at this point.
2020-12-06 00:03:24 -08:00
bunnei 493263f415 hle: kernel: svc: Remove unnecessary hack in svcSleep. 2020-12-06 00:03:24 -08:00
bunnei e18ee8d681 hle: kernel: Port KAffinityMask from Mesosphere. 2020-12-06 00:03:24 -08:00
bunnei 7b642c7781 hle: kernel: multicore: Replace n-JITs impl. with 4 JITs. 2020-11-29 01:31:51 -08:00
Lioncash 874be0e3e1 svc: Remove unnecessary [[maybe_unused]] tag
The parameter is used in this function, so this suppression isn't
necessary.
2020-11-23 10:17:20 -05:00
bunnei 3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash ec2a6e5ba8 kernel: Remove all dependencies on the global system instance
With this, the kernel finally doesn't depend directly on the global
system instance anymore.
2020-09-14 14:03:13 -04:00
Lioncash 2bab07c367 kernel: Remove unused variables
Resolves some compiler warnings in the Linux build.
2020-07-16 14:17:50 -04:00
Fernando Sahmkow 4105f38022 SVC: Implement 32-bits wrappers and update Dynarmic. 2020-06-27 11:36:27 -04:00
Fernando Sahmkow ce350e7ce0 SVC: Add GetCurrentProcessorNumber32, CreateTransferMemory32, SetMemoryAttribute32 2020-06-27 11:36:27 -04:00
Fernando Sahmkow 22ceaca2f4 SVC: Add GetThreadPriority32 & SetThreadPriority32 2020-06-27 11:36:25 -04:00
Fernando Sahmkow 7fd7d05838 Common/Kernel: Corrections and small bug fixing. 2020-06-27 11:36:21 -04:00
Fernando Sahmkow 48fa3b7a0f General: Cleanup legacy code. 2020-06-27 11:36:05 -04:00
Fernando Sahmkow c8bf47dcfb Kernel/svcBreak: Implement CacheInvalidation for Singlecore and correct svcBreak. 2020-06-27 11:36:04 -04:00
Fernando Sahmkow 19165cd859 HLE_IPC: Correct HLE Event behavior on timeout. 2020-06-27 11:36:03 -04:00
Fernando Sahmkow f5e32935ca SingleCore: Use Cycle Timing instead of Host Timing. 2020-06-27 11:36:01 -04:00
Fernando Sahmkow 1567824d2d General: Move ARM_Interface into Threads. 2020-06-27 11:35:58 -04:00
Fernando Sahmkow 87c49aa7be SVC/ARM: Correct svcSendSyncRequest and cache ticks on arm interface. 2020-06-27 11:35:53 -04:00
Fernando Sahmkow 25565dffd5 ARM: Addapt to new Exclusive Monitor Interface. 2020-06-27 11:35:50 -04:00
Fernando Sahmkow 7020d498c5 General: Fix microprofile on dynarmic/svc, fix wait tree showing which threads were running. 2020-06-27 11:35:48 -04:00
Fernando Sahmkow f370de84b1 Kernel: Rewind on SVC change. 2020-06-27 11:35:46 -04:00
Fernando Sahmkow d494b074e8 Kernel: Preempt Single core on redudant yields. 2020-06-27 11:35:45 -04:00
Fernando Sahmkow 6515c6e8c6 Kernel: Fixes, corrections and asserts to scheduler and different svcs. 2020-06-27 11:35:40 -04:00
Fernando Sahmkow cd1c38be8d ARM/Memory: Correct Exclusive Monitor and Implement Exclusive Memory Writes. 2020-06-27 11:35:37 -04:00
Fernando Sahmkow 83c7ba1ef7 SVC: Correct SetThreadActivity. 2020-06-27 11:35:33 -04:00
Fernando Sahmkow e4b175ade2 SVC: Correct svcWaitForAddress and svcSignalToAddress. 2020-06-27 11:35:25 -04:00
Fernando Sahmkow 07993ac8c8 Kernel: Corrections to Scheduling. 2020-06-27 11:35:23 -04:00
Fernando Sahmkow 75e10578f1 Core: Correct HLE Event Callbacks and other issues. 2020-06-27 11:35:22 -04:00
Fernando Sahmkow 2a8837ff51 General: Add Asserts 2020-06-27 11:35:21 -04:00
Fernando Sahmkow 04e0f8776c General: Add better safety for JIT use. 2020-06-27 11:35:20 -04:00
Fernando Sahmkow bd36eaf15d SVC: Correct races on physical core switching. 2020-06-27 11:35:19 -04:00
Fernando Sahmkow 3902067008 SVC: Add locks to the memory management. 2020-06-27 11:35:18 -04:00
Fernando Sahmkow d4ebb510a0 SVC: Correct WaitSynchronization, WaitProcessWideKey, SignalProcessWideKey. 2020-06-27 11:35:17 -04:00
Fernando Sahmkow 5b6a67f849 SVC: Cleanup old methods. 2020-06-27 11:35:16 -04:00
Fernando Sahmkow 15a79eb0d7 SVC: Correct SendSyncRequest. 2020-06-27 11:35:14 -04:00
Fernando Sahmkow 3b5b950c89 SVC: Correct SignalEvent, ClearEvent, ResetSignal, WaitSynchronization, CancelSynchronization, ArbitrateLock 2020-06-27 11:35:13 -04:00
Fernando Sahmkow ef4afa9760 SVC: Remove global HLE Lock. 2020-06-27 11:35:13 -04:00
Fernando Sahmkow 589f9cf108 SVC: Correct GetThreadPriority, SetThreadPriority, GetThreadCoreMask, SetThreadCoreMask, GetCurrentProcessorNumber 2020-06-27 11:35:12 -04:00
Fernando Sahmkow 49ba563995 SVC: Correct CreateThread, StartThread, ExitThread, SleepThread. 2020-06-27 11:35:11 -04:00
Fernando Sahmkow e31425df38 General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
David Marcec b6538c3e7c kernel: Don't fail silently 2020-04-29 14:53:53 +10:00
David Marcec 2261cf24af kernel: Bad GetInfo ids should not be marked as stubs
As we currently match hardware and don't return a successful result, these should be marked as errors instead of warnings and as stubs.
2020-04-29 01:17:59 +10:00
bunnei d1e7cf3bdc
Merge pull request #3780 from lioncash/process
svc: Re-add MapProcessCodeMemory/UnmapProcessCodeMemory
2020-04-24 23:22:26 -04:00
Lioncash 4730347f8e svc: Re-add MapProcessCodeMemory/UnmapProcessCodeMemory
These were lost in the re-implementation of the virtual memory manager.
2020-04-23 18:12:04 -04:00
Lioncash bed4865981 svc: Remove unused variable
Since the VMM refactor, this is no longer used or needed.
2020-04-23 17:53:26 -04:00
bunnei 8bbe74a8dc core: hle: Address various feedback & code cleanup.
- Should be no functional changes.
2020-04-17 00:59:36 -04:00
bunnei c629e544a7 kernel: svc: Updates for new VMM.
- Includes removing some SVC impls. that are untested.
2020-04-17 00:59:34 -04:00
bunnei 4caff51710 core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17 00:59:28 -04:00
bunnei ad48ebb2c8 core: kernel: Add svc_types header to include SVC-specific types. 2020-04-17 00:59:28 -04:00
bunnei 82d457af37 core: kernel: Move SVC to its own namesapce. 2020-04-17 00:59:28 -04:00
bunnei dba112e510 core: hle: Implement separate A32/A64 SVC interfaces. 2020-03-02 21:52:03 -05:00
Fernando Sahmkow 2bc949628d Core: Address Feedback 2020-02-13 19:10:33 -04:00
Fernando Sahmkow d23d504d77 Kernel: Refactor synchronization to better match RE 2020-02-11 18:47:31 -04:00
Fernando Sahmkow c5aefe42aa Kernel: Change WaitObject to Synchronization object. In order to better reflect RE. 2020-02-11 10:46:25 -04:00
bunnei ba53543da6 kernel: transfer_memory: Properly reserve and reset memory region. 2020-02-05 23:06:54 -05:00
Fernando Sahmkow e4a1ead897 Core: Refactor CpuCoreManager to CpuManager and Cpu to Core Manager.
This commit instends on better naming the new purpose of this classes.
2020-01-26 14:07:22 -04:00
Lioncash 30e365e4fc kernel/svc: Correct function signature of SignalProcessWideKey
This function doesn't actually return a result code, so we can amend the
signature of it to match.
2019-12-11 07:13:27 -05:00
Lioncash 67b8265bd6 kernel/svc: Provide implementations for svcDumpInfo/svcDumpInfoNew
These are fairly trivial to implement, we can just do nothing. This also
provides a spot for us to potentially dump out any relevant info in the
future (e.g. for debugging purposes with homebrew, etc).

While we're at it, we can also correct the names of both of these
supervisor calls.
2019-12-07 22:01:17 -05:00
bunnei c3d3b173d3 kernel: Implement a more accurate IPC dispatch. 2019-11-28 12:01:53 -05:00
Lioncash e4c381b885 core/memory: Migrate over Write{8, 16, 32, 64, Block} to the Memory class
The Write functions are used slightly less than the Read functions,
which make these a bit nicer to move over.

The only adjustments we really need to make here are to Dynarmic's
exclusive monitor instance. We need to keep a reference to the currently
active memory instance to perform exclusive read/write operations.
2019-11-26 21:55:39 -05:00
Lioncash b05bfc6036 core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.

Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.

For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
2019-11-26 21:55:39 -05:00
Lioncash b2165c6b35 core/memory: Migrate over ReadCString() to the Memory class
This only had one usage spot, so this is fairly straightforward to
convert over.
2019-11-26 21:55:38 -05:00
Lioncash 536fc7f0ea core: Prepare various classes for memory read/write migration
Amends a few interfaces to be able to handle the migration over to the
new Memory class by passing the class by reference as a function
parameter where necessary.

Notably, within the filesystem services, this eliminates two ReadBlock()
calls by using the helper functions of HLERequestContext to do that for
us.
2019-11-26 21:55:37 -05:00
Lioncash e58748fd80 core/memory: Migrate over address checking functions to the new Memory class
A fairly straightforward migration. These member functions can just be
mostly moved verbatim with minor changes. We already have the necessary
plumbing in places that they're used.

IsKernelVirtualAddress() can remain a non-member function, since it
doesn't rely on class state in any form.
2019-11-26 21:53:34 -05:00
bunnei 9046d4a548
kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.

- See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-24 20:15:51 -05:00
bunnei 63248f4edd
Update svc.cpp 2019-11-23 16:01:06 -05:00
bunnei 6eaf7ab55f svc: GetSystemTick should return cntpct_el0, not core ticks. 2019-11-23 15:29:15 -05:00
bunnei 6a3fc5d2ff
Merge pull request #3114 from FernandoS27/cond-var
Kernel: Correct behavior of Condition Variables to be more similar to real hardware.
2019-11-23 13:24:39 -05:00
Fernando Sahmkow 46bb609981 Kernel: Optimize condition variable threads management. 2019-11-21 11:13:29 -04:00
Fernando Sahmkow 2ab41ceff4 Kernel: Correct SignalProcessWideKey
When the target is 0, all threads must be processed.
2019-11-21 10:46:55 -04:00
Fernando Sahmkow 2d16507f9f Kernel: Correct behavior of Condition Variables to be more similar to real hardware.
This commit ensures cond var threads act exactly as they do in the real
console. The original implementation uses an RBTree and the behavior of
cond var threads is that at the same priority level they act like a
FIFO.
2019-11-21 10:46:55 -04:00
Fernando Sahmkow 7d16b2d2dd Kernel: Correct Cancel Synchronization.
This commit corrects the behavior of cancel synchronization when the
thread is running/ready and ensures the next wait is cancelled as it's
suppose to.
2019-11-16 12:41:51 -04:00
bunnei b0ab803ce8 kernel: events: Remove ResetType::Automatic.
- This does not actually seem to exist in the real kernel - games reset these automatically.

# Conflicts:
#	src/core/hle/service/am/applets/applets.cpp
#	src/core/hle/service/filesystem/fsp_srv.cpp
2019-11-03 04:22:45 -05:00
Fernando Sahmkow 3073615dbc Kernel: Address Feedback. 2019-10-15 11:55:25 -04:00
Fernando Sahmkow 0b72b34d89 KernelSVC: Assert that condition variable address is aligned to 4 bytes. 2019-10-15 11:55:22 -04:00
Fernando Sahmkow 27d571c084 Kernel: Correct redundant yields to only advance time forward. 2019-10-15 11:55:20 -04:00
Fernando Sahmkow 44e09e5f21 Kernel: Correct Results in Condition Variables and Mutexes 2019-10-15 11:55:18 -04:00
Fernando Sahmkow 103f3a2fe5 Scheduler: Add protections for Yield bombing
In case of redundant yields, the scheduler will now idle the core for 
it's timeslice, in order to avoid continuously yielding the same thing 
over and over.
2019-10-15 11:55:13 -04:00
Fernando Sahmkow 82218c925a Kernel: Style and Corrections 2019-10-15 11:55:12 -04:00
Fernando Sahmkow fcc6b34fff Correct PrepareReschedule 2019-10-15 11:55:12 -04:00
Fernando Sahmkow 9031502974 Correct Supervisor Calls to work with the new scheduler, 2019-10-15 11:55:08 -04:00
bunnei 5d369112d9
Merge pull request #2687 from lioncash/tls-process
kernel/process: Allocate the process' TLS region during initialization
2019-07-18 13:53:04 -04:00
Fernando Sahmkow 5e457bf258 Kernel: Downgrade WaitForAddress and SignalToAddress messages to Trace.
This messages were originally set as warnning since few games used these
svcs and it was needed for debugging. This is no longer the case.
2019-07-17 22:05:47 -04:00
Fernando Sahmkow 4882c058fd
Merge pull request #2690 from SciresM/physmem_fixes
Implement MapPhysicalMemory/UnmapPhysicalMemory
2019-07-14 09:16:46 -04:00
Michael Scire 072a9796f5 Restore memory perms on svcUnmapMemory/UnloadNro
Prior to PR, Yuzu did not restore memory to RW-
on unmap of mirrored memory or unloading of NRO.

(In fact, in the NRO case, the memory was unmapped
instead of reprotected to --- on Load, so it was
actually lost entirely...)

This PR addresses that, and restores memory to RW-
as it should.

This fixes a crash in Super Smash Bros when creating
a World of Light save for the first time, and possibly
other games/circumstances.
2019-07-11 01:38:28 -07:00
Michael Scire b901cd584e clang-format fixes 2019-07-07 12:08:29 -07:00
Michael Scire 1689784c19 address review commentary 2019-07-07 11:48:11 -07:00
Michael Scire 13a8fde3ad Implement MapPhysicalMemory/UnmapPhysicalMemory
This implements svcMapPhysicalMemory/svcUnmapPhysicalMemory for Yuzu,
which can be used to map memory at a desired address by games since
3.0.0.

It also properly parses SystemResourceSize from NPDM, and makes
information available via svcGetInfo.

This is needed for games like Super Smash Bros. and Diablo 3 -- this
PR's implementation does not run into the "ASCII reads" issue mentioned
in the comments of #2626, which was caused by the following bugs in
Yuzu's memory management that this PR also addresses:
* Yuzu's memory coalescing does not properly merge blocks. This results
  in a polluted address space/svcQueryMemory results that would be
  impossible to replicate on hardware, which can lead to game code making
  the wrong assumptions about memory layout.
  * This implements better merging for AllocatedMemoryBlocks.
* Yuzu's implementation of svcMirrorMemory unprotected the entire
  virtual memory range containing the range being mirrored. This could
  lead to games attempting to map data at that unprotected
  range/attempting to access that range after yuzu improperly unmapped
  it.
  * This PR fixes it by simply calling ReprotectRange instead of
    Reprotect.
2019-07-07 11:45:53 -07:00
Lioncash 56c7912159 kernel/process: Allocate the process' TLS region during initialization
Prior to execution within a process beginning, the process establishes
its own TLS region for uses (as far as I can tell) related to exception
handling.

Now that TLS creation was decoupled from threads themselves, we can add
this behavior to our Process class. This is also good, as it allows us
to remove a stub within svcGetInfo, namely querying the address of that
region.
2019-07-07 14:08:28 -04:00
Lioncash 2a9e388290 kernel/vm_manager: Rename 'new map' to 'stack'
Provides a more accurate name for the memory region and also
disambiguates between the map and new map regions of memory, making it
easier to understand.
2019-07-06 02:24:30 -04:00
bunnei 96412848a9
Merge pull request #2482 from DarkLordZach/prepo
core: Add detailed local reporting feature for development
2019-06-21 14:05:18 -04:00
Lioncash 3f87664d8f kernel/svc: Implement TotalMemoryUsedWithoutMmHeap/TotalMemoryAvailableWithoutMmHeap
Given we don't currently implement the personal heap yet, the existing
memory querying functions are essentially doing what the memory querying
types introduced in 6.0.0 do.

So, we can build the necessary machinery over the top of those and just
use them as part of info types.
2019-06-09 18:22:30 -04:00
Lioncash c1a8f684df kernel/svc: Amend naming for TotalMemoryUsage in svcGetInfo()
Disambiguates and makes the name a little more consistent with
TotalPhysicalMemoryUsed.
2019-06-09 18:12:05 -04:00
Lioncash 81b1102090 kernel/svc: Remove duplicate enum entry in svcGetInfo() 2019-06-09 18:08:37 -04:00
Zach Hilman 186db894b9 svc: Save report on call to svcBreak 2019-05-25 16:09:20 -04:00
bunnei 13dda1d8ed
Merge pull request #2410 from lioncash/affinity
kernel/svc: Reorganize and fix up the initial handling of svcSetThreadCoreMask()
2019-05-19 13:59:52 -04:00
Sebastian Valle 27033de2e5
Merge pull request #2486 from lioncash/resetname
core/kernel/object: Rename ResetType enum members for clarity
2019-05-19 08:47:59 -05:00
Lioncash d5cce86431 kernel/svc: Mark GetThreadList() and UnmapProcessCodeMemory() as internally linked
These are only used from within this translation unit, so they don't
need to have external linkage. They were intended to be marked with this
anyways to be consistent with the other service functions.
2019-05-18 19:10:34 -04:00
Lioncash a47aaa7f1b core/kernel/object: Rename ResetType enum members
Renames the members to more accurately indicate what they signify.
"OneShot" and "Sticky" are kind of ambiguous identifiers for the reset
types, and can be kind of misleading. Automatic and Manual communicate
the kind of reset type in a clearer manner. Either the event is
automatically reset, or it isn't and must be manually cleared.

The "OneShot" and "Sticky" terminology is just a hold-over from Citra
where the kernel had a third type of event reset type known as "Pulse".
Given the Switch kernel only has two forms of event reset types, we
don't need to keep the old terminology around anymore.
2019-05-18 15:52:51 -04:00
Lioncash 19632d2421 kernel/svc: Make svcCreateThread/svcStartThread/svcSleepThread/svcExitThread calls show up in the debug log
These are actually quite important indicators of thread lifetimes, so
they should be going into the debug log, rather than being treated as
misc info and delegated to the trace log.
2019-04-29 01:38:27 -04:00
Lioncash d672c6e759 kernel/svc: Reorganize svcSetThreadCoreMask()
Makes the code much nicer to follow in terms of behavior and control
flow. It also fixes a few bugs in the implementation.

Notably, the thread's owner process shouldn't be accessed in order to
retrieve the core mask or ideal core. This should be done through the
current running process. The only reason this bug wasn't encountered yet
is because we currently only support running one process, and thus every
owner process will be the current process.

We also weren't checking against the process' CPU core mask to see if an
allowed core is specified or not.

With this out of the way, it'll be less noisy to implement proper
handling of the affinity flags internally within the kernel thread
instances.
2019-04-29 01:38:27 -04:00
Lioncash 69a2003a8e kernel/thread: Update thread processor ID flags
Adds the missing flags to the enum and documents them.
2019-04-29 01:37:51 -04:00