Lioncash
75603b005b
process/vm_manager: Amend API to allow reading parameters from NPDM metadata
...
Rather than hard-code the address range to be 36-bit, we can derive the
parameters from supplied NPDM metadata if the supplied exectuable
supports it. This is the bare minimum necessary for this to be possible.
The following commits will rework the memory code further to adjust to
this.
2018-09-24 17:24:50 -04:00
tech4me
d42424ace0
svc: Updated svc names
2018-09-23 17:03:38 -07:00
Lioncash
48b2eda492
svc: Move most process termination code to its own function within Process
...
Reduces the use of Process class members externally and keeps most code
related to tearing down a process with the rest of the process code.
2018-09-21 06:07:41 -04:00
Lioncash
acfc801d14
thread/process: Move TLS slot marking/freeing to the process class
...
Allows making several members of the process class private, it also
avoids going through Core::CurrentProcess() just to retrieve the owning
process.
2018-09-21 03:50:12 -04:00
bunnei
0285ddfbd4
Merge pull request #1372 from lioncash/thread
...
kernel/thread: Use owner_process when setting the page table in SetupMainThread()
2018-09-20 23:35:29 -04:00
Lioncash
05aa4aa01a
kernel/thread: Use owner_process when setting the page table in SetupMainThread()
...
The owning process of a thread is required to exist before the thread,
so we can enforce this API-wise by using a reference. We can also avoid
the reliance on the system instance by using that parameter to access
the page table that needs to be set.
2018-09-20 21:10:00 -04:00
Lioncash
9b8fc2b689
arm_interface: Replace kernel vm_manager include with a forward declaration
...
Avoids an unnecessary inclusion and also uncovers three places where
indirect inclusions were relied upon, which allows us to also resolve
those.
2018-09-20 19:35:36 -04:00
bunnei
c768535463
Merge pull request #1346 from lioncash/svc
...
svc_wrap: Convert the PARAM macro into a function
2018-09-18 22:12:47 -04:00
bunnei
733c47623b
Merge pull request #1343 from lioncash/mutex
...
kernel/svc: Handle invalid address cases within svcArbitrateLock() and svcArbitrateUnlock()
2018-09-18 14:25:00 -04:00
Lioncash
f85ab0a123
svc_wrap: Convert the PARAM macro into a function
...
This can just be a regular function, getting rid of the need to also
explicitly undef the define at the end of the file. Given FuncReturn()
was already converted into a function, it's #undef can also be removed.
2018-09-18 04:27:38 -04:00
Lioncash
b51e7e0288
arm_interface: Remove ARM11-isms from the CPU interface
...
This modifies the CPU interface to more accurately match an
AArch64-supporting CPU as opposed to an ARM11 one. Two of the methods
don't even make sense to keep around for this interface, as Adv Simd is
used, rather than the VFP in the primary execution state. This is
essentially a modernization change that should have occurred from the
get-go.
2018-09-18 03:20:04 -04:00
Lioncash
71b48cb00f
kernel/mutex: Replace ResultCode construction for invalid addresses with the named variant
...
We already have a ResultCode constant for the case of an invalid
address, so we can just use it instead of re-rolling that ResultCode
type.
2018-09-17 23:27:53 -04:00
Lioncash
b6867602ca
kernel/svc: Handle error cases for svcArbitrateLock() and svcArbitrateUnlock()
...
The kernel does the equivalent of the following check before proceeding:
if (address + 0x8000000000 < 0x7FFFE00000) {
return ERR_INVALID_MEMORY_STATE;
}
which is essentially what our IsKernelVirtualAddress() function does. So
we should also be checking for this.
The kernel also checks if the given input addresses are 4-byte aligned,
however our Mutex::TryAcquire() and Mutex::Release() functions already
handle this, so we don't need to add code for this case.
2018-09-17 23:27:53 -04:00
bunnei
2bfb9fd0e6
Merge pull request #1313 from lioncash/error
...
kernel/errors: Amend error code for ERR_NOT_FOUND
2018-09-17 12:28:40 -04:00
bunnei
e6367ab955
Merge pull request #1315 from lioncash/size
...
kernel/svc: Handle a few error cases within memory-related functions
2018-09-17 10:11:26 -04:00
bunnei
e561afdcd5
Merge pull request #1328 from FearlessTobi/port-4192
...
Port #4192 from Citra: "svc: change unknown to thread in CreateThread"
2018-09-17 09:56:48 -04:00
Valentin Vanelslande
54ddb37b3c
Port # #4192 from Citra: "svc: change unknown to thread in CreateThread"
2018-09-15 15:28:35 +02:00
fearlessTobi
63c2e32e20
Port #4182 from Citra: "Prefix all size_t with std::"
2018-09-15 15:21:06 +02:00
Lioncash
4f8756edd0
kernel/svc: Sanitize creation of shared memory via svcCreateSharedMemory()
...
The kernel caps the size limit of shared memory to 8589930496 bytes (or
(1GB - 512 bytes) * 8), so approximately 8GB, where every GB has a 512
byte sector taken off of it.
It also ensures the shared memory is created with either read or
read/write permissions for both permission types passed in, allowing the
remote permissions to also be set as "don't care".
2018-09-13 23:07:27 -04:00
Lioncash
accd1f17e4
kernel/svc: Sanitize addresses, permissions, and sizes within svcMapSharedMemory() and svcUnmapSharedMemory()
...
Part of the checking done by the kernel is to check if the given
address and size are 4KB aligned, as well as checking if the size isn't
zero. It also only allows mapping shared memory as readable or
read/write, but nothing else, and so we shouldn't allow mapping as
anything else either.
2018-09-13 23:07:23 -04:00
Lioncash
496c67fd73
kernel/svc: Sanitize addresses and sizes within svcMapMemory() and svcUnmapMemory()
...
The kernel checks if the addresses and given size is 4KB aligned before
continuing onwards to map the memory.
2018-09-13 21:34:54 -04:00
Lioncash
7bd2faad9a
kernel/svc: Sanitize heap sizes within svcSetHeapSize()
...
The kernel checks if the given size is a multiple of 2MB and <= to 4GB
before going ahead and attempting to allocate that much memory.
2018-09-13 21:34:48 -04:00
Lioncash
50a5d09d32
kernel/errors: Amend error code for ERR_NOT_FOUND
...
This is the value returned by the kernel for svcConnectToNamedPort() if
the named port cannot be found.
2018-09-13 17:12:01 -04:00
Lioncash
2ea45fe75b
kernel/thread: Include thread-related enums within the kernel namespace
...
Previously, these were sitting outside of the Kernel namespace, which
doesn't really make sense, given they're related to the Thread class
which is within the Kernel namespace.
2018-09-13 16:05:57 -04:00
bunnei
79217f9870
Merge pull request #1303 from lioncash/error
...
kernel/errors: Amend invalid thread priority and invalid processor ID error codes
2018-09-12 12:14:51 -04:00
Lioncash
fbe462099b
svc: Return ERR_INVALID_PROCESSOR_ID in CreateThread() if an invalid processor ID is given
...
This is what the kernel does for an out-of-range processor ID.
2018-09-12 05:20:02 -04:00
Lioncash
3c5c292592
kernel/errors: Correct error codes for invalid thread priority and invalid processor ID
2018-09-12 05:19:57 -04:00
Lioncash
9b3bc0b282
svc: Do nothing if svcOutputDebugString() is given a length of zero
...
While unlikely, it does avoid constructing a std::string and
unnecessarily calling into the memory code if a game or executable
decides to be really silly about their logging.
2018-09-12 04:51:44 -04:00
Lioncash
04d723baf9
svc: Correct parameter type for OutputDebugString()
...
This should be a u64 to represent size.
2018-09-12 04:49:11 -04:00
Lioncash
3f17fe7133
core: Migrate current_process pointer to the kernel
...
Given we now have the kernel as a class, it doesn't make sense to keep
the current process pointer within the System class, as processes are
related to the kernel.
This also gets rid of a subtle case where memory wouldn't be freed on
core shutdown, as the current_process pointer would never be reset,
causing the pointed to contents to continue to live.
2018-09-06 20:52:58 -04:00
Lioncash
1242c1ec0a
service: Migrate global named port map to the KernelCore class
...
Now that we have a class representing the kernel in some capacity, we
now have a place to put the named port map, so we move it over and get
rid of another piece of global state within the core.
2018-09-02 12:35:30 -04:00
Lioncash
4a587b81b2
core/core: Replace includes with forward declarations where applicable
...
The follow-up to e2457418da
, which
replaces most of the includes in the core header with forward declarations.
This makes it so that if any of the headers the core header was
previously including change, then no one will need to rebuild the bulk
of the core, due to core.h being quite a prevalent inclusion.
This should make turnaround for changes much faster for developers.
2018-08-31 16:30:14 -04:00
Lioncash
0cbcd6ec9a
kernel: Eliminate kernel global state
...
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.
This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.
This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.
The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
2018-08-28 22:31:51 -04:00
bunnei
a409d49bbd
Merge pull request #1177 from lioncash/err
...
kernel/error: Amend several error codes
2018-08-27 18:37:48 -04:00
bunnei
62edc01525
Merge pull request #1175 from lioncash/ns
...
core: Namespace all code in the arm subdirectory under the Core namespace
2018-08-27 18:17:12 -04:00
Lioncash
f708207ae6
kernel/error: Amend error code for ERR_MAX_CONNECTIONS_REACHED
...
We can make this error code an alias of the resource limit exceeded
error code, allowing us to get rid of the lingering 3DS error code of
the same type.
2018-08-25 09:40:42 -04:00
Lioncash
bfb0c87b7b
kernel/error: Amend error code for ERR_PORT_NAME_TOO_LONG
...
We can treat this as an alias of TooLarge for documentation purposes.
This also lets us get rid of another lingering 3DS-related error code.
2018-08-25 09:40:29 -04:00
Lioncash
81ca46dd17
kernel/error: Add error code for the handle table being full
...
This replaces the lingering 3DS constant with the proper one, and
utilizes it within HandleTable's Create() member function.
2018-08-25 09:40:21 -04:00
Lioncash
b8be5524bc
kernel/error: Add error code for invalid memory permissions
2018-08-25 09:40:12 -04:00
Lioncash
2fd45093f2
kernel/error: Correct kernel error code for invalid combination
2018-08-25 09:40:00 -04:00
Lioncash
e81354ae38
svc: Return process title ID if queried in GetInfo()
...
We already have the variable itself set up to perform this task, so we
can just return its value from the currently executing process instead
of always stubbing it to zero.
2018-08-25 05:02:28 -04:00
Lioncash
43e0d865fa
core: Namespace all code in the arm subdirectory under the Core namespace
...
Gets all of these types and interfaces out of the global namespace.
2018-08-24 21:50:39 -04:00
bunnei
1dd27aff47
Merge pull request #1051 from B3n30/UnscheduleEventThreadsafe
...
Core::CoreTiming: add UnscheduleEventThreadsafe
2018-08-15 18:25:30 -04:00
Lioncash
aac5792a2b
kernel/server_session: Add IsSession() member function
...
Allows querying the inverse of IsDomain() to make things more readable.
This will likely also be usable in the event of implementing
ConvertDomainToSession().
2018-08-15 06:50:50 -04:00
Lioncash
25d71454d1
kernel/svc: Log svcBreak parameters
...
Given if we hit here all is lost, we should probably be logging the
break reason code and associated information to distinguish between the
causes.
2018-08-14 20:54:05 -04:00
B3n30
eab35c8235
Core::CoreTiming: add UnscheduleEventThreadsafe
2018-08-13 13:56:41 +02:00
Lioncash
3476f5b4d3
kernel/object: Tighten object against data races
...
Despite being covered by a global mutex, we should still ensure that the
class handles its reference counts properly. This avoids potential
shenanigans when it comes to data races.
Given this is the root object that drives quite a bit of the kernel
object hierarchy, ensuring we always have the correct behavior (and no
races) is a good thing.
2018-08-13 00:16:40 -04:00
bunnei
fecffeb0dd
Merge pull request #1043 from Subv/timing
...
Use an approximated amortized amount of ticks when advancing timing.
2018-08-12 22:31:55 -04:00
bunnei
9608f51cde
Merge pull request #1036 from lioncash/thread
...
scheduler: Make HaveReadyThreads() a const member function
2018-08-12 22:13:14 -04:00
bunnei
e4ed5bc836
Merge pull request #1042 from Subv/races
...
Fixed a bunch of race conditions when running in multicore mode.
2018-08-12 22:05:48 -04:00
Subv
a9877c8f65
Kernel/SVC: Don't reschedule the current core when creating a new thread.
...
The current core may have nothing to do with the core where the new thread was scheduled to run. In case it's the same core, then the following PrepareReshedule call will take care of that.
2018-08-12 20:38:37 -05:00
Subv
84b542c386
Kernel/Threads: Lock the HLE mutex when executing the wakeup callback.
...
Another thread might be in the middle of a reschedule, thus altering the state of the schedulers.
2018-08-12 18:41:11 -05:00
Subv
0135b328ed
Kernel/Thread: Always use the threadsafe option when scheduling wakeups.
...
WakeAfterDelay might be called from any host thread, so err on the side of caution and use the thread-safe CoreTiming::ScheduleEventThreadsafe.
Note that CoreTiming is still far from thread-safe, there may be more things we have to work on for it to be up to par with what we want.
2018-08-12 18:40:56 -05:00
Subv
5224cc49c4
Kernel/Mutex: Don't duplicate threads in the mutex waiter list.
...
Exit from AddMutexWaiter early if the thread is already waiting for a mutex owned by the owner thread.
This accounts for the possibility of a thread that is waiting on a condition variable being awakened twice in a row.
Also added more validation asserts.
This should fix one of the random crashes in Breath Of The Wild.
2018-08-12 16:35:27 -05:00
Lioncash
e850ff63bc
scheduler: Make HaveReadyThreads() a const member function
...
This function doesn't modify instance state, so the const qualifier can
be added to it.
2018-08-12 12:55:58 -04:00
bunnei
ca4bf671ce
server_session: Provide more useful information and don't crash on bad IPC request.
2018-08-11 21:15:24 -04:00
Lioncash
ff5024ee2a
hle_ipc: Make WriteToOutgoingCommandBuffer()'s reference parameter const
...
This function doesn't modify anything within the reference Thread
instance.
2018-08-09 02:51:38 -04:00
Lioncash
da2f00ab7d
client_port: Make all data members private
...
These members don't need to be entirely exposed, we can instead expose
an API to operate on them without directly needing to mutate them
We can also guard against overflow/API misuse this way as well, given
active_sessions is an unsigned value.
2018-08-06 23:05:17 -04:00
Lioncash
2feb1a8ba6
kernel/event: Make data members private
...
Instead we can simply provide accessors to the required data instead of
giving external read/write access to the variables directly.
2018-08-06 12:53:02 -04:00
Lioncash
7a77d0a71e
address_arbiter: Return by value from GetThreadsWaitingOnAddress()
...
In all cases the vector being supplied is empty, so we can just return
by value in these instances.
2018-08-05 16:29:17 -04:00
bunnei
206f2e3436
Merge pull request #914 from lioncash/codeset
...
kernel/process: Use accessors instead of class members for referencing segment array
2018-08-04 02:17:25 -04:00
Lioncash
e93fa7f2cc
kernel/thread: Fix potential crashes introduced in 26de4bb521
...
This amends cases where crashes can occur that were missed due to the
odd way the previous code was set up (using 3DS memory regions that
don't exist).
2018-08-03 23:49:10 -04:00
Lioncash
e649db8c6b
kernel/process: Use std::array where applicable
2018-08-03 14:46:30 -04:00
Lioncash
2beda7c2b3
kernel/process: Use accessors instead of class members for referencing segment array
...
Using member variables for referencing the segments array increases the
size of the class in memory for little benefit. The same behavior can be
achieved through the use of accessors that just return the relevant
segment.
2018-08-03 14:45:45 -04:00
Lioncash
26de4bb521
core/memory: Get rid of 3DS leftovers
...
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
bunnei
4c3c608d59
Merge pull request #894 from lioncash/object
...
kernel: Move object class to its own source files
2018-08-03 00:28:43 -04:00
bunnei
4b84d5bcec
Merge pull request #904 from lioncash/static
...
kernel/thread: Minor changes
2018-08-03 00:19:29 -04:00
Lioncash
d94a173877
kernel/vm_manager: Convert loop into std::any_of()
2018-08-02 12:46:15 -04:00
Lioncash
c4e0c3d76c
kernel/vm_manager: Use const where applicable
...
Makes our immutable state explicit.
2018-08-02 12:21:46 -04:00
Lioncash
ce5ad45278
kernel/vm_manager: Use the VAddr type alias in CarveVMA()
...
These two variables correspond to address ranges.
2018-08-02 12:15:50 -04:00
Lioncash
6058c84b79
kernel/thread: Make GetFreeThreadLocalSlot()'s loop indices size_t
...
Avoids using a u32 to compare against a range of size_t, which can be a
source of warnings. While we're at it, compress a std::tie into a
structured binding.
2018-08-02 12:01:25 -04:00
Lioncash
fac0e42b2f
kernel/thread: Make GetFreeThreadLocalSlot() reference parameter a const reference
...
This function only reads the data being referenced, it doesn't modify
it, so we can turn the reference into a const reference.
2018-08-02 11:56:11 -04:00
Lioncash
9a50a4f2cc
kernel/thread: Make GetFreeThreadLocalSlot() internally linked
...
This function isn't used outside of this translation unit, so we can
make it internally linked.
2018-08-02 11:54:23 -04:00
Lioncash
bf45092c61
kernel: Move object class to its own source files
...
General moving to keep kernel object types separate from the direct
kernel code. Also essentially a preliminary cleanup before eliminating
global kernel state in the kernel code.
2018-08-01 23:34:42 -04:00
Lioncash
49e198b20d
kernel/thread: Remove unimplemented function prototype
...
Given there's no implementation, we may as well remove the code
entirely.
2018-07-31 23:21:38 -04:00
bunnei
ff2c1b0a94
Merge pull request #877 from lioncash/remove
...
kernel: Remove unused object_address_table.cpp/.h
2018-07-31 20:11:39 -07:00
Lioncash
369f6e58aa
kernel: Remove unused object_address_table.cpp/.h
...
These source files were entirely unused throughout the rest of the
codebase. This also has the benefit of getting rid of a global variable
as well.
2018-07-31 11:03:08 -04:00
Lioncash
a2304fad16
kernel: Remove unnecessary includes
...
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
2018-07-31 10:15:17 -04:00
Lioncash
0cd843151f
kernel/timer: Make data members private where applicable
...
Instead, we can just expose functions that return the queryable state
instead of letting anything modify it.
2018-07-26 09:51:44 -04:00
Mat M
d3fd0351a7
Merge pull request #804 from lioncash/log
...
svc: Log parameters in SetMemoryAttribute()
2018-07-25 14:43:24 -04:00
bunnei
657bd113e3
Merge pull request #803 from MerryMage/core_timing_util
...
core_timing: Split off utility functions into core_timing_util
2018-07-25 11:09:31 -07:00
Lioncash
c73410bf2c
svc: Resolve sign comparison warnings in WaitSynchronization()
...
The loop's induction variable was signed, but we were comparing against
an unsigned variable.
2018-07-24 09:55:17 -04:00
Lioncash
8e8e906432
svc: Log parameters in SetMemoryAttribute()
...
Provides slightly more context than only logging out the address value.
2018-07-24 09:46:46 -04:00
bunnei
d092ea0870
Merge pull request #794 from lioncash/ref
...
mutex: Pass SharedPtr to GetHighestPriorityMutexWaitingThread() by reference
2018-07-24 04:45:34 -07:00
MerryMage
44646e2ea0
core_timing: Split off utility functions into core_timing_util
2018-07-24 11:03:24 +01:00
Lioncash
42b5158c96
mutex: Pass SharedPtr to GetHighestPriorityMutexWaitingThread() by reference
...
The pointed to thread's members are simply observed in this case, so we
don't need to copy it here.
2018-07-23 22:54:35 -04:00
Lioncash
22fd3f0026
hle_ipc: Make constructors explicit where applicable
2018-07-23 22:40:24 -04:00
Lioncash
cbe841c9c9
hle: Remove config_mem.h/.cpp
...
This is just an unused hold-over from citra, so we can get rid of this
to trim off an exposed global, among other things.
2018-07-23 12:57:34 -04:00
Lioncash
1f3889a290
hle: Remove shared_page.h/.cpp
...
This is a holdover from citra that's essentially unused.
2018-07-23 12:53:07 -04:00
Subv
7841447cf0
Kernel/SVC: Perform atomic accesses in SignalProcessWideKey as per the real kernel.
2018-07-22 12:27:24 -05:00
bunnei
fe2498a650
Merge pull request #751 from Subv/tpidr_el0
...
CPU: Save and restore the TPIDR_EL0 system register on every context switch
2018-07-21 10:48:30 -07:00
Subv
d84eb9dac6
CPU: Save and restore the TPIDR_EL0 system register on every context switch.
...
Note that there's currently a dynarmic bug preventing this register from being written.
2018-07-20 19:57:45 -05:00
Lioncash
dbfe82773d
thread: Convert ThreadStatus into an enum class
...
Makes the thread status strongly typed, so implicit conversions can't
happen. It also makes it easier to catch mistakes at compile time.
2018-07-19 22:08:56 -04:00
bunnei
d3cfaf95c8
Merge pull request #726 from lioncash/overload
...
hle_ipc: Introduce generic WriteBuffer overload for multiple container types
2018-07-19 16:18:38 -07:00
bunnei
2194308245
Merge pull request #721 from lioncash/svc
...
svc: Correct always true assertion case in SetThreadCoreMask
2018-07-19 16:11:40 -07:00
Lioncash
ff500a7b68
hle_ipc: Introduce generic WriteBuffer overload for multiple container types
...
This introduces a slightly more generic variant of WriteBuffer().
Notably, this variant doesn't constrain the arguments to only accepting
std::vector instances. It accepts whatever adheres to the
ContiguousContainer concept in the C++ standard library.
This essentially means, std::array, std::string, and std::vector can be
used directly with this interface. The interface no longer forces you to
solely use containers that dynamically allocate.
To ensure our overloads play nice with one another, we only enable the
container-based WriteBuffer if the argument is not a pointer, otherwise
we fall back to the pointer-based one.
2018-07-19 17:05:12 -04:00
Lioncash
b879fb84a2
svc: Correct always true assertion case in SetThreadCoreMask
...
The reason this would never be true is that ideal_processor is a u8 and
THREADPROCESSORID_DEFAULT is an s32. In this case, it boils down to how
arithmetic conversions are performed before performing the comparison.
If an unsigned value has a lesser conversion rank (aka smaller size)
than the signed type being compared, then the unsigned value is promoted
to the signed value (i.e. u8 -> s32 happens before the comparison). No
sign-extension occurs here either.
An alternative phrasing:
Say we have a variable named core and it's given a value of -2.
u8 core = -2;
This becomes 254 due to the lack of sign. During integral promotion to
the signed type, this still remains as 254, and therefore the condition
will always be true, because no matter what value the u8 is given it
will never be -2 in terms of 32 bits.
Now, if one type was a s32 and one was a u32, this would be entirely
different, since they have the same bit width (and the signed type would
be converted to unsigned instead of the other way around) but would
still have its representation preserved in terms of bits, allowing the
comparison to be false in some cases, as opposed to being true all the
time.
---
We also get rid of two signed/unsigned comparison warnings while we're
at it.
2018-07-19 15:46:17 -04:00
Lioncash
af2698dcea
hle_ipc: Amend usage of buffer_index within one of HLERequestContext's WriteBuffer() overloads
...
Previously, the buffer_index parameter was unused, causing all writes to
use the buffer index of zero, which is not necessarily what is wanted
all the time.
Thankfully, all current usages don't use a buffer index other than zero,
so this just prevents a bug before it has a chance to spring.
2018-07-19 11:10:16 -04:00
bunnei
368e1d25be
Merge pull request #692 from lioncash/assign
...
address_arbiter: Correct assignment within an assertion statement in WakeThreads()
2018-07-18 20:56:28 -07:00
bunnei
85421f3406
Merge pull request #690 from lioncash/move
...
core/memory, core/hle/kernel: Use std::move where applicable
2018-07-18 20:55:55 -07:00
bunnei
90ce935f3d
Merge pull request #688 from lioncash/comma
...
vm_manager: Add missing commas to string literal array elements in GetMemoryStateName()
2018-07-18 18:59:09 -07:00
Lioncash
2cd3141c30
address_arbiter: Correct assignment within an assertion statement in WakeThreads()
...
This was introduced within 4f81bc4e1b
, and
considering there's no comment indicating that this is intentional, this
is very likely a bug.
2018-07-18 19:46:46 -04:00
Lioncash
93cba6f699
vm_manager: Add missing commas to string literal array elements in GetMemoryStateName()
...
Without these, this would perform concatenation, which is definitely not
what we want here.
2018-07-18 19:37:19 -04:00
Lioncash
46458e7284
core/memory, core/hle/kernel: Use std::move where applicable
...
Avoids pointless copies
2018-07-18 19:34:31 -04:00
Lioncash
3a4841e403
core: Don't construct instance of Core::System, just to access its live instance
...
This would result in a lot of allocations and related object
construction, just to toss it all away immediately after the call.
These are definitely not intentional, and it was intended that all of
these should have been accessing the static function GetInstance()
through the name itself, not constructed instances.
2018-07-18 18:18:27 -04:00
bunnei
88a3140c9b
Merge pull request #671 from MerryMage/clear-exclusive-state
...
scheduler: Clear exclusive state when switching contexts
2018-07-17 07:33:32 -07:00
bunnei
519035db3d
Merge pull request #672 from SciresM/to_address_fix
...
svc:: Fix bug in svcWaitForAddress
2018-07-17 07:32:42 -07:00
bunnei
170e19d4ea
nvflinger: Fix for BufferQueue event handling.
2018-07-17 00:26:23 -04:00
Michael Scire
3b885691a1
Kernel/Arbiter: Fix bug in WaitIfLessThan
2018-07-16 20:55:53 -06:00
MerryMage
56cc1c11ec
scheduler: Clear exclusive state when switching contexts
2018-07-16 11:24:00 +01:00
David Marcec
a7d6c0d6ea
No need to use ASSERT_MSG with an empty message
2018-07-14 23:13:16 +10:00
James Rowe
0d46f0df12
Update clang format
2018-07-02 21:45:47 -04:00
James Rowe
638956aa81
Rename logging macro back to LOG_*
2018-07-02 21:45:47 -04:00
bunnei
6d7941042b
Merge pull request #579 from SciresM/master
...
svc: Fully implement svcSignalToAddress and svcWaitForAddress
2018-06-22 12:08:39 -04:00
mailwl
a27befe456
IPC: skip empty buffer write
...
prevent yuzu crash, if games, like Axiom Verge, trying to read 0 bytes from file
2018-06-22 11:28:10 +03:00
Michael Scire
067ac434ba
Kernel/Arbiters: Fix casts, cleanup comments/magic numbers
2018-06-22 00:47:59 -06:00
Michael Scire
5f8aa02584
Add additional missing format.
2018-06-21 21:09:51 -06:00
Michael Scire
08d454e30d
Run clang-format on PR.
2018-06-21 21:05:34 -06:00
Michael Scire
dc70a87af1
Kernel/Arbiters: HLE is atomic, adjust code to reflect that.
2018-06-21 20:25:57 -06:00
Michael Scire
8f8fe62a19
Kernel/Arbiters: Initialize arb_wait_address in thread struct.
2018-06-21 05:13:06 -06:00
Michael Scire
62bd1299ea
Kernel/Arbiters: Clear WaitAddress in SignalToAddress
2018-06-21 04:20:39 -06:00
Michael Scire
4f81bc4e1b
Kernel/Arbiters: Mostly implement SignalToAddress
2018-06-21 04:10:11 -06:00
Michael Scire
9d71ce88ce
Kernel/Arbiters: Implement WaitForAddress
2018-06-21 01:40:29 -06:00
Michael Scire
7e191dccc1
Kernel/Arbiters: Add stubs for 4.x SignalToAddress/WaitForAddres SVCs.
2018-06-21 00:49:43 -06:00
Subv
a3d82ef5d9
Build: Fixed some MSVC warnings in various parts of the code.
2018-06-20 11:39:10 -05:00
bunnei
4ac4b308e4
Merge pull request #572 from Armada651/user-except-stub
...
svc: Add a stub for UserExceptionContextAddr.
2018-06-18 11:37:13 -04:00
Jules Blok
bf4e2b2f0b
svc: Add a stub for UserExceptionContextAddr.
2018-06-18 09:29:11 +02:00
Subv
9cd87a6352
Kernel/Threads: A thread waking up by timeout from a WaitProcessWideKey may already have an assigned lock owner.
...
This situation may happen like so:
Thread 1 with low priority calls WaitProcessWideKey with timeout.
Thread 2 with high priority calls WaitProcessWideKey without timeout.
Thread 3 calls SignalProcessWideKey
- Thread 2 acquires the lock and awakens.
- Thread 1 can't acquire the lock and is put to sleep with the lock owner being Thread 2.
Thread 1's timeout expires, with the lock owner still being set to Thread 2.
2018-06-02 14:06:35 -05:00
Subv
c02d7c8ce7
Kernel/Thread: Corrected a typo that caused the affinity mask to never be changed.
2018-05-30 21:36:29 -05:00
Subv
3957b0c34e
Kernel/SVC: Support special core values -2 and -3 in svcSetThreadCoreMask.
...
Also added some proper error handling.
2018-05-30 21:36:29 -05:00
Subv
d1f9c750a6
Kernel/Thread: Corrected a typo in an assert about the processor id.
2018-05-30 11:32:46 -05:00
greggameplayer
b16e5c6a81
Add & correct miscellaneous things ( #470 )
...
* add some InfoType
* correct OpenApplicationProxy cmd number
* add IDisplayController functions
* fix clang-format
* add more system languages
2018-05-25 22:31:54 -04:00
bunnei
3825b703fa
Merge pull request #454 from Subv/signal_processwide
...
Kernel/SVC: Signal the highest priority threads first in svcSignalProcessWideKey
2018-05-23 10:28:23 -04:00
bunnei
693f78e6c2
Merge pull request #457 from Subv/mutex_waiters
...
Mutex: Do not assert when the mutex waiting threads list isn't empty on mutex release.
2018-05-20 23:44:44 -04:00
Subv
fd500d3da6
Mutex: Do not assert when the mutex waiting threads list isn't empty on mutex release.
...
A thread may own multiple mutexes at the same time, and only release one of them while other threads are waiting for the other mutexes.
2018-05-20 14:41:58 -05:00
Subv
2a35a36251
Kernel/SVC: Signal the highest priority threads first in svcSignalProcessWideKey.
2018-05-19 16:58:30 -05:00
Subv
c74f2555b6
Kernel/Threads: Reschedule the proper core when operating on that core's threads.
2018-05-19 16:57:44 -05:00
Subv
fab3dd98fe
SVC: Removed unused WaitSynchronization1 function
2018-05-19 16:56:33 -05:00
David Marcec
fd86cdb2e2
Added RequestWithContext & ControlWithContext
2018-05-17 14:03:52 -07:00
bunnei
46ec9a9bc9
thread: Rename mask to affinity_masks.
2018-05-10 19:34:53 -04:00
bunnei
fbd7afefaa
thread: Support core change on ResumeFromWait and improve ChangeCore.
2018-05-10 19:34:53 -04:00
bunnei
91af2f94e8
scheduler: Protect scheduling functions with a global mutex.
2018-05-10 19:34:52 -04:00
bunnei
4822765fef
thread: Initialize ideal_core and mask members.
2018-05-10 19:34:52 -04:00
bunnei
8aa5d25f82
threading: Reschedule only on cores that are necessary.
2018-05-10 19:34:52 -04:00
bunnei
d6e3cd9a17
svc: Implement GetThreadCoreMask and SetThreadCoreMask.
2018-05-10 19:34:51 -04:00
bunnei
6ea8b3ef60
thread: Implement ChangeCore function.
2018-05-10 19:34:50 -04:00
bunnei
1c36f2a798
svc: SignalProcessWideKey should apply to all cores.
2018-05-10 19:34:49 -04:00
bunnei
6a890023e9
svc: Implement GetCurrentProcessorNumber.
2018-05-10 19:34:49 -04:00
bunnei
a434fdcb10
core: Implement multicore support.
2018-05-10 19:34:46 -04:00
bunnei
1147db9dd1
Merge pull request #431 from lioncash/fmt
...
general: Make formatting of logged hex values more straightforward
2018-05-02 15:24:41 -04:00
Lioncash
7c9644646f
general: Make formatting of logged hex values more straightforward
...
This makes the formatting expectations more obvious (e.g. any zero padding specified
is padding that's entirely dedicated to the value being printed, not any pretty-printing
that also gets tacked on).
2018-05-02 09:49:36 -04:00
bunnei
fadab1d5f3
ipc: Add support for PopIpcInterface() method.
...
- This can be used for domain objects as inputs to service functions.
2018-05-01 21:57:44 -04:00
David
ff2f0d980a
GetSharedFontInOrderOfPriority ( #381 )
...
* GetSharedFontInOrderOfPriority
* Update pl_u.cpp
* Ability to use ReadBuffer and WriteBuffer with different buffer indexes, fixed up GetSharedFontInOrderOfPriority
* switched to NGLOG
* Update pl_u.cpp
* Update pl_u.cpp
* language_code is actually language code and not index
* u32->u64
* final cleanups
2018-05-01 16:28:36 -04:00
Lioncash
0197e28cc9
core_timing: Namespace all functions and constants in core_timing's header
...
All of these variables and functions are related to timings and should be within the namespace.
2018-04-30 03:32:59 -04:00
Lioncash
3abba08080
string_util: Remove StringFromFormat() and related functions
...
Given we utilize fmt, we don't need to provide our own functions for formatting anymore
2018-04-29 18:52:33 -04:00
Lioncash
843dd62c81
core: Replace usages of LOG_GENERIC with new fmt-capable equivalents
2018-04-27 11:57:52 -04:00
Lioncash
8475496630
general: Convert assertion macros over to be fmt-compatible
2018-04-27 10:04:02 -04:00
Lioncash
1913cf4783
kernel/shared_memory: Remove unnecessary semicolon at end of ConvertPermissions()
...
Functions don't need to be terminated by semicolons.
2018-04-25 20:32:16 -04:00
Lioncash
40dee76c57
kernel: Migrate logging macros to fmt-compatible ones
2018-04-25 20:32:09 -04:00
bunnei
0214351f4f
Merge pull request #370 from Subv/sync_primitives
...
Kernel: Reworked the new kernel synchronization primitives.
2018-04-23 16:33:00 -04:00
Subv
46572d027d
Kernel: Implemented mutex priority inheritance.
...
Verified with a hwtest and implemented based on reverse engineering.
Thread A's priority will get bumped to the highest priority among all the threads that are waiting for a mutex that A holds.
Once A releases the mutex and ownership is transferred to B, A's priority will return to normal and B's priority will be bumped.
2018-04-23 11:23:44 -05:00
Subv
a70ed9c8ae
Kernel: Use 0x2C as default main thread priority for homebrew and lone NRO/NSOs
2018-04-20 21:04:35 -05:00
Subv
013778aa21
Qt: Update the WaitTree widget to show info about the current mutex of each thread.
2018-04-20 21:04:34 -05:00
Subv
be155f4d9d
Kernel: Remove unused ConditionVariable class.
2018-04-20 21:04:33 -05:00
Subv
5fdfbfe25a
Kernel: Remove old and unused Mutex code.
2018-04-20 21:04:32 -05:00
Subv
b18ccf9399
Kernel: Properly implemented svcWaitProcessWideKey and svcSignalProcessWideKey
...
They work in tandem with guest code to provide synchronization primitives along with svcArbitrateLock/Unlock
2018-04-20 21:04:27 -05:00
Subv
e81a2080eb
Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.
...
Switch mutexes are no longer kernel objects, they are managed in userland and only use the kernel to handle the contention case.
Mutex addresses store a special flag value (0x40000000) to notify the guest code that there are still some threads waiting for the mutex to be released. This flag is updated when a thread calls ArbitrateUnlock.
TODO:
* Fix svcWaitProcessWideKey
* Fix svcSignalProcessWideKey
* Remove the Mutex class.
2018-04-20 21:04:25 -05:00
Lioncash
bec05db746
resource_limit: Make ResourceTypes an enum class
...
Prevents enum identifiers from leaking into the surrounding scope.
2018-04-20 19:41:45 -04:00
Lioncash
d9e316e353
common_funcs: Remove ARRAY_SIZE macro
...
C++17 has non-member size() which we can just call where necessary.
2018-04-19 22:36:52 -04:00
Hexagon12
e52a87b98a
Various service name fixes - part 2 (rebased) ( #322 )
...
* Updated ACC with more service names
* Updated SVC with more service names
* Updated set with more service names
* Updated sockets with more service names
* Updated SPL with more service names
* Updated time with more service names
* Updated vi with more service names
2018-04-17 11:37:43 -04:00
bunnei
43f0f163e1
vm_manager: Increase GetTotalMemoryUsage value.
...
- Gets Binding of Isaac running.
2018-04-14 22:04:10 -04:00
bunnei
40bccd74d3
svc: Stub out SetThreadActivity, GetThreadContext.
2018-04-02 23:51:01 -04:00
bunnei
99ae9dbf49
shared_memory: Remove incorrect 3ds-specific check.
2018-04-02 23:50:58 -04:00
bunnei
f4ba523992
hle_ipc, fsp_srv: Cleanup logging.
2018-03-31 23:30:00 -04:00
bunnei
eef097bdc7
hle_ipc: Do not ensure write buffer size.
2018-03-31 16:06:46 -04:00
bunnei
b27ab46bde
memory: Fix stack region.
2018-03-31 16:06:45 -04:00
bunnei
f6893969b3
svc: Stub GetThreadCoreMask.
2018-03-29 21:23:15 -04:00
N00byKing
1d8b6ad13b
Clang Fixes
2018-03-19 17:53:35 +01:00
N00byKing
0e72d0d826
More Warning cleanups
2018-03-19 17:27:04 +01:00
N00byKing
ef875d6a35
Clean Warnings (?)
2018-03-19 17:07:08 +01:00
bunnei
c86af6939c
hle_ipc: Add SleepClientThread to block current thread within HLE routines.
2018-03-18 20:56:34 -04:00
bunnei
2faa83ca13
hle_ipc: Use shared_ptr instead of unique_ptr to allow copies.
2018-03-18 20:56:33 -04:00
bunnei
019f1a0cf0
hle_ipc: Remove GetPointer(..) usage with WriteToOutgoingCommandBuffer.
2018-03-18 20:56:33 -04:00
bunnei
e353b9fb3d
thread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB.
2018-03-18 20:56:32 -04:00
bunnei
cc6f22e0e4
process: MirrorMemory should use MemoryState::Mapped.
2018-03-16 19:24:54 -04:00
bunnei
e9a857ce82
process: Unmap previously allocated heap.
2018-03-16 18:32:25 -04:00
bunnei
403f8e79ea
arm_interface: Support unmapping previously mapped memory.
2018-03-16 18:32:24 -04:00
bunnei
34a29ad051
svc: Use more correct values for GetInfo MapRegion and NewMapRegion.
2018-03-16 18:32:23 -04:00
bunnei
8581404482
kernel: Move stack region outside of application heap.
2018-03-16 18:32:23 -04:00
bunnei
3923b0f589
process: Fix stack memory state.
2018-03-16 18:32:21 -04:00
bunnei
8be7131033
MemoryState: Add additional memory states and improve naming.
2018-03-16 18:32:21 -04:00
bunnei
7d6653268f
core: Move process creation out of global state.
2018-03-14 18:42:19 -04:00
bunnei
46fc7d8502
Merge pull request #216 from Subv/savedata
...
Implemented the SaveData archive and MountSaveData.
2018-03-01 22:14:31 -05:00
Subv
827f8ca3c7
Kernel: Store the program id in the Process class instead of the CodeSet class.
...
There may be many CodeSets per Process, so it's wasteful and overcomplicated to store the program id in each of them.
2018-03-01 19:03:53 -05:00
Jules Blok
c74af07c49
thread: Clear the process list on shutdown.
2018-02-27 17:13:39 +01:00
bunnei
926604fc14
Merge pull request #207 from mailwl/duplicatesession
...
IPC: add domain header to response if only it exists in request
2018-02-26 20:52:56 -08:00
bunnei
f1beb69899
Merge pull request #215 from N00byKing/umapsharedmmry
...
UnmapSharedMemory
2018-02-25 21:04:24 -08:00
N00byKing
08c6ac02cf
(Hopefully) Fix MinGW Build
2018-02-25 13:40:22 +01:00
N00byKing
2b41c6e573
Add UnmapSharedMemory
...
C++11 requires spaces on the Identifier
Add inttypes include
clang
2018-02-25 11:38:06 +01:00
mailwl
e4f94ee30b
Stub more functions
2018-02-22 17:28:15 +03:00
mailwl
1289a3c3c1
Add warning if Domain request has no domain message header
2018-02-20 22:51:54 +03:00
mailwl
827152d1fd
Fix: change check for domain order and existance of domain message header
2018-02-20 21:59:58 +03:00
mailwl
1572c45aa0
IPC: add domain header to response if only it exists in request
2018-02-20 19:27:49 +03:00
bunnei
8db80d8389
scheduler: Cleanup based on PR feedback.
2018-02-19 16:46:42 -05:00
bunnei
ac81c02ed9
kernel: Use Scheduler class for threading.
2018-02-18 15:17:16 -05:00
bunnei
c78d495161
kernel: Add Scheduler, which encapsulates the scheduling loading from Thread module.
2018-02-18 14:58:40 -05:00
bunnei
cec0d4f191
kernel: Remove unused address_arbiter code.
2018-02-18 14:46:11 -05:00
Subv
94ee8fc97b
Kernel/IPC: Add a small delay after each SyncRequest to prevent thread starvation.
...
Ported from citra PR #3091
The delay specified here is from a Nintendo 3DS, and should be measured in a Nintendo Switch.
This change is enough to prevent Puyo Puyo Tetris's main thread starvation.
2018-02-18 13:25:48 -05:00
mailwl
6797d4a907
Service/hid: stub some functions
2018-02-16 06:15:05 +03:00
bunnei
df008a159b
shared_memory: Remove some checks.
2018-02-14 22:24:06 -05:00
bunnei
db873a232c
Merge pull request #188 from bunnei/refactor-buffer-descriptor
...
Refactor IPC buffer descriptor interface
2018-02-14 18:31:53 -05:00
bunnei
88bfec37ce
hle_ipc: Remove const from WriteBuffer size.
2018-02-14 14:21:10 -05:00
Lioncash
c1146d2a5f
thread: Silence formatting specifier warnings
2018-02-14 01:50:14 -05:00
Lioncash
1e33db8573
vm_manager: Silence formatting specifier warnings
2018-02-14 01:50:14 -05:00
bunnei
6fd19f05f1
hle_ipc: Add GetReadBufferSize and check write buffer size.
2018-02-14 00:14:17 -05:00
bunnei
fc1b425520
hle_ipc: Add helper functions for reading and writing buffers.
2018-02-13 23:54:07 -05:00
bunnei
1ce6fff064
hle_ipc: Add helper functions for reading and writing buffers.
2018-02-13 23:26:03 -05:00
bunnei
903beb43a8
mutex: Update hasWaiters on release.
2018-02-05 21:54:10 -05:00
bunnei
42fc437268
GetInfo: Implement IsCurrentProcessBeingDebugged.
2018-02-04 12:34:45 -05:00
bunnei
0b6b147939
WaitProcessWideKeyAtomic: Handle case where condition variable was already created.
2018-02-04 12:30:51 -05:00
bunnei
647364db8f
svc: SharedMemory size should be 64-bits and cleanup.
2018-02-03 13:36:54 -05:00
bunnei
f9c9ce2005
ArbitrateLock: Assert that requesting_thread is current_thread.
2018-02-03 13:29:18 -05:00
shinyquagsire23
96c444d1ff
shared_memory: Only mark addresses as invalid if they are within the heap
2018-01-29 23:38:56 -07:00
bunnei
c1a8e4bfe4
Merge pull request #148 from MerryMage/feature/special-memory
...
memory: Replace all memory hooking with Special regions
2018-01-27 15:20:53 -05:00
MerryMage
738f91a57d
memory: Replace all memory hooking with Special regions
2018-01-27 15:16:39 +00:00
bunnei
7588b24f46
server_session: Fix scenario where all domain handlers are closed.
2018-01-24 22:24:16 -05:00
bunnei
1b1d399e5f
hle: Rename RequestBuilder to ResponseBuilder.
2018-01-24 22:24:10 -05:00
bunnei
f0035420d7
ipc_helpers: Make interface domain agnostic and add header validation.
2018-01-24 22:19:01 -05:00
bunnei
27bad0598a
hle: Integrate Domain handling into ServerSession.
2018-01-24 22:18:56 -05:00
bunnei
67758857e4
hle: Remove Domain and SyncObject kernel objects.
2018-01-24 22:18:54 -05:00
bunnei
932fa94af7
handle_table: Remove ConvertSessionToDomain.
2018-01-24 22:18:51 -05:00
James Rowe
096be16636
Format: Run the new clang format on everything
2018-01-20 16:45:11 -07:00
David
0b6da0c1ab
Added CreateSharedMemory & UNIMPLEMENTED() for non existent services. ( #113 )
...
* Added svcCreateSharedMemory
* Services which are not implemented now throw UNIMPLEMENTED()
* clang-format
* changed perms to u32
* removed camelcase
2018-01-19 19:35:25 -05:00
River City Ransomware
dd62f125c3
Fixes some cast warnings, partial port of citra #3064 ( #106 )
...
* Fixes some cast warnings, partially fixes citra #3064
* Converted casts to uint32_t to u32
* Ran clang-format
2018-01-19 18:01:41 -05:00
bunnei
e1ee8f4657
svc: Fix svcGetInfo MapRegionBaseAddr.
2018-01-18 23:44:15 -05:00
bunnei
d80991977a
svc: Add additional fields to MemoryInfo struct.
2018-01-18 23:37:54 -05:00
gdkchan
59575d5cae
Stub PopLaunchParameter and implement Buffer C Descriptors reading on hle_ipc ( #96 )
...
* Stub PopLaunchParameter and implement Buffer C Descriptors reading
* Address PR feedback
* Ensure we push a u64 not a size_t
* Fix formatting
2018-01-18 14:54:34 -05:00
Lioncash
4497eb4528
svc: Rename some entries to match their analogue on SwitchBrew
...
Makes the codebase a little more consistent with regards to available documentation. Also amends the duplicate case where there was a similar entry at 0x72 named ConnectToPort.
2018-01-17 20:38:23 -05:00
Lioncash
c81ed5eb33
svc: Add CreateJitMemory and MapJitMemory svc strings
...
Makes the table match SwitchBrew for these entries
2018-01-17 20:32:56 -05:00
bunnei
7fa32af1c7
svc: Clang-format fix.
2018-01-17 12:19:17 -05:00
bunnei
b588cbcb1d
hle_ipc: Clang format.
2018-01-17 11:37:26 -05:00
bunnei
30cb98f874
ipc: Implement domain command CloseVirtualHandle.
2018-01-17 01:20:10 -05:00
Subv
bf0e20c571
SVC: Correct some return values in svcGetInfo and added TitleId and PrivilegedProcessId stubs.
...
# Conflicts:
# src/core/hle/kernel/svc.cpp
2018-01-16 18:50:23 -05:00
Subv
3442f4b96a
SVC: Add 4.0.0+ comment to GetInfoType enum values.
2018-01-16 18:44:39 -05:00
Subv
5bc14e791a
IPC: Push domain objects as move handles when not in a domain.
2018-01-16 18:42:08 -05:00
bunnei
1aa4cdc3c8
Merge pull request #52 from ogniK5377/fsp
...
added more svcGetInfo pairs for 3.0.0+ support, Changed HEAP_SIZE and TLS_AREA_VADDR. changed mem usage & heap usage stub added, ISelfController, IApplication function stubs. Added SetThreadCoreMask
2018-01-16 18:27:48 -05:00
David Marcec
bb7221c5d5
SetThreadCoreMask stub, time to implement fsp
2018-01-16 14:23:53 -08:00
David Marcec
68143af636
Added more svcGetInfo pairs
2018-01-16 14:06:45 -08:00
MerryMage
e35644c005
clang-format
2018-01-16 18:05:21 +00:00
bunnei
22659afcd0
shared_memory: Minor fixes and cleanup.
2018-01-14 17:20:55 -05:00
bunnei
974362bc12
svc: Implement svcMapSharedMemory.
2018-01-14 17:20:55 -05:00
bunnei
bd58c5470c
kernel: Increase default stack size to 64K.
2018-01-14 17:20:55 -05:00
bunnei
1247c53786
yuzu: Update license text to be consistent across project.
2018-01-13 16:22:39 -05:00
bunnei
056f987bcd
core: Include <algorithm> where used.
2018-01-11 22:36:56 -05:00
bunnei
039fc7f985
core: Fix recent GCC build breaks.
2018-01-11 22:24:09 -05:00
bunnei
97ef21e166
svc: Implement GetSystemTick.
2018-01-11 21:59:31 -05:00
Subv
ab86b80cac
IPC: Corrected some definitions for the buffer C descriptor flags.
2018-01-10 23:28:02 -05:00
Subv
ba02f0deef
svc: Stub ResetSignal and CreateTransferMemory
2018-01-10 23:27:59 -05:00
Subv
0a1278081e
svc: Stub SetMemoryAttribute
2018-01-10 23:27:56 -05:00
Subv
7ad20154fc
Threads: Added enum values for the Switch's 4 cpu cores and implemented svcGetInfo(AllowedCpuIdBitmask)
2018-01-10 01:01:55 -05:00
Subv
c2ee513d35
SVC: Fixed WaitSynchronization with multiple handles when none is immediately ready.
2018-01-09 15:02:43 -05:00
Subv
bc91ebacc1
SVC: Implemented CancelSynchronization.
2018-01-09 15:02:04 -05:00
Subv
a418f6e77b
ErrorCodes: Updated the InvalidHandle and Timeout kernel error codes.
2018-01-09 12:05:10 -05:00
Subv
8d9250fa70
SVC: Fixed WaitSynchronization with multiple handles when at least one of them is ready.
2018-01-09 11:53:50 -05:00
bunnei
4236799832
kernel: Rename Semaphore to ConditionVariable.
2018-01-08 21:41:37 -05:00
bunnei
9fcd2bf672
mutex: Remove unused call to VerifyGuestState.
2018-01-08 21:12:56 -05:00
Subv
db3a525166
Kernel: Actually wake up the requested number of threads in Semaphore::Release.
...
Also properly keep track of data in guest memory, this fixes managing the semaphore from userland.
It was found that Semaphores are actually Condition Variables, with Release(1) and Release(-1) being equivalent to notify_one and notify_all. We should change the name of the class to reflect this.
2018-01-08 21:12:54 -05:00
Subv
1bbe9309da
Kernel: Properly keep track of mutex lock data in the guest memory. This fixes userland locking/unlocking.
2018-01-08 21:12:51 -05:00
Subv
2a3f8e8484
Kernel: Allow chaining WaitSynchronization calls inside a wakeup callback.
2018-01-08 21:12:49 -05:00
B3n30
82151d407d
CoreTiming: Reworked CoreTiming (cherry-picked from Citra #3119 )
...
* CoreTiming: New CoreTiming; Add Test for CoreTiming
2018-01-08 19:10:25 -05:00
Subv
32847d8b86
IPC: Add functions to read the input move/copy objects from an IPC request.
2018-01-07 17:11:51 -05:00
Subv
7e3561b1cd
IPC: Don't attempt to read the command buffer if it holds a Close request.
2018-01-07 17:11:49 -05:00
Subv
0368324f79
IPC Cleanup: Remove 3DS-specific code and translate copy, move and domain objects in IPC requests.
...
Popping objects from the buffer is still not implemented.
2018-01-07 17:11:47 -05:00
Subv
b0ceb4df70
IPC: Skip the entire u64 of the command id when receiving an IPC request.
...
Service code now doesn't have to deal with this.
2018-01-07 17:11:45 -05:00
Subv
226786f0b0
IPC: Use the correct size when pushing raw data to the command buffer and fixed pushing domain objects.
...
Domain object ids are always stored immediately after the raw data.
2018-01-07 17:11:43 -05:00
bunnei
bc8ef64804
svc: Implement svcSignalProcessWideKey.
2018-01-07 16:55:17 -05:00
bunnei
4e33b4b42f
semaphore: More changes for Switch.
2018-01-07 16:52:23 -05:00
bunnei
0f6fbdb963
wait_object: Refactor to allow waking up a single thread.
2018-01-07 16:33:41 -05:00
bunnei
5017038ca7
svc: Implement svcWaitProcessWideKeyAtomic.
2018-01-06 16:14:12 -05:00
bunnei
91f10a1460
semaphore: Updates for Switch.
2018-01-06 15:55:40 -05:00
bunnei
0e978bdd50
svc: Implement WaitSynchronization for a single handle.
2018-01-06 14:34:32 -05:00
bunnei
57f42e5887
svc: Refactor LockMutex code to use WaitSynchronization1.
2018-01-06 14:19:28 -05:00
bunnei
0dbc8f3577
svc: Add missing string_util include.
2018-01-04 19:45:15 -05:00
bunnei
b172f0d770
arm: Remove SkyEye/Dyncom code that is ARMv6-only.
2018-01-02 22:24:12 -05:00
bunnei
f0eab802e8
vm_manager: Use a more reasonable MAX_ADDRESS size.
2018-01-02 21:37:56 -05:00
bunnei
81a8a57ce2
svc: Remove unnecessary "svc" prefix to naming scheme.
2018-01-02 20:47:26 -05:00
bunnei
480906fe1b
hle: Move SVC code to kernel namespace.
2018-01-02 20:40:30 -05:00
bunnei
e9710a2cf7
vm_manager: Stub out a bunch of interfaces used by svcGetInfo.
2018-01-01 15:59:31 -05:00
bunnei
93480b10ef
core/video_core: Fix a bunch of u64 -> u32 warnings.
2018-01-01 15:40:35 -05:00
bunnei
aa7c824ea4
svc: Implement svcExitProcess.
2018-01-01 14:38:34 -05:00
bunnei
b9950cd4b0
svc: Implement svcLockMutex.
2018-01-01 14:02:26 -05:00
bunnei
d0046b120a
kernel: Add ObjectAddressTable class.
2018-01-01 13:25:37 -05:00
bunnei
1cb978eb82
thread: Keep track of the initially created handle.
...
This is kinda crufty, but we need it for now to update guest state variables.
2017-12-31 17:23:36 -05:00
bunnei
c7983e970c
errors: Define missing kernel error codes.
2017-12-31 15:59:00 -05:00
bunnei
3a91a62b8f
svc: Implement svcUnmapMemory.
2017-12-31 15:22:49 -05:00
bunnei
b6087e35b5
thread: Main thread should set thread handle to reg 1.
2017-12-30 12:10:58 -05:00
bunnei
7ccd8de863
thread: Remove THUMB mode flag.
2017-12-30 12:08:26 -05:00
bunnei
eed4f2e229
thread: Main thread should be ready by default, all others dormant.
2017-12-30 12:05:10 -05:00
bunnei
ebd4b1422d
kernel: Various 64-bit fixes in memory/process/thread
2017-12-29 13:27:58 -05:00
bunnei
dcdaac8a0b
kernel: Fix implementation of ConvertSessionToDomain.
2017-12-29 00:36:22 -05:00
bunnei
e17c0019c5
kernel: Add basic support for Domain object.
2017-12-28 23:30:21 -05:00
bunnei
834fa5db65
kernel: Add SyncObject primitive, use it for ClientSession.
2017-12-28 23:12:28 -05:00
bunnei
3421e1617e
process: Add method to mirror a memory region.
2017-12-28 21:35:49 -05:00
bunnei
3597650f22
service: Return proper result code for IPC::CommandType::Close.
2017-10-31 19:30:05 -04:00
bunnei
34571f4d2e
hle: Use Switch formatted result codes.
2017-10-31 19:26:11 -04:00
bunnei
dcd6bb82f7
hle: Fix QueryMemory response for MemoryInfo.
2017-10-19 23:00:46 -04:00
bunnei
654fae29c1
hle_ipc: Only copy necessary fields for outgoing command buffer.
2017-10-18 21:39:48 -04:00
bunnei
b283cf7348
hle_ipc: Parse out buffer X/A/B/B descriptors from incoming command buffer.
2017-10-18 21:38:01 -04:00
bunnei
4fb1b24d68
hle: Implement ConvertSessionToDomain, various cleanups.
2017-10-15 01:24:22 -04:00
bunnei
960a1416de
hle: Initial implementation of NX service framework and IPC.
2017-10-14 22:18:42 -04:00
bunnei
b1d5db1cf6
Merge remote-tracking branch 'upstream/master' into nx
...
# Conflicts:
# src/core/CMakeLists.txt
# src/core/arm/dynarmic/arm_dynarmic.cpp
# src/core/arm/dyncom/arm_dyncom.cpp
# src/core/hle/kernel/process.cpp
# src/core/hle/kernel/thread.cpp
# src/core/hle/kernel/thread.h
# src/core/hle/kernel/vm_manager.cpp
# src/core/loader/3dsx.cpp
# src/core/loader/elf.cpp
# src/core/loader/ncch.cpp
# src/core/memory.cpp
# src/core/memory.h
# src/core/memory_setup.h
2017-10-09 23:56:20 -04:00
bunnei
23ce4f5afc
loader: Various improvements for NSO/NRO loaders.
2017-10-09 21:39:32 -04:00
bunnei
15c7641bef
Merge pull request #2977 from Subv/shmem_create
...
SharedMemory: Don't take over and unmap the source memory block when creating a shared memory, just reference it
2017-10-03 16:21:49 -04:00
Subv
b18589ecf7
Kernel/SharedMemory: Don't take over and unmap the source memory block when creating a shared memory, just reference it.
...
Also reference the right offset into the backing block for the requested address.
2017-10-02 15:16:16 -05:00
Sebastian Valle
30fabc41c6
Merge pull request #2971 from Subv/per_process_memops
...
Memory: Add overloads for ReadBlock and WriteBlock that operate on a specific process.
2017-10-01 14:44:06 -05:00
Subv
8217ed7acb
Kernel/Thread: Added a helper function to get a thread's command buffer VAddr.
2017-10-01 14:18:35 -05:00
bunnei
8c92435ded
nso: Refactor and allocate .bss section.
2017-09-30 14:33:58 -04:00
bunnei
fa1c7c7ee1
process: Support loading multiple codesets.
2017-09-30 14:33:11 -04:00
bunnei
c5ce5c06e4
kernel: Various threading fixes to support 64-bit addressing.
2017-09-30 14:28:54 -04:00
bunnei
f01472a5ff
core: Various changes to support 64-bit addressing.
2017-09-30 14:28:54 -04:00
Sebastian Valle
db752b52e8
Merge pull request #2967 from Subv/thread_wakeup_callbacks
...
Kernel/Threads: When putting a thread to wait, specify a function to execute when it is awoken
2017-09-30 09:12:18 -05:00
Huw Pascoe
a13ab958cb
Fixed type conversion ambiguity
2017-09-30 09:34:35 +01:00
Subv
8432749db7
Kernel/Threads: When putting a thread to wait, specify a function to execute when it is awoken.
...
This change makes for a clearer (less confusing) path of execution in the scheduler, now the code to execute when a thread awakes is closer to the code that puts the thread to sleep (WaitSynch1, WaitSynchN). It also allows us to implement the special wake up behavior of ReplyAndReceive without hacking up WaitObject::WakeupAllWaitingThreads.
If savestates are desired in the future, we can change this implementation to one similar to the CoreTiming event system, where we first register the callback functions at startup and assign their identifiers to the Thread callback variable instead of directly assigning a lambda to the wake up callback variable.
2017-09-28 11:53:32 -05:00
Subv
3165466b66
Kernel/Thread: Allow specifying which process a thread belongs to when creating it.
...
Don't automatically assume that Thread::Create will only be called when the parent process is currently scheduled. This assumption will be broken when applets or system modules are loaded.
2017-09-26 17:40:49 -05:00
MerryMage
c02bbb7030
memory: Add GetCurrentPageTable/SetCurrentPageTable
...
Don't expose Memory::current_page_table as a global.
2017-09-24 22:42:42 +01:00
B3n30
813837c5cf
Merge pull request #2842 from Subv/switchable_page_table
...
Kernel/Memory: Give each process its own page table and allow switching the current page table upon reschedule
2017-09-15 22:41:45 +02:00
Subv
b178089251
Kernel/Threads: Don't clear the CPU instruction cache when performing a context switch from an idle thread into a thread in the same process.
...
We were unnecessarily clearing the cache when going from Process A -> Idle -> Process A, this caused extreme performance regressions.
2017-09-15 14:26:15 -05:00
Subv
214150f00c
Kernel/Memory: Changed GetPhysicalPointer so that it doesn't go through the current process' page table to obtain a pointer.
2017-09-15 14:26:13 -05:00
Subv
c34ec5e77c
Kernel/Memory: Switch the current page table when a new process is scheduled.
2017-09-10 15:14:31 -05:00
Subv
6d2734a074
Kernel/Memory: Give each Process its own page table.
...
The loader is in charge of setting the newly created process's page table as the main one during the loading process.
2017-09-10 15:13:41 -05:00
James Rowe
61442d6afb
Merge pull request #2839 from Subv/global_kernel_lock
...
Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
2017-08-23 18:17:44 -06:00
bunnei
2bbff9fa96
Merge pull request #2893 from Subv/not_schedule_main_thread
...
Kernel/Threads: Don't immediately switch to the new main thread when loading a new process.
2017-08-22 17:45:47 -04:00
Subv
bca8916cea
Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
...
This mutex is acquired in SVC::CallSVC, ie, as soon as the guest application enters the HLE kernel, and should be acquired by the aforementioned threads before modifying kernel structures.
2017-08-22 09:30:55 -05:00
Subv
fa228ca637
Kernel/Threads: Don't immediately switch to the new main thread when loading a new process.
...
This is necessary for loading multiple processes at the same time.
The main thread will be automatically scheduled when necessary once the scheduler runs.
2017-08-21 20:54:29 -05:00
Subv
65f19b51c4
Warnings: Add UNREACHABLE macros to switches that contemplate all possible values.
2017-08-21 08:34:28 -05:00
Weiyi Wang
045d0b5bbd
Merge pull request #2799 from yuriks/virtual-cached-range-flush
...
Add address conversion functions returning optional, Add function to flush virtual region from rasterizer cache
2017-07-22 10:15:52 +03:00
Sebastian Valle
56d718b2a1
Merge pull request #2793 from Subv/replyandreceive
...
Kernel/SVC: Partially implemented svcReplyAndReceive
2017-06-29 17:05:22 -05:00
Subv
b53fa9514f
Kernel/SVC: Pass the current thread as a parameter to ClientSession::SendSyncRequest.
2017-06-29 12:30:34 -05:00
Subv
c3c9175a1c
Kernel/Sessions: Clean up the list of pending request threads of a session when the client endpoint is closed.
2017-06-25 23:38:29 -05:00
Subv
8feeb81af2
Kernel/ServerSession: Keep track of which threads have issued sync requests.
2017-06-25 14:47:25 -05:00
Yuri Kunde Schlesner
e192d417ec
Kernel: Implement AcceptSession SVC
2017-06-23 11:26:37 -07:00
Yuri Kunde Schlesner
326e7c7020
Memory: Make PhysicalToVirtualAddress return a boost::optional
...
And fix a few places in the code to take advantage of that.
2017-06-21 22:55:17 -07:00
Yuri Kunde Schlesner
f64d0b3f26
Kernel/IPC: Support translation of null handles
...
Missed this in my first implementation. Thanks to @wwylele for pointing
out that this was missing.
2017-06-21 14:27:03 -07:00
Weiyi Wang
c4f0927a62
Merge pull request #2789 from yuriks/misc-kernel
...
Trivial no-op additions
2017-06-21 20:34:12 +03:00
Yuri Kunde Schlesner
b21dfbb295
Merge pull request #2790 from yuriks/remove-movefrom
...
Remove ResultVal::MoveFrom
2017-06-20 22:04:09 -07:00
Yuri Kunde Schlesner
723dc644fa
ResultVal: Remove MoveFrom()
...
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in
case you already have an rvalue.
2017-06-18 19:03:15 -07:00
Yuri Kunde Schlesner
90b8d4dd36
Kernel: Add comment about the extended linear heap area
2017-06-18 18:38:40 -07:00
Yuri Kunde Schlesner
0dfafdbe59
Kernel/IPC: Make HLERequestContext usable from outside kernel
2017-06-18 16:05:12 -07:00
Yuri Kunde Schlesner
d8f6000f54
Kernel/IPC: Use boost::small_vector for HLE context objects
2017-06-11 16:34:13 -07:00
Yuri Kunde Schlesner
92ca422088
Kernel: Allow clearing request_objects to re-use buffer space
...
Reduces the necessary allocation to max(in_handles, out_handles) rather
than (in_handles + out_handles).
2017-06-11 13:10:21 -07:00
Yuri Kunde Schlesner
8cb65fe65a
Kernel: Basic support for IPC translation for HLE services
2017-06-11 13:10:21 -07:00
Yuri Kunde Schlesner
05fee70211
Kernel: Add methods in HLERequestContext abstracting handle creation
2017-06-11 13:07:33 -07:00
Yuri Kunde Schlesner
20e5abb308
ServiceFramework: Use separate copy of command buffer
...
Copy the IPC command buffer to/from the request context before/after the
handler is invoked. This is part of a move away from using global data
for handling IPC requests.
2017-06-11 13:07:33 -07:00
Yuri Kunde Schlesner
78398d0978
Merge pull request #2756 from yuriks/service-framework
...
New service framework
2017-06-08 21:03:03 -07:00
Yuri Kunde Schlesner
838faf147e
Session: Remove/add some forward declarations
2017-06-08 00:33:57 -07:00
Yuri Kunde Schlesner
d666e01cdf
Kernel: Ensure objects are kept alive during ClientSession disconnection
...
Fixes #2760
2017-06-08 00:33:24 -07:00
Yuri Kunde Schlesner
84c497292a
Service: Add new ServiceFramework framework for writing HLE services
...
The old "Interface" class had a few problems such as using free
functions (Which didn't allow you to write the service handler as if it
were a regular class.) which weren't very extensible. (Only received one
parameter with a pointer to the Interface object.)
The new ServiceFramework aims to solve these problems by working with
member functions and passing a generic context struct as parameter. This
struct can be extended in the future without having to update all
existing service implementations.
2017-06-08 00:11:37 -07:00
Yuri Kunde Schlesner
6dc133c24a
Kernel: Remove some unnecessary namespace qualifications
2017-06-06 14:51:42 -07:00
Yuri Kunde Schlesner
6354d08359
Kernel: Add a dedicated SetHleHandler method to ServerPort/ServerSession
...
This allows attaching a HLE handle to a ServerPort at any point after it
is created, allowing port/session creation to be generic between HLE and
regular services.
2017-06-06 02:56:32 -07:00
Yuri Kunde Schlesner
e626a520ca
HLE: Move SessionRequestHandler from Service:: to Kernel::
...
Most of the code that works with this is or will be in the kernel, so
it's a more appropriate place for it to be.
2017-06-05 23:40:11 -07:00
Yuri Kunde Schlesner
be031989ee
Kernel: Move HandleTable to a separate file
2017-05-29 17:34:39 -07:00
Yuri Kunde Schlesner
64ecf81a3c
Kernel: Move WaitObject to a separate file
...
Now that HandleTable doesn't directly depend on WaitObject anymore, this
can be separated from the main kernel.h header.
2017-05-29 16:16:46 -07:00
Yuri Kunde Schlesner
9453223075
Kernel: Removed HandleTable::GetWaitObject
...
This isn't necessary anymore since plain Get works correctly for
WaitObjects.
2017-05-29 15:10:06 -07:00
Yuri Kunde Schlesner
b17754f998
Kernel: Extract dynamic Object pointer cast into its own function
2017-05-29 14:42:27 -07:00
Yuri Kunde Schlesner
2cdb40d709
Kernel: Centralize error definitions in errors.h
2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
cc566dadd8
Merge pull request #2406 from Subv/session_disconnect
...
Kernel: Properly update port counters on session disconnection.
2017-05-21 17:18:16 -07:00
Subv
37347bfa38
Kernel/Sessions: Remove the ClientSession::Create function.
...
It is not meant to be used by anything other than CreateSessionPair.
2017-05-21 18:52:42 -05:00
Subv
ce5bc477ca
Kernel: Remove a now unused enum and variable regarding a session's status.
2017-05-15 11:22:16 -05:00
Subv
ddfabf3133
Kernel: Use a Session object to keep track of the status of a Client/Server session pair.
...
Reduce the associated port's connection count when a ServerSession is destroyed.
2017-05-15 11:22:15 -05:00
Yuri Kunde Schlesner
f18d454eb6
Kernel: Map special regions according to ExHeader
...
This replaces the hardcoded VRAM/DSP mappings with ones made based on
the ExHeader ARM11 Kernel caps list. While this has no visible effect
for most applications (since they use a standard set of mappings) it
does improve support for system modules and n3DS exclusives.
2017-05-09 21:44:00 -07:00
Yuri Kunde Schlesner
b4a93cfdde
DSP: Create backing memory for entire DSP RAM
...
Also move address space mapping out of video_core.
2017-05-09 21:44:00 -07:00
wwylele
85ba60d5ec
Timer: restore missing signaled=true from #2421
2017-02-27 22:49:46 +02:00
B3n30
dcf115778a
Fix log entry in timer::signal ( #2600 )
2017-02-27 11:04:03 -05:00
Mat M
0cb52ee74a
Doxygen: Amend minor issues ( #2593 )
...
Corrects a few issues with regards to Doxygen documentation, for example:
- Incorrect parameter referencing.
- Missing @param tags.
- Typos in @param tags.
and a few minor other issues.
2017-02-26 17:58:51 -08:00
Yuri Kunde Schlesner
b250ce21b9
Merge pull request #2587 from yuriks/status-bar
...
Replace built-in Profiler with indicators in status bar
2017-02-26 17:51:15 -08:00
Yuri Kunde Schlesner
441f8b5a4b
Core: Remove unnecessary include in thread.h
2017-02-26 17:22:01 -08:00
Subv
029a11030e
Timers: Immediately signal the timer if it was started with an initial value of 0.
2017-02-21 20:51:54 -05:00
Subv
1ddff14511
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
f2f2572fed
Thread: Added priority range checking to svcSetThreadPriority and removed priority clamping code from Thread::SetPriority.
2017-01-11 16:38:04 -05:00
bunnei
84d72fd92f
Merge pull request #2397 from Subv/pulse
...
Kernel: Implemented Pulse event and timers.
2017-01-10 10:45:00 -05:00
bunnei
b5eac78b43
Merge pull request #2410 from Subv/sleepthread
...
Don't yield execution in SleepThread(0) if there are no available threads to run
2017-01-06 22:01:33 -05:00
bunnei
59f4f1d7ff
Merge pull request #2396 from Subv/sema_acquire
...
Kernel/Semaphore: Fixed a regression in semaphore waits.
2017-01-06 22:00:12 -05:00
bunnei
1c792389e6
Merge pull request #2408 from Subv/priority_boosting
...
Kernel: Removed the priority boost code for starved threads.
2017-01-06 00:40:39 -05:00
Subv
fc2266130b
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
Subv
5e2a8ebabf
Kernel: Remove some unused functions.
2017-01-05 13:17:06 -05:00
Subv
933df2606a
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
e52ca85711
Kernel: Implemented Pulse event and timers.
...
Closes #1904
2017-01-05 13:06:17 -05:00
Subv
4251eb26ec
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
Subv
dda4ec93be
Kernel: Add some asserts to enforce the invariants in the scheduler.
2017-01-05 09:40:18 -05:00
Subv
7f1dca8cd2
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
fd95b6ee26
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
cef5f45de2
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
d3ff5b91e1
Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes
2017-01-04 15:58:48 -05:00
Subv
b6a0355568
Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.
2017-01-04 15:58:47 -05:00
Subv
7abf185390
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
e6a7723f2f
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
38a90882a4
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
bunnei
8b1e269e58
ThreadContext: Move from "core" to "arm_interface".
2016-12-22 00:27:49 -05:00
bunnei
e26fbfd1d7
core: Replace "AppCore" nomenclature with just "CPU".
2016-12-22 00:27:46 -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
wwylele
4c9b80cee3
Kernel: remove object's waiting thread if it is dead
2016-12-16 12:33:18 +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
ebbb55ec8f
Moved the HLE command buffer translation task to ServerSession instead of the HLE handler superclass.
2016-12-09 12:52:12 -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
386112da32
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
f9bcf89510
Use std::move where appropriate.
2016-12-08 11:06:19 -05:00
Subv
7cde5b83bc
Use boost remove_erase_if instead of the erase-remove idiom
2016-12-06 19:31:53 -05:00
Subv
1f286b72a1
Improved the algorithm for GetHighestPriorityReadyThread.
2016-12-06 19:15:32 -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
00f0c77570
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
29d809b6e1
Kernel: Remove the Redirection handle type.
2016-12-05 11:13:22 -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
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
bunnei
cb2b2071a8
Merge pull request #748 from Subv/tls_max
...
Core/Memory: Add TLS support for creating up to 300 threads
2015-05-11 23:32:28 -04:00
bunnei
ee8da4c356
Merge pull request #751 from yuriks/idle-thread
...
Thread: Remove the idle thread
2015-05-11 23:22:47 -04:00
bunnei
6e26d063a5
Merge pull request #757 from Subv/scheduling
...
Core/Scheduling: Prepare the new priority in the thread queue when svcSetPriority is called
2015-05-11 22:54:00 -04:00
Yuri Kunde Schlesner
4f7a055081
Thread: Remove the idle thread
...
Instead just use nullptr to represent no thread is active.
2015-05-11 22:39:39 -03:00
Subv
dda94e56dd
Core/Memory: Add TLS support for creating up to 300 threads
2015-05-11 20:09:23 -05:00
Yuri Kunde Schlesner
820b97787c
Merge pull request #750 from Subv/process_svc
...
Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThread
2015-05-11 17:44:26 -07:00
Subv
dbc1320923
Core/Scheduling: Prepare the new priority in the thread queue when svcSetPriority is called
2015-05-11 19:38:10 -05:00
Subv
25c010dc7d
fixup!
2015-05-11 18:23:45 -05:00
Subv
41f74a16fd
Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThread
2015-05-11 09:15:10 -05:00
Yuri Kunde Schlesner
d16c2bd956
Thread: Correctly set main thread initial stack position
2015-05-11 05:08:47 -03:00
archshift
e98fbadf4a
Merge pull request #740 from yuriks/gsp-shmem
...
Fix crashes due to un-initialized GSP shared memory
2015-05-10 18:07:44 -07:00
Subv
115ad8e16a
fixup! Set the TLS address in the scheduler
2015-05-10 18:43:59 -05:00
Subv
000876858d
Core/Memory: Give every emulated thread it's own TLS area.
...
The TLS area for thread T with id Ti is located at TLS_AREA_VADDR + (Ti - 1) * 0x200.
This allows some games like Mario Kart 7 to continue further.
2015-05-10 18:35:37 -05:00
Yuri Kunde Schlesner
774eea8374
Kernel: Zero-fill shared memory blocks when mapping
...
This works around crashes related to GSP/HID/etc. shared memory blocks
having garbage values. The proper fix requires proper management of
mapped memory blocks in the process.
2015-05-10 20:05:29 -03:00
Yuri Kunde Schlesner
c96f22490a
Kernel: Capture SharedMemory attributes at creation, not when mapping
2015-05-10 19:47:07 -03:00
Yuri Kunde Schlesner
b700b55696
Common: Remove the BIT macro
...
When the macro was introduced in 326ec51261
it wasn't noticed that it conflicted in name with a heavily used macro
inside of dyncom. This causes some compiler warnings. Since it's only
lightly used, it was opted to simply remove the new macro.
2015-05-09 18:16:46 -03:00
Yuri Kunde Schlesner
1c0b87edc2
Memory: Re-organize and rename memory area address constants
2015-05-09 01:29:52 -03:00
Yuri Kunde Schlesner
7c50b999fa
Kernel: Remove unused g_main_thread variable
2015-05-08 22:12:12 -03:00
Yuri Kunde Schlesner
3cb19c9589
Process: Rename StaticAddressMapping => AddressMapping
2015-05-08 22:12:10 -03:00
Yuri Kunde Schlesner
83ccf85bb2
Process: Add more documentation to the class members
2015-05-08 22:11:49 -03:00
Yuri Kunde Schlesner
2f5904611d
Process: Use BitField to store process flags
2015-05-08 22:11:48 -03:00
Yuri Kunde Schlesner
2af30d465f
Process: Support parsing of exheader kernel caps
2015-05-08 22:11:44 -03:00
Yuri Kunde Schlesner
a5eba2f984
Kernel: Remove g_program_id
...
This has been obsoleted by the field in Process.
2015-05-08 22:11:03 -03:00
Yuri Kunde Schlesner
6d60acf0f1
Kernel: Introduce skeleton Process class to hold process data
2015-05-08 22:11:02 -03:00
Yuri Kunde Schlesner
e1fbac3ca1
Common: Remove common.h
2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner
c916bcf7b5
Move typedefs from kernel.h to more appropriate places
2015-05-06 23:45:05 -03:00
bunnei
c7dc799e19
Kernel: Properly initialize and shutdown all modules.
2015-05-01 18:27:03 -04:00
Emmanuel Gil Peyrot
0d69b2f7bd
Kernel: Use the correct format string for u64 hex.
2015-04-14 21:18:31 +02:00
bunnei
c077bcefa9
SVC: Update various SVCs to cause a reschedule.
...
- CreateMutex/ReleaseMutex/ReleaseSemaphore/SetTimer/CancelTimer/ArbitrateAddress
2015-04-09 19:06:42 -04:00
bunnei
9c3419ebcc
Kernel: Implemented priority inheritance for mutexes.
2015-04-09 19:06:39 -04:00
bunnei
7b9f428b23
Thread: Implement priority boost for starved threads.
...
SVC: Return correct error code on invalid CreateThread processor ID.
SVC: Assert when creating a thread with an invalid userland priority.
2015-04-09 19:05:21 -04:00
bunnei
e08f55b1a7
Kernel: Fixed default thread priority.
2015-04-09 19:04:19 -04:00
Gareth Higgins
25a43cd2ec
Initialize base address to 0x0
2015-04-08 20:34:41 -04:00
archshift
4fb75d220a
Misc cleanup of common and related functions
2015-02-19 22:26:25 -08:00
Subv
8e2b248e05
Build: Fixed some warnings
2015-02-12 09:25:35 -05:00
archshift
ef24e72b26
Asserts: break/crash program, fit to style guide; log.h->assert.h
...
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)
Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
Kevin Hartman
5fcbfc06eb
Scheduler refactor Pt. 1
...
* Simplifies scheduling logic, specifically regarding thread status. It should be much clearer which statuses are valid
for a thread at any given point in the system.
* Removes dead code from thread.cpp.
* Moves the implementation of resetting a ThreadContext to the corresponding core's implementation.
Other changes:
* Fixed comments in arm interfaces.
* Updated comments in thread.cpp
* Removed confusing, useless, functions like MakeReady() and ChangeStatus() from thread.cpp.
* Removed stack_size from Thread. In the CTR kernel, the thread's stack would be allocated before thread creation.
2015-02-09 21:47:12 -08:00
bunnei
1b0bf00cbc
Mutex: Locks should be recursive.
2015-02-09 22:06:09 -05:00
Lioncash
676daef3c7
core: Fix some warnings on OSX
2015-02-03 08:14:42 -05:00
Yuri Kunde Schlesner
88a4a808c6
Kernel: Stop creating useless Handles during object creation
...
They're finally unnecessary, and will stop cluttering the application's
handle table.
2015-02-02 15:37:09 -02:00
Yuri Kunde Schlesner
52f58e64ef
Kernel: Make WaitObjects share ownership of Threads waiting on them
...
During normal operation, a thread waiting on an WaitObject and the
object hold mutual references to each other for the duration of the
wait.
If a process is forcefully terminated (The CTR kernel has a SVC to do
this, TerminateProcess, though no equivalent exists for threads.) its
threads would also be stopped and destroyed, leaving dangling pointers
in the WaitObjects.
The solution is to simply have the Thread remove itself from WaitObjects
when it is stopped. The vector of Threads in WaitObject has also been
changed to hold SharedPtrs, just in case. (Better to have a reference
cycle than a crash.)
2015-02-02 15:37:08 -02:00
Yuri Kunde Schlesner
7725256f64
Explicitly instantiate constructors/destructors for Kernel objects
...
This should speed up compile times a bit, as well as enable more liberal
use of forward declarations. (Due to SharedPtr not trying to emit the
destructor anymore.)
2015-02-02 15:37:07 -02:00
Yuri Kunde Schlesner
4e84df8be3
Mutex: Replace g_mutex_held_locks with a set inside Thread
2015-02-02 15:37:06 -02:00
Yuri Kunde Schlesner
e8330dd162
Kernel: Fix bug in HandleTable::Close
2015-02-02 15:37:04 -02:00
Yuri Kunde Schlesner
5354a479bc
Kernel: Remove Object::GetHandle (it's not used anymore :D)
2015-02-02 15:37:04 -02:00
Yuri Kunde Schlesner
869ec46683
Kernel: Introduce unique Object ids for debugging
2015-02-02 15:37:03 -02:00
Yuri Kunde Schlesner
a9b86db3cf
Kernel: Use separate Handle tables for CoreTiming userdata
...
This is to support the removal of GetHandle soon
2015-02-02 15:37:03 -02:00
Yuri Kunde Schlesner
ec9c773251
Kernel: Remove previous scheduled event when a Timer is re-Set
2015-02-02 15:37:02 -02:00
Yuri Kunde Schlesner
664c79ff47
Thread: Modernize two functions that slipped through previous rebases
2015-02-02 15:37:01 -02:00
Lioncash
3f00dd9117
arm: Clean up ARMul_State
...
Remove unnecessary/unused struct variables.
2015-01-31 21:55:34 -05:00
Lioncash
96c174aed4
shared_memory: Fix assignments in SharedMemory::Map
2015-01-30 11:37:53 -05:00
Yuri Kunde Schlesner
d917a9bf77
Kernel: Mark all appropriate kernel objects as "final"
2015-01-30 11:49:46 -02:00
Yuri Kunde Schlesner
09ae6e1fa3
Remove result.h InvalidHandle
...
It was only being used in two places, where it was replaced by a local
constant.
2015-01-30 11:49:45 -02:00
Yuri Kunde Schlesner
d52d859936
Kernel: Convert Event to not use Handles
2015-01-30 11:49:43 -02:00
Yuri Kunde Schlesner
ad80ff1e32
Kernel: Convert Timer to (mostly) not use Handles
2015-01-30 11:47:07 -02:00
Yuri Kunde Schlesner
882b6fed75
Kernel: Convert Mutex to not use Handles
2015-01-30 11:47:06 -02:00
Yuri Kunde Schlesner
38e7122f23
Kernel: Convert AddressArbiter to not use Handles
2015-01-30 11:47:06 -02:00
Yuri Kunde Schlesner
d9b19be1d9
Kernel: Convert Semaphore to not use Handles
2015-01-30 11:47:05 -02:00
Yuri Kunde Schlesner
4bb33dfc30
Kernel: Convert SharedMemory to not use Handles
2015-01-30 11:47:04 -02:00
Yuri Kunde Schlesner
b5ee4f9df9
Move VAddr/PAddr typedefs to kernel.h
2015-01-30 11:47:01 -02:00
Yuri Kunde Schlesner
9a345de2bd
Kernel: Remove useless/duplicated comments; mark functions static
2015-01-30 11:47:01 -02:00
bunnei
68ddaaa2f5
Thread: Fix WaitSynchronization1 to not set register 1 on thread wakeup.
2015-01-21 20:48:46 -05:00
bunnei
4255f25647
Thread: Use std::find in CheckWait_WaitObject.
2015-01-21 20:48:46 -05:00
bunnei
2f3020a102
Mutex: Cleanup and remove redundant code.
2015-01-21 20:48:36 -05:00
bunnei
f09806aed2
Kernel: Renamed some functions for clarity.
...
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-21 20:48:30 -05:00
bunnei
15b6a4d9ad
Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void.
2015-01-21 20:47:49 -05:00
bunnei
c68eb15695
WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual.
2015-01-21 20:47:49 -05:00
bunnei
69c5830ef2
Event: Fix implementation of "non-sticky" events.
2015-01-21 20:47:48 -05:00
bunnei
9e6ec3b6cd
Session: Change to a WaitObject.
2015-01-21 20:47:47 -05:00
bunnei
d2759c578e
Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs.
2015-01-21 20:47:47 -05:00
bunnei
dde02f79af
Mutex: Fix a bug where the thread should not wait if it already has the mutex.
2015-01-21 20:47:46 -05:00
bunnei
9412996c8f
Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely.
2015-01-21 20:47:46 -05:00
bunnei
254e4ebd58
AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense.
2015-01-21 20:47:45 -05:00
bunnei
e5a9f1c644
Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.
2015-01-21 20:47:38 -05:00
bunnei
6643673f28
WaitSynchronizationN: Refactor to fix several bugs
...
- Separate wait checking from waiting the current thread
- Resume thread when wait_all=true only if all objects are available at once
- Set output to correct wait object index when there are duplicate handles
2015-01-21 19:11:47 -05:00
bunnei
aa01c57ae9
Kernel: Separate WaitSynchronization into Wait and Acquire methods.
2015-01-21 19:10:24 -05:00
bunnei
7faf2d8e06
WaitSynchronizationN: Implement return values
2015-01-21 19:09:03 -05:00
bunnei
e4a5d8ad4f
Event: Fixed some bugs and cleanup (Subv)
2015-01-21 18:43:50 -05:00
bunnei
1f7a04f05a
Thread: Keep track of multiple wait objects.
2015-01-21 18:42:04 -05:00
bunnei
14cbbf4d9b
Event: Get rid of permanent_lock hack.
2015-01-21 18:42:04 -05:00
bunnei
5e77e2e1de
WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.
2015-01-21 18:41:58 -05:00
bunnei
c22bac6398
Kernel: Added WaitObject and changed "waitable" objects inherit from it.
2015-01-21 18:41:00 -05:00
Lioncash
a3f5e5605c
core: Fix a few docstrings
2015-01-20 13:52:44 -05:00
Subv
9e2ae289b8
AddrArbiter: Implement arbitration types 3 and 4.
2015-01-13 14:49:26 -05:00
bunnei
542b0b0057
Merge pull request #466 from Subv/wake
...
Thread: Prevent waking a thread multiple times.
2015-01-11 13:39:23 -05:00
Subv
b68d51ed30
Thread: Prevent waking a thread multiple times.
...
If a thread was woken up by something, cancel the wakeup timeout.
2015-01-11 13:18:52 -05:00
Yuri Kunde Schlesner
8ad41775cc
Kernel: Start using boost::intrusive_ptr for lifetime management
2015-01-09 19:43:52 -02:00
Yuri Kunde Schlesner
d751de7341
Kernel: Don't re-assign object's handle when duplicating one
2015-01-09 19:43:51 -02:00
Yuri Kunde Schlesner
78ea76e12f
Thread: Fix nullptr access in a logging function
2015-01-09 04:02:28 -02:00
Yuri Kunde Schlesner
7f1557fbbd
Thread: Rename thread_queue => thread_list
2015-01-09 04:02:17 -02:00
Yuri Kunde Schlesner
9bf8462b96
Thread: Reduce use of Handles and move some funcs to inside the class.
2015-01-09 04:02:15 -02:00
Yuri Kunde Schlesner
ba72208cd4
Kernel: Move Thread's definition to the header file
2015-01-09 03:51:55 -02:00
Yuri Kunde Schlesner
7b3452c730
Move ThreadContext to core/core.h and deal with the fallout
2015-01-09 03:51:55 -02:00
bunnei
d46f650036
Merge pull request #255 from Subv/cbranch_3
...
Implemented timers
2015-01-08 22:38:33 -05:00
Subv
07044651ef
SVC: Implemented the Timer service calls.
2015-01-08 21:22:14 -05:00
Subv
dfc440785a
SVC: Fixed SleepThread.
...
It will now properly wait the specified number of nanoseconds and then wake up the thread.
2015-01-08 18:39:12 -05:00
Subv
60a373a786
Threads: Use a dummy idle thread when no other are ready.
...
This thread will not actually execute instructions, it will only advance the timing/events and try to yield immediately to the next ready thread, if there aren't any ready threads then it will be rescheduled and start its job again.
2015-01-07 20:31:31 -05:00
Yuri Kunde Schlesner
122c2bb324
Common: Clean up ThreadQueueList
...
Replace all the C-style complicated buffer management with a std::deque.
In addition to making the code easier to understand it also adds support
for non-POD IdTypes.
Also clean the rest of the code to follow our code style.
2015-01-07 18:38:25 -02:00
bunnei
cc23269ff4
Merge pull request #407 from Subv/arbiter
...
AddressArbiter: Ported arbitration type 2 from 3dmoo.
2015-01-05 00:05:50 -05:00
Subv
ea80363cc2
Mutex: Add the calling thread to the waiting list when needed
...
This will happen when the mutex is already owned by another thread. Should fix some issues with games being stuck due to waiting threads not being awoken.
2015-01-04 12:52:34 -05:00
Subv
0276a75f24
AddressArbiter: Ported arbitration type 2 from 3dmoo.
...
(Thanks 3dmoo!)
2015-01-03 12:09:11 -05:00
Yuri Kunde Schlesner
7e2903cb74
Kernel: New handle manager
...
This handle manager more closely mirrors the behaviour of the CTR-OS
one. In addition object ref-counts and support for DuplicateHandle have
been added.
Note that support for DuplicateHandle is still experimental, since parts
of the kernel still use Handles internally, which will likely cause
troubles if two different handles to the same object are used to e.g.
wait on a synchronization primitive.
2014-12-28 11:52:55 -02:00
Yuri Kunde Schlesner
23f2142009
Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants
2014-12-28 11:52:53 -02:00
Yuri Kunde Schlesner
73fba22c01
Rename ObjectPool to HandleTable
2014-12-28 11:52:52 -02:00
bunnei
0de6a08d75
Merge pull request #291 from purpasmart96/license
...
License change
2014-12-21 16:05:44 -05:00
purpasmart96
ebfd831ccb
License change
2014-12-20 21:20:24 -08:00
bunnei
4fcdbed9f6
Thread: Wait current thread on svc_SleepThread
...
- Removed unused VBLANK sleep mode
- Added error log for bad context switch
- Renamed VerifyWait to CheckWaitType to be more clear
2014-12-20 23:20:19 -05:00
bunnei
2e5869c939
Merge pull request #316 from yuriks/thread-handle
...
Kernel: Implement support for current thread pseudo-handle
2014-12-20 16:36:01 -05:00
Chin
e795692614
Clean up some warnings
2014-12-20 10:03:36 -05:00
Yuri Kunde Schlesner
adee775f44
Kernel: Implement support for current thread pseudo-handle
...
This boots a few (mostly Nintendo 1st party) games further.
2014-12-20 03:27:47 -02:00
bunnei
7bae450379
Merge pull request #185 from purpasmart96/mem_perm
...
Kernel: Add missing permissions
2014-12-17 20:56:04 -05:00
Subv
ea9ce0fba7
Filesystem/Archives: Implemented the SaveData archive
...
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information
Got rid of the code duplication in File and Directory
Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive.
FS_U: Use the correct error code when a file wasn't found
2014-12-17 19:21:38 -05:00
Yuri Kunde Schlesner
ca67bb7945
HLE: Rename namespaces to match move & fix initialization order
2014-12-16 01:08:38 -02:00
Yuri Kunde Schlesner
c72ccfa6db
HLE: Move kernel/archive.* to service/fs/
2014-12-16 01:08:14 -02:00
Yuri Kunde Schlesner
e321decf98
Remove SyncRequest from K::Object and create a new K::Session type
...
This is a first step at fixing the conceptual insanity that is our
handling of service and IPC calls. For now, interfaces still directly
derived from Session because we don't have the infrastructure to do it
properly. (That is, Processes and scheduling them.)
2014-12-15 18:26:17 -02:00
Subv
ea95876431
Kernel/Semaphore: Small style change
2014-12-13 13:40:19 -05:00
Subv
effb181888
Kernel/Semaphores: Invert the available count checking.
...
Same semantics, idea by @yuriks
2014-12-13 13:40:18 -05:00
Subv
5e25986235
Kernel/Semaphores: Addressed some issues.
2014-12-13 13:40:16 -05:00
Subv
cc81a510e3
Semaphore: Removed an unneeded function
2014-12-13 13:40:15 -05:00
Subv
61434651d8
Semaphores: Addressed some style issues
2014-12-13 13:40:13 -05:00
Subv
abff4a7ee2
Semaphore: Implemented the initial_count parameter.
2014-12-13 13:40:12 -05:00
Subv
49b31badba
SVC: Implemented ReleaseSemaphore.
...
This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
2014-12-13 13:40:10 -05:00
Subv
82c84883a5
SVC: Implemented svcCreateSemaphore
...
ToDo: Implement svcReleaseSemaphore
* Some testing against hardware needed
2014-12-13 13:40:09 -05:00
Lioncash
cfc0ee9c60
kernel: Remove unused log arguments
2014-12-13 10:15:58 -05:00
Yuri Kunde Schlesner
0600e2d8b5
Convert old logging calls to new logging macros
2014-12-13 02:08:02 -02:00
bunnei
3a75c8069e
Merge pull request #256 from Subv/mutex
...
Kernel/Mutex: Properly lock the mutex when a thread enters it
2014-12-10 22:52:55 -05:00
bunnei
dd203f7068
Thread: Fixed to wait on address when in arbitration.
2014-12-08 19:44:10 -05:00
archshift
20d2ed0950
Make OpenDirectory fail if the directory doesn't exist
...
This is in line with what the hardware itself does.
It does this by splitting the initial directory opening into Directory.Open(), which will return false if a stat fails.
Then, Archive::OpenDirectory will return nullptr, and archive.cpp will return an error code .
2014-12-07 14:47:14 -08:00
Subv
bc318c464b
Mutex: Remove some forward declarations
...
Moved Mutex::WaitSynchronization to the end of the file.
2014-12-07 15:57:28 -05:00
Subv
64128aa61a
Mutex: Release all held mutexes when a thread exits.
2014-12-07 15:44:21 -05:00
Subv
e3c8e4901c
Mutex: Properly lock the mutex when a thread enters it
...
Also resume only the next immediate thread waiting for the mutex when it is released, instead of resuming them all.
2014-12-05 23:40:43 -05:00
bunnei
17fae11fc7
Merge pull request #250 from Subv/cbranch_2
...
SVC: Implemented GetThreadId.
2014-12-04 22:15:03 -05:00
bunnei
5056329a80
Merge pull request #222 from archshift/renamexyz
...
Implemented RenameFile and RenameDirectory in FS:USER
2014-12-04 22:07:47 -05:00
Subv
6fac2bf0ab
Threads: Remove a redundant function.
...
Use the next_thread_id variable directly.
2014-12-04 14:59:56 -05:00
Subv
ef1d5cda06
Threads: Implemented a sequential thread id
2014-12-04 08:13:53 -05:00
archshift
139a4d91d9
Updated archive.cpp functions for proper error handling
2014-12-03 22:50:44 -08:00
Subv
029ff9f1fd
SVC: Implemented GetThreadId.
...
For now threads are using their Handle value as their Id, it should not really cause any problems because Handle values are unique in Citra, but it should be changed. I left a ToDo there because this is not correct behavior as per hardware.
2014-12-04 00:25:35 -05:00
Lioncash
208598dbe2
kernel: Shorten GetCount
2014-12-03 22:52:02 -05:00
Lioncash
9b68d5e074
kernel: Make some functions const
2014-12-03 19:48:34 -05:00
bunnei
e3d1ffff4b
Merge pull request #225 from bunnei/fix-release-mutex
...
Mutex: Changed behavior to always release mutex for all threads.
2014-11-30 08:47:49 -05:00
bunnei
de851ba1a1
Thread: Check that thread is actually in "wait state" when verifying wait.
2014-11-26 15:04:08 -05:00
bunnei
a449e0e11a
Mutex: Changed behavior to always release mutex for all threads.
2014-11-26 14:38:42 -05:00
archshift
e5ff01c2cd
Implemented RenameDirectory in FS:USER
2014-11-24 15:09:12 -08:00
archshift
45afc15aa6
Implemented RenameFile in FS:USER
2014-11-24 15:09:11 -08:00
Yuri Kunde Schlesner
8189593255
Use pointers instead of passing handles around in some functions.
2014-11-24 17:08:37 -02:00
Yuri Kunde Schlesner
22c86824a4
Remove duplicated docs/update them for changed parameters.
2014-11-24 17:08:36 -02:00
Yuri Kunde Schlesner
c2588403c0
HLE: Revamp error handling throrough the HLE code
...
All service calls in the CTR OS return result codes indicating the
success or failure of the call. Previous to this commit, Citra's HLE
emulation of services and the kernel universally either ignored errors
or returned dummy -1 error codes.
This commit makes an initial effort to provide an infrastructure for
error reporting and propagation which can be use going forward to make
HLE calls accurately return errors as the original system. A few parts
of the code have been updated to use the new system where applicable.
One part of this effort is the definition of the `ResultCode` type,
which provides facilities for constructing and parsing error codes in
the structured format used by the CTR.
The `ResultVal` type builds on `ResultCode` by providing a container for
values returned by function that can report errors. It enforces that
correct error checking will be done on function returns by preventing
the use of the return value if the function returned an error code.
Currently this change is mostly internal since errors are still
suppressed on the ARM<->HLE border, as a temporary compatibility hack.
As functionality is implemented and tested this hack can be eventually
removed.
2014-11-24 17:08:36 -02:00
bunnei
ef1b16a7eb
Merge pull request #191 from archshift/deletexyz
...
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
2014-11-23 20:02:23 -05:00
archshift
8aeadbd95a
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
2014-11-23 00:33:43 -08:00
bunnei
c0cd0fa78e
Merge pull request #211 from linkmauve/master
...
Remove trailing spaces from the entire project
2014-11-19 15:24:46 -05:00
bunnei
112768f436
Merge pull request #208 from lioncash/statics
...
Add static to some variables
2014-11-19 09:39:20 -05:00
Emmanuel Gil Peyrot
f5d38649c7
Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated
2014-11-19 09:03:07 +00:00
Lioncash
7cbecde2ca
Add static to some variables
2014-11-18 20:04:00 -05:00
purpasmart96
66431bceda
Kernel:Add missing permissions in shared memory & svc
2014-11-18 15:57:25 -08:00
Lioncash
1a8f466217
Remove extraneous semicolons
2014-11-18 08:27:16 -05:00
bunnei
11641b5e79
Archive: Fixed to not destroy archive handle on close.
2014-11-17 22:19:14 -05:00
bunnei
bcb0dbf7e1
Archive: Fixed close archive before freeing.
2014-11-17 22:19:14 -05:00
bunnei
3e09c07378
FS_User: Support FileSye::Path in a more generic way.
...
added a todo to kernel archive
2014-11-17 22:18:58 -05:00
bunnei
a3107a6b57
FileSys: Updated backend code to use FileSys::Path instead of string for paths.
2014-11-17 21:49:24 -05:00
Lioncash
ac58b76e71
Fix two format strings.
2014-11-14 12:08:26 -05:00
archshift
04c90c395d
Added CreateDirectory function to service/fs.cpp, and in Archive.
2014-11-02 10:48:28 -08:00
Sean
9a012ff007
Fix some warnings
2014-10-29 20:26:15 -04:00
Yuri Kunde Schlesner
d72708c1f5
Add override
keyword through the code.
...
This was automated using `clang-modernize`.
2014-10-26 16:18:05 -02:00
Emmanuel Gil Peyrot
0be5c03176
FileSys: split the constructor into an Open method, in order to notify the opener something went wrong.
...
Kernel: Return an invalid handle to OpenFile when it failed to open.
2014-10-06 19:58:42 +02:00
Emmanuel Gil Peyrot
23c2fbfc7a
FileSys/Kernel: Implement SetSize service call for File objects.
2014-10-06 19:58:37 +02:00
archshift
1966f7b0ad
Use the citra user path for the sdmc directory
2014-09-21 09:34:33 -07:00
Emmanuel Gil Peyrot
3a570a9fee
Kernel: Implement the Close command for Archive, File and Directory.
2014-09-17 14:35:46 +00:00
Emmanuel Gil Peyrot
c197ce2180
Kernel: Add a Directory object and a getter for it from an Archive object.
2014-09-17 14:35:46 +00:00
Emmanuel Gil Peyrot
19d04f3abe
Kernel: Add a File object and a getter for it from an Archive object.
2014-09-17 14:35:46 +00:00
Lioncash
741321ac24
Core: Get rid of unnecessary switch statement in Kernel
2014-09-14 21:31:09 -04:00
archshift
6e606c515f
core: Prune redundant includes
2014-09-08 17:54:14 -07:00
bunnei
304999dfeb
Threading: Fix thread starting to execute first instruction correctly.
2014-08-28 17:51:49 -04:00
archshift
4c4a01bf41
Added FS functions to Archive and Archive_RomFS
2014-08-22 15:45:10 -07:00
Lioncash
ab4648d3ca
Core: Use std::array for managing kernel object space
...
These avoid relying on memset for clearing the arrays.
2014-08-19 00:32:48 -04:00
Lioncash
98fa3f7cba
Core: Alter the kernel string functions to use std::string instead of const char*.
...
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
2014-08-17 23:12:20 -04:00
bunnei
d4bd2f2e5d
Thread: Added more descriptive comment to WaitCurrentThread.
2014-08-06 18:19:59 -04:00
bunnei
2542350b85
AddressArbiter: Removed unnecessary HLE::Reschedule.
2014-08-05 23:54:28 -04:00
bunnei
60078baab1
AddressArbiter: Fixed bug with break statements missing from case statements.
2014-08-05 23:54:27 -04:00
bunnei
7a1f813be1
Kernel: Updated Event and Mutex to specify handle that they are blocking for.
2014-08-05 20:14:51 -04:00
bunnei
3eb89f3e98
Kernel: Added preliminary support for address arbiters.
...
AddressArbiter: Added documentation comment, fixed whitespace issue.
AddressArbiter: Fixed incorrect comment, reordered if-statement to be more clear.
SVC: Removed trailing whitespace.
2014-07-08 18:46:38 -04:00
bunnei
ba840d3200
Thread: Added functions to resume threads from address arbitration.
...
Thread: Cleaned up arbitrate address functions.
Thread: Cleaned up ArbitrateAllThreads function.
2014-07-08 18:46:15 -04:00
bunnei
7ff92c36ed
SharedMemory: Updated MapSharedMemory to use an enum for permissions.
...
- Also added some safety checks to MapSharedMemory.
2014-07-05 10:24:54 -04:00
bunnei
e547128185
Kernel: Added support for shared memory objects.
...
SharedMemory: Added optional name field for tracking known objects.
2014-07-05 01:21:05 -04:00
bunnei
542700ccb7
Archive: Added Init/Shutdown methods to reset kernel archive state.
2014-07-04 20:37:51 -04:00
bunnei
17a6148f9d
FileSys: Added preliminary support for applications reading the RomFS archive.
...
Archive: Fixed brace ugliness for neobrain :)
FS: Commented out unused local variables to prevent warnings.
...But keeping them here for future use.
archive_romfs: Removed unused #include.
2014-07-04 20:37:45 -04:00
bunnei
8b8c8f4c13
Kernel: Added stubbed code to support creation of kernel Archive objects.
2014-06-27 16:58:30 -04:00
bunnei
b45a38f557
Kernel: Removed unnecessary "#pragma once".
2014-06-13 09:51:20 -04:00
bunnei
f49ac3a2d7
Kernel: Added freeing of kernel objects on emulator shutdown.
2014-06-13 09:51:19 -04:00
bunnei
83a4ad2885
Event: Updated several log messages to be assertions.
2014-06-13 09:51:18 -04:00
bunnei
b62ef4bbd2
Thread: Renamed occurrences of "t" to "thread" to improve readability.
2014-06-13 09:51:17 -04:00
bunnei
5b7cf50a77
Thread: Cleaned up VerifyWait, fixed issue where nullptr msg could unnecessarily be logged.
2014-06-13 09:51:16 -04:00
bunnei
4620e2a741
HLE: Removed usnused EatCycles function.
2014-06-13 09:51:16 -04:00
bunnei
bfdd874b1f
Thread: Moved position of * in arguments.
2014-06-13 09:51:14 -04:00
bunnei
12e2a59565
Thread: Updated VerifyWait to be more readable (but functionally the same).
2014-06-13 09:51:14 -04:00
bunnei
c95972275e
HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)
2014-06-13 09:51:13 -04:00
bunnei
5365ca157d
Kernel: Updated various kernel function "name" arguments to be const references.
2014-06-13 09:51:12 -04:00
bunnei
d7363322c7
HLE: Updated various handle debug assertions to be more clear.
2014-06-13 09:51:11 -04:00
bunnei
780a443b08
Mutex: Moved ReleaseMutex iterator declaration to be inside while loop.
2014-06-13 09:51:11 -04:00
bunnei
8cac527c94
Kernel: Updated several member functions to be const
2014-06-13 09:51:10 -04:00
bunnei
b774b8b04e
Thread: Fixed bug with ResetThread where cpu_registers[15] was being incorrectly set
2014-06-13 09:51:08 -04:00
bunnei
aae9fcf4a4
Kernel: Made SyncRequest not pure virtual, with a default implementation of error (as this is not required for all kernel objects)
2014-06-13 09:51:08 -04:00
bunnei
f5c7c15434
Kernel: Added real support for thread and event blocking
...
- SVC: Added ExitThread support
- SVC: Added SignalEvent support
- Thread: Added WAITTYPE_EVENT for waiting threads for event signals
- Thread: Added support for blocking on other threads to finish (e.g. Thread::Join)
- Thread: Added debug function for printing current threads ready for execution
- Thread: Removed hack/broken thread ready state code from Kernel::Reschedule
- Mutex: Moved WaitCurrentThread from SVC to Mutex::WaitSynchronization
- Event: Added support for blocking threads on event signalling
Kernel: Added missing algorithm #include for use of std::find on non-Windows platforms.
2014-06-13 09:51:02 -04:00
bunnei
ce1c561278
kernel: changed current default thread priority back to 0x30 - I think this is more correct
2014-06-05 00:20:58 -04:00
bunnei
b78aff8585
svc: added optional name field to Event and Mutex (used for debugging)
2014-06-02 20:38:34 -04:00
bunnei
8c0f02a70c
kernel: moved position of * for GetTypeName and GetName
2014-06-02 20:36:58 -04:00
bunnei
3fb31fbc57
svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle support
2014-06-01 22:12:54 -04:00
bunnei
10447d1f48
kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedule
2014-06-01 21:42:50 -04:00
bunnei
ba98e25e97
thread: updated Reschedule to sit at a synchronization barrier when no other threads are ready for execution
2014-06-01 10:35:42 -04:00
bunnei
f7cececc5c
event: added a hackish ability to set an event as "locked" to its current state, cleaned up some comments
2014-06-01 10:33:55 -04:00
bunnei
d8a2c8c657
mutex: fixed typo in ReleaseMutex
2014-05-29 23:31:01 -04:00
bunnei
d51c84dde2
event: added support for ClearEvent, fixed a bug with CreateEvent, fixed some comments
2014-05-29 20:00:44 -04:00
bunnei
2ed6652f10
mutex: added preliminary SyncRequest/WaitSynchronization, added some comments/assertions
2014-05-27 22:42:16 -04:00
bunnei
ea8627d536
event: fixed typos and updated CMakeLists
2014-05-27 22:14:38 -04:00
bunnei
beea6f054a
event: added SetEventLocked method to change status an events lock
2014-05-27 22:14:00 -04:00
bunnei
fd69fd0325
kernel: added event module to support creation of CTR "Event" objects
2014-05-27 20:16:13 -04:00
bunnei
d493d725ac
mutex: removed docstring comment that is no longer relevant
2014-05-26 22:49:11 -04:00
bunnei
93cd5a0691
mutex: added additional docstrings
2014-05-26 22:47:47 -04:00
bunnei
a432dc8f39
kernel: added WaitSynchronization method to Kernel::Object
2014-05-26 22:17:49 -04:00
bunnei
58a3adcdd2
kernel: updated SyncRequest to take boolean thread wait result as a parameter
2014-05-26 22:12:46 -04:00
bunnei
3d7693f75f
kernel: added enum for known CurrentThread and CurrentProcess handles
2014-05-26 21:56:23 -04:00
bunnei
d73d782ba7
kernel: add a SyncRequest method to KernelObject for use with svcSendSyncRequest
2014-05-26 21:01:27 -04:00
bunnei
b99ac2c3d6
thread: renamed "WaitCurThread" to "WaitCurrentThread", removed unused "reason" argument
2014-05-22 19:36:56 -04:00
bunnei
7c0b006076
thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThread
2014-05-22 19:32:45 -04:00
bunnei
d26f3d4c1f
kernel: refactored function naming to remove "__" prefix
2014-05-22 19:06:12 -04:00
bunnei
14bd37c5dc
thread: moved ThreadStatus/WaitType to header, added support for arg on CreateThread, added correct CPSR reset
2014-05-22 18:50:36 -04:00
bunnei
6a78be5930
thread: fixed bug where result of __NextThread was not being properly checked when NULL
2014-05-21 21:42:18 -04:00
bunnei
eb537c560a
mutex: refactored the interface to code to return a Mutex* handle
2014-05-20 23:23:58 -04:00
bunnei
978e1d4653
mutex: initial commit of HLE module
2014-05-20 23:03:45 -04:00
bunnei
1c5802c35a
kernel: fixed include, in general include "common.h" not "common_types.h"
2014-05-20 22:27:46 -04:00
bunnei
203541da11
thread: added correct lowest thread priority, added a thread priority check, and added some comments
2014-05-20 21:02:35 -04:00
bunnei
bed4e920fa
thread: exposed ResumeThreadFromWait function for use in other kernel modules
2014-05-20 21:00:10 -04:00
bunnei
75c6d2a8fa
thread: moved threading calls to the Kernel namespace
2014-05-20 19:37:46 -04:00
bunnei
49dc2ce8ac
ARM_Interface: added SaveContext and LoadContext functions for HLE thread switching
2014-05-20 18:50:16 -04:00
bunnei
143bba2045
renamed "syscall" module to "svc" (more accurate naming)
2014-05-20 18:28:38 -04:00
bunnei
f654a03f1f
thread: whitespace change - fixed * and & placement
2014-05-20 18:20:35 -04:00
bunnei
44336329ed
- created a Kernel namespace
...
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues)
- added handle types for all different CTROS handles
2014-05-20 18:13:25 -04:00
bunnei
f5a119a367
thread: added declaration for __KernelReschedule to be used by syscall module
2014-05-19 22:19:48 -04:00
bunnei
eab6fd01d7
- updated service(s) to be KernelObject's
...
- various cleanups
2014-05-18 21:43:29 -04:00
bunnei
772abad778
- moved Handle/Result definitions to kernel.h
...
- added ResetType enum
2014-05-18 18:12:29 -04:00
bunnei
09b8e8fb6a
changed a comment
2014-05-17 13:47:55 -04:00
bunnei
14ae026386
- added enum ThreadProcessorId
...
- reorganized some kernel thread functions
- added placeholder __KernelWaitThread_Synchronization function
2014-05-17 00:56:00 -04:00
bunnei
7cdb705059
- replaced KERNELOBJECT_MAX_NAME_LENGTH with KERNEL_MAX_NAME_LENGTH
...
- added KERNEL_DEFAULT_STACK_SIZE definition (0x4000)
2014-05-16 23:48:15 -04:00
bunnei
940330c6e1
completely gutted/refactored threading code to be simpler
2014-05-15 18:27:08 -04:00
bunnei
a7cc430aa4
changed "UID" to "Handle" to be a little more consistent with CTR naming
2014-05-15 18:26:28 -04:00
bunnei
b99a5da65b
- added helper function for __KernelCreateThread
...
- added __KernelSwitchToThread for enabling a thread
- added __KernelRotateThreadReadyQueue
2014-05-14 20:50:30 -04:00
bunnei
9f5588725c
changed primary thread priority to 0x30 - this is typical, not 0x31
2014-05-14 20:49:27 -04:00
bunnei
0de78eb3c4
fixed thread reset to not set stack address
2014-05-13 23:18:28 -04:00
bunnei
7d078189da
various cleanups / remove unused code
2014-05-13 22:29:31 -04:00
bunnei
3838d46b90
added a bunch of threading code, recycled from PPSSPP, with lots of hacks in for 3DS... doesn't really do much yet. Just a jumping off point
2014-05-13 22:00:11 -04:00
bunnei
1583d2b6f3
- added __KernelLoadExec function
...
- fixed some logging
2014-05-13 21:57:12 -04:00
bunnei
6b264518a5
added initial kernel/thread modules
2014-05-09 22:11:18 -04:00