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
6b2f653143
hle: kernel: k_scheduler_lock: Fix shadowing errors.
2021-01-11 14:23:16 -08:00
bunnei
912dd50146
core: hle: Integrate new KConditionVariable and KAddressArbiter implementations.
2021-01-11 14:23:16 -08:00
bunnei
952d1ac487
core: hle: kernel: Update KAddressArbiter.
2021-01-11 14:23:16 -08:00
bunnei
b4e6d6c385
core: hle: kernel: Update KConditionVariable.
2021-01-11 14:23:16 -08:00
bunnei
1212fa60b6
core: hle: kernel: Begin moving common SVC defintions to its own header.
2021-01-11 14:23:16 -08:00
bunnei
8a155c4058
hle: kernel: Remove unnecessary AddressArbiter definition.
2021-01-11 14:23:16 -08:00
bunnei
f12701b303
hle: kernel: k_scheduler: Cleanup OnThreadPriorityChanged.
2021-01-11 14:23:16 -08:00
bunnei
d1309fb275
hle: kernel: Rename thread "status" to "state".
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
7420a717e6
core: hle: kernel: Add some useful functions for checking kernel addresses.
2021-01-11 14:23:16 -08:00
bunnei
4bbf173fc1
core: hle: kernel: svc_types: Add type definitions for KAddressArbiter.
2021-01-11 14:23:16 -08:00
bunnei
35c3c078e3
core: hle: kernel: Update KSynchronizationObject.
2021-01-11 14:23:16 -08:00
bunnei
1ae883435d
core: hle: kernel: Begin moving common SVC results to its own header.
2021-01-11 14:23:16 -08:00
ReinUsesLisp
4f13e270c8
core: Silence warnings when compiling without asserts
2021-01-05 04:18:16 -03:00
Morph
a745d87971
general: Fix various spelling errors
2021-01-02 10:23:41 -05:00
bunnei
eb318ffffc
Merge pull request #5249 from ReinUsesLisp/lock-free-pages
...
core/memory: Read and write page table atomically
2021-01-01 02:54:01 -08:00
bunnei
25d607f5f6
Merge pull request #5208 from bunnei/service-threads
...
Service threads
2020-12-30 22:06:05 -08:00
ReinUsesLisp
b3587102d1
core/memory: Read and write page table atomically
...
Squash attributes into the pointer's integer, making them an uintptr_t
pair containing 2 bits at the bottom and then the pointer. These bits
are currently unused thanks to alignment requirements.
Configure Dynarmic to mask out these bits on pointer reads.
While we are at it, remove some unused attributes carried over from
Citra.
Read/Write and other hot functions use a two step unpacking process that
is less readable to stop MSVC from emitting an extra AND instruction in
the hot path:
mov rdi,rcx
shr rdx,0Ch
mov r8,qword ptr [rax+8]
mov rax,qword ptr [r8+rdx*8]
mov rdx,rax
-and al,3
and rdx,0FFFFFFFFFFFFFFFCh
je Core::Memory::Memory::Impl::Read<unsigned char>
mov rax,qword ptr [vaddr]
movzx eax,byte ptr [rdx+rax]
2020-12-29 21:54:49 -03:00
bunnei
85cfd96f62
Merge pull request #5247 from comex/xx-concepts
...
k_priority_queue: Fix concepts use
2020-12-29 16:50:20 -08:00
bunnei
82e0eeed21
hle: kernel: service_thread: Make thread naming more consistent.
2020-12-29 16:46:29 -08:00
bunnei
a2a0f5318d
hle: kernel: Manage service threads on another thread.
...
- This is to allow service threads to defer destruction of themselves.
2020-12-29 16:46:29 -08:00
bunnei
b02464f685
Merge pull request #5246 from comex/xx-include
...
Add missing include of "core/hle/kernel/kernel.h"
2020-12-29 16:43:17 -08:00
bunnei
c192da3f82
hle: kernel: Manage host thread IDs using TLS.
...
- Avoids the need to have a large map of host to guest thread IDs.
2020-12-29 15:55:30 -08:00
comex
388cf58b31
k_priority_queue: Fix concepts use
...
- For `std::same_as`, add missing include of `<concepts>`.
- For `std::convertible_to`, create a replacement in `common/concepts.h`
and use that instead.
This would also be found in `<concepts>`, but unlike `std::same_as`,
`std::convertible_to` is not yet implemented in libc++, LLVM's STL
implementation - not even in master. (In fact, `std::same_as` is the
*only* concept currently implemented. For some reason.)
2020-12-29 14:33:41 -05:00
comex
b36896b90e
Add missing include of "core/hle/kernel/kernel.h"
...
This is needed as the header invokes methods on KernelCore.
2020-12-29 14:22:35 -05: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
dfdac7d38a
hle: kernel: Move ServiceThread ownership to KernelCore.
...
- Fixes a circular dependency which prevented threads from being released on shutdown.
2020-12-29 01:12:39 -08:00
bunnei
f57be2e626
hle: kernel: service_thread: Add thread name and take weak_ptr of ServerSession.
2020-12-29 01:06:39 -08:00
bunnei
d0649d0971
core: hle: kernel: Clear process list on boot.
2020-12-28 21:33:34 -08:00
bunnei
6d2f9428c5
core: kernel: Clear process list earlier.
2020-12-28 16:33:48 -08:00
bunnei
5d4715cc6a
hle: kernel: hle_ipc: Remove SleepClientThread.
...
- This was kind of hacky, and no longer is necessary with service threads.
2020-12-28 16:33:48 -08:00
bunnei
8bc3d66354
hle: kernel: service_thread: Add parameter for thread pool size.
2020-12-28 16:33:47 -08:00
bunnei
28281ae250
core: hle: server_session: Use separate threads for each service connection.
2020-12-28 16:33:47 -08: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
bunnei
37194dd4e9
Merge pull request #5172 from lioncash/svc-wide
...
svc: Remove unnecessary casts
2020-12-11 17:39:30 -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
Lioncash
6b7320add4
core: Remove unnecessary enum casts in log calls
...
Follows the video core PR. fmt doesn't require casts for enum classes
anymore, so we can remove quite a few casts.
2020-12-07 23:02:23 -05:00
bunnei
a58d57a60d
Merge pull request #5148 from comex/xx-unused-fields
...
core: Mark unused fields as [[maybe_unused]]
2020-12-06 22:33:00 -08:00
LC
69af6ada2f
Merge pull request #5136 from lioncash/video-shadow3
...
video_core: Resolve more variable shadowing scenarios pt.3
2020-12-07 00:06:53 -05:00
comex
e31cb50405
Fix "explicitly defaulted but implicitly deleted" warning
...
`PhysicalCore`'s move assignment operator was declared as `= default`,
but was implicitly deleted because `PhysicalCore` has fields
of reference type. Switch to explicitly deleting it to avoid a Clang
warning.
The move *constructor* is still defaulted, and is required to exist due
to the use of `std::vector<PhysicalCore>`.
2020-12-06 19:02:04 -05:00
comex
feac654ba0
core: Mark unused fields as [[maybe_unused]]
2020-12-06 18:36:10 -05:00
bunnei
1bdb756d28
hle: kernel: Process: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
9b492430bb
hle: kernel: Thread: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
ed4d1e2ade
hle: kernel: KScopedSchedulerLockAndSleep: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
b1b4f2337e
hle: kernel: KScopedLock: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
165d8485f0
hle: kernel: KAbstractSchedulerLock: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
960500cfd2
hle: kernel: KScheduler: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
8fd921557f
hle: kernel: KPriorityQueue: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
4d3be1816c
hle: kernel: KAffinityMask: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
357d79fb6e
hle: kernel: GlobalSchedulerContext: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
b1326d9230
hle: kernel: Use C++ style comments in KScheduler, etc.
2020-12-06 00:03:24 -08:00
bunnei
bc59ca92b6
kernel: KScopedSchedulerLockAndSleep: Remove unused ctor.
2020-12-06 00:03:24 -08:00
bunnei
b9b7e4f915
kernel: time_manager: Add missing lock guards.
2020-12-06 00:03:24 -08: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
8d3e06349e
hle: kernel: Separate KScheduler from GlobalSchedulerContext class.
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
c10a37e5b6
hle: kernel: physical_core: Clear exclusive state after each run.
...
- This is closer to pre-multicore behavior, and works a bit better.
2020-12-06 00:03:24 -08:00
bunnei
7e5d0f1fe3
hle: kernel: Port KAbstractSchedulerLock from Mesosphere.
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
d58a609ae4
hle: kernel: process: Add schedule count tracking, to be used for yield impl.
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
a3ccac3eb7
common: Port KPriorityQueue from Mesosphere.
2020-12-06 00:03:24 -08:00
bunnei
e18ee8d681
hle: kernel: Port KAffinityMask from Mesosphere.
2020-12-06 00:03:24 -08:00
Lioncash
f95602f152
video_core: Resolve more variable shadowing scenarios pt.3
...
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
2020-12-05 16:02:23 -05:00
bunnei
4b9e1b6586
kernel: scheduler: Minor cleanup to remove duplicated code.
2020-11-29 01:31:52 -08:00
bunnei
b7ef581c6e
kernel: time_manager: Protect access with a mutex.
2020-11-29 01:31:52 -08:00
bunnei
c2ad1243ba
hle: kernel: thread: Remove unused "Running" state.
2020-11-29 01:31:52 -08:00
bunnei
63fd1bb503
core: arm: Implement InvalidateCacheRange for CPU cache invalidation.
2020-11-29 01:31:52 -08:00
bunnei
c0870315fd
hle: kernel: time_manager: Avoid a crash on process exit.
2020-11-29 01:31:51 -08:00
bunnei
9705f651b2
hle: kernel: AddressArbiter: Remove unused code.
2020-11-29 01:31:51 -08:00
bunnei
9423347c1b
hle: kernel: SynchronizationObject: Use atomic_bool for is_signaled.
2020-11-29 01:31:51 -08:00
bunnei
c042a89113
common: fiber: Use boost::context instead of native fibers on Windows.
2020-11-29 01:31:51 -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
Lioncash
da7be67daf
ipc_helpers: Remove usage of the global system instance
...
Resolves numerous deprecation warnings throughout the codebase due to
inclusion of this header. Now building core should be significantly less
noisy (and also relying on less global state).
This also uncovered quite a few modules that were relying on indirect
includes, which have also been fixed.
2020-11-08 15:58:11 -05:00
Lioncash
fc6db97a09
core: Remove usage of unicorn
...
Unicorn long-since lost most of its use, due to dynarmic gaining support
for handling most instructions. At this point any further issues
encountered should be used to make dynarmic better.
This also allows us to remove our dependency on Python.
2020-11-03 20:22:05 -05:00
Morph
9cfc5fee2f
kernel/process: Add missing <ctime> include
...
Fixes compilation on MSVC
2020-10-29 03:17:20 -04:00
bunnei
c5134cbf3a
Merge pull request #4835 from lat9nq/rng-default-time
...
kernel: Use the current time as the default RNG seed
2020-10-28 22:51:29 -07:00
ReinUsesLisp
ce69ff2890
hle/kernel: Remove unused registered_core_threads to fix data races
...
This member was only used on asserts and it triggered data races.
Remove it to fix them.
2020-10-27 01:55:39 -03:00
lat9nq
8bd246032a
kernel: Use the current time as the default RNG seed
...
Use the current time, not zero, as the default RNG seed.
2020-10-26 21:42:11 -04:00
bunnei
3d592972dc
Revert "core: Fix clang build"
2020-10-20 19:07:39 -07:00
Lioncash
fdd9154069
kernel: Fix build with recent compiler flag changes
...
This slipped through the cracks due to another change being merged
before the compiler flag changes.
2020-10-20 20:23:18 -04:00
LC
88d5140cf2
Merge pull request #4796 from lioncash/clang
...
core: Fix clang build
2020-10-20 19:19:12 -04:00
bunnei
60bd54776a
Merge pull request #4788 from ReinUsesLisp/lockfree-host-thread
...
kernel: Implement host thread register methods without locking
2020-10-19 22:31:52 -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
ReinUsesLisp
b9a9b83bee
kernel: Implement host thread register methods without locking
...
Locks on GetCurrentHostThreadID were causing performance issues
according to Visual Studio's profiler. It was consuming twice the time
as arm_interface.Run(). The cost was not in the function itself but in
the lockinig it required.
Reimplement these functions using atomics and static storage instead of
an unordered_map. This is a side effect to avoid locking and using linked
lists for reads.
Replace unordered_map with a linear search.
2020-10-13 18:00:25 -03:00
Lioncash
39c8d18feb
core/CMakeLists: Make some warnings errors
...
Makes our error coverage a little more consistent across the board by
applying it to Linux side of things as well. This also makes it more
consistent with the warning settings in other libraries in the project.
This also updates httplib to 0.7.9, as there are several warning
cleanups made that allow us to enable several warnings as errors.
2020-10-13 13:16:49 -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
bunnei
5fc6bf96d8
Merge pull request #4323 from ReinUsesLisp/no-spin
...
kernel/scheduler: Use std::mutex instead of spin lock
2020-09-11 23:23:53 -07:00
bunnei
ba5419b965
Merge pull request #4590 from ReinUsesLisp/tsan-sched
...
hle/scheduler: Fix data race in is_context_switch_pending
2020-09-03 14:39:57 -04:00
ReinUsesLisp
ccdd84a778
hle/scheduler: Fix data race in is_context_switch_pending
...
As reported by tsan, SelectThreads could write to
is_context_switch_pending holding a mutex while SwitchToCurrent reads it
without holding any.
It is assumed that the author didn't want an atomic here, so the code is
reordered so that whenever is_context_switch_pending is read inside
SwitchToContext, the mutex is locked.
2020-08-26 02:56:05 +00:00
ReinUsesLisp
36eade7f4c
hle/kernel: Fix data race in GetCurrentHostThreadID
...
As reported by tsan, host_thread_ids could be read while
any of the RegisterHostThread variants were called.
To fix this, lock the register mutex when yuzu is running in multicore
mode and GetCurrentHostThreadID is called.
2020-08-26 02:52:50 +00:00
bunnei
cb6808b4d0
Merge pull request #4492 from lioncash/linkage
...
system_control: Make functions internally linked where applicable
2020-08-15 02:11:49 -04:00
Lioncash
f808258ed9
kernel/scheduler: Mark SchedulerLock constructor as nodiscard
...
Allows the compiler to warn about cases where the constructor is used
but then immediately discarded, which is a potential cause of
locking/unlocking bugs.
2020-08-14 04:43:44 -04:00
Lioncash
b724a4d90c
General: Tidy up clang-format warnings part 2
2020-08-13 14:19:08 -04:00
bunnei
acfd771e79
Merge pull request #4491 from lioncash/unused-vars
...
kernel: Remove unused variables
2020-08-10 12:04:30 -04:00
Lioncash
87c64c41d2
system_control: Make functions internally linked where applicable
...
These functions are only ever used internally as implementation details
for GenerateRandomRange(), so these can be given internal linkage.
2020-08-05 15:34:27 -04:00
Lioncash
a10d64ea79
kernel: Remove unused variables
...
Resolves a few compiler warnings.
2020-08-05 15:19:48 -04:00