summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-06-22Kernel/Arbiters: Fix casts, cleanup comments/magic numbersMichael Scire1-4/+4
2018-06-22Add additional missing format.Michael Scire1-19/+21
2018-06-21Kernel/Arbiters: Initialize arb_wait_address in thread struct.Michael Scire1-0/+4
2018-06-21Kernel/Arbiters: Mostly implement SignalToAddressMichael Scire1-1/+1
2018-06-21Kernel/Arbiters: Add stubs for 4.x SignalToAddress/WaitForAddres SVCs.Michael Scire1-3/+50
2018-06-20Build: Fixed some MSVC warnings in various parts of the code.Subv1-2/+2
2018-06-18svc: Add a stub for UserExceptionContextAddr.Jules Blok1-0/+5
2018-05-31Kernel/SVC: Support special core values -2 and -3 in svcSetThreadCoreMask.Subv1-1/+26
Also added some proper error handling.
2018-05-19Kernel/SVC: Signal the highest priority threads first in svcSignalProcessWideKey.Subv1-51/+68
2018-05-19Kernel/Threads: Reschedule the proper core when operating on that core's threads.Subv1-2/+6
2018-05-19SVC: Removed unused WaitSynchronization1 functionSubv1-30/+0
2018-05-11thread: Rename mask to affinity_masks.bunnei1-1/+1
2018-05-11threading: Reschedule only on cores that are necessary.bunnei1-2/+2
2018-05-11svc: Implement GetThreadCoreMask and SetThreadCoreMask.bunnei1-7/+22
2018-05-11svc: SignalProcessWideKey should apply to all cores.bunnei1-43/+50
2018-05-11svc: Implement GetCurrentProcessorNumber.bunnei1-2/+2
2018-05-11core: Implement multicore support.bunnei1-21/+22
2018-05-02general: Make formatting of logged hex values more straightforwardLioncash1-38/+39
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-04-30string_util: Remove StringFromFormat() and related functionsLioncash1-1/+1
Given we utilize fmt, we don't need to provide our own functions for formatting anymore
2018-04-27general: Convert assertion macros over to be fmt-compatibleLioncash1-1/+1
2018-04-26kernel: Migrate logging macros to fmt-compatible onesLioncash1-69/+69
2018-04-23Kernel: Implemented mutex priority inheritance.Subv1-0/+9
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-21Kernel: Remove unused ConditionVariable class.Subv1-6/+0
2018-04-21Kernel: Properly implemented svcWaitProcessWideKey and svcSignalProcessWideKeySubv1-83/+46
They work in tandem with guest code to provide synchronization primitives along with svcArbitrateLock/Unlock
2018-04-21Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.Subv1-20/+2
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-21resource_limit: Make ResourceTypes an enum classLioncash1-2/+2
Prevents enum identifiers from leaking into the surrounding scope.
2018-04-20common_funcs: Remove ARRAY_SIZE macroLioncash1-1/+2
C++17 has non-member size() which we can just call where necessary.
2018-04-17Various service name fixes - part 2 (rebased) (#322)Hexagon121-8/+8
* 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-03svc: Stub out SetThreadActivity, GetThreadContext.bunnei1-2/+14
2018-03-30svc: Stub GetThreadCoreMask.bunnei1-3/+11
2018-03-19More Warning cleanupsN00byKing1-1/+1
2018-03-19Clean Warnings (?)N00byKing1-1/+1
2018-03-16svc: Use more correct values for GetInfo MapRegion and NewMapRegion.bunnei1-5/+5
2018-03-16MemoryState: Add additional memory states and improve naming.bunnei1-1/+1
2018-03-14core: Move process creation out of global state.bunnei1-18/+20
2018-02-25(Hopefully) Fix MinGW BuildN00byKing1-1/+1
2018-02-25Add UnmapSharedMemoryN00byKing1-1/+12
C++11 requires spaces on the Identifier Add inttypes include clang
2018-02-22Stub more functionsmailwl1-1/+11
2018-02-18kernel: Use Scheduler class for threading.bunnei1-2/+2
2018-02-04GetInfo: Implement IsCurrentProcessBeingDebugged.bunnei1-0/+3
2018-02-04WaitProcessWideKeyAtomic: Handle case where condition variable was already created.bunnei1-8/+15
2018-02-03svc: SharedMemory size should be 64-bits and cleanup.bunnei1-8/+8
2018-02-03ArbitrateLock: Assert that requesting_thread is current_thread.bunnei1-0/+1
2018-01-25hle: Remove Domain and SyncObject kernel objects.bunnei1-2/+1
2018-01-21Format: Run the new clang format on everythingJames Rowe1-4/+6
2018-01-20Added CreateSharedMemory & UNIMPLEMENTED() for non existent services. (#113)David1-1/+13
* Added svcCreateSharedMemory * Services which are not implemented now throw UNIMPLEMENTED() * clang-format * changed perms to u32 * removed camelcase
2018-01-19svc: Fix svcGetInfo MapRegionBaseAddr.bunnei1-1/+1
2018-01-18svc: Rename some entries to match their analogue on SwitchBrewLioncash1-7/+7
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-18svc: Add CreateJitMemory and MapJitMemory svc stringsLioncash1-2/+2
Makes the table match SwitchBrew for these entries
2018-01-17svc: Clang-format fix.bunnei1-6/+4
2018-01-17SVC: Correct some return values in svcGetInfo and added TitleId and PrivilegedProcessId stubs.Subv1-6/+21
# Conflicts: # src/core/hle/kernel/svc.cpp
2018-01-16SetThreadCoreMask stub, time to implement fspDavid Marcec1-1/+6
2018-01-16Added more svcGetInfo pairsDavid Marcec1-0/+12
2018-01-16clang-formatMerryMage1-6/+4
2018-01-14svc: Implement svcMapSharedMemory.bunnei1-1/+33
2018-01-13yuzu: Update license text to be consistent across project.bunnei1-1/+1
2018-01-12core: Include <algorithm> where used.bunnei1-0/+2
2018-01-12svc: Implement GetSystemTick.bunnei1-2/+13
2018-01-11svc: Stub ResetSignal and CreateTransferMemorySubv1-3/+20
2018-01-11svc: Stub SetMemoryAttributeSubv1-0/+5
2018-01-10Threads: Added enum values for the Switch's 4 cpu cores and implemented svcGetInfo(AllowedCpuIdBitmask)Subv1-6/+11
2018-01-09SVC: Fixed WaitSynchronization with multiple handles when none is immediately ready.Subv1-7/+18
2018-01-09SVC: Implemented CancelSynchronization.Subv1-1/+17
2018-01-09SVC: Fixed WaitSynchronization with multiple handles when at least one of them is ready.Subv1-1/+24
2018-01-09kernel: Rename Semaphore to ConditionVariable.bunnei1-25/+33
2018-01-09Kernel: Actually wake up the requested number of threads in Semaphore::Release.Subv1-1/+1
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-09Kernel: Properly keep track of mutex lock data in the guest memory. This fixes userland locking/unlocking.Subv1-1/+4
2018-01-09Kernel: Allow chaining WaitSynchronization calls inside a wakeup callback.Subv1-15/+41
2018-01-07svc: Implement svcSignalProcessWideKey.bunnei1-2/+21
2018-01-06svc: Implement svcWaitProcessWideKeyAtomic.bunnei1-1/+49
2018-01-06svc: Implement WaitSynchronization for a single handle.bunnei1-4/+24
2018-01-06svc: Refactor LockMutex code to use WaitSynchronization1.bunnei1-13/+45
2018-01-05svc: Add missing string_util include.bunnei1-0/+1
2018-01-03arm: Remove SkyEye/Dyncom code that is ARMv6-only.bunnei1-19/+9
2018-01-03svc: Remove unnecessary "svc" prefix to naming scheme.bunnei1-106/+106
2018-01-03hle: Move SVC code to kernel namespace.bunnei1-100/+93
2018-01-01svc: Improve svcGetInfo.bunnei1-7/+29
2018-01-01svc: Fix string formatting for CreateThread.bunnei1-1/+1
2018-01-01svc: Stub out svcWaitSynchronization.bunnei1-1/+9
- This does not matter until we implement other kernel objects, mutexes use svcLockMutex for waiting.
2018-01-01svc: Implement svcExitProcess.bunnei1-4/+39
2018-01-01svc: Implement svcUnlockMutex.bunnei1-1/+11
2018-01-01svc: Implement svcLockMutex.bunnei1-1/+39
2017-12-31thread: Keep track of the initially created handle.bunnei1-1/+2
This is kinda crufty, but we need it for now to update guest state variables.
2017-12-31svc: Implement svcExitThread.bunnei1-1/+9
2017-12-31svc: Implement svcCreateThread.bunnei1-2/+57
2017-12-31svc: Cleanup svcGetThreadPriority.bunnei1-3/+5
2017-12-31svc: Stub out svcGetCurrentProcessorNumber.bunnei1-1/+7
2017-12-31svc: Implement svcSetThreadPriority.bunnei1-1/+30
2017-12-31svc: Change SignalProcessWideKey to a stub.bunnei1-2/+2
2017-12-31svc: Implement svcUnmapMemory.bunnei1-1/+8
2017-12-30svc: Minor cleanups.bunnei1-8/+9
2017-12-30svc: Implement svcStartThread.bunnei1-0/+16
2017-12-29kernel: Add SyncObject primitive, use it for ClientSession.bunnei1-2/+2
2017-12-29svc: Implement MapMemory.bunnei1-3/+11
2017-12-28svc: Implement SetHeapSize.bunnei1-1/+9
2017-10-23svc: Implement GetThreadId and GetProcessId.bunnei1-2/+29
2017-10-20hle: Fix QueryMemory response for MemoryInfo.bunnei1-17/+11
2017-10-15hle: Initial implementation of NX service framework and IPC.bunnei1-0/+1
2017-10-14svc: Some logging cleanup.bunnei1-7/+5
2017-10-14svc: Initial nx impl. for QueryMemory, ConnectToPort, SendSyncRequest, etc.bunnei1-1185/+185
2017-10-04SVC: Removed GetPointer usage in the GetResourceLimit functions.Subv1-10/+16
2017-10-04SVC: Remove GetPointer usage in CreatePort.Subv1-2/+2
2017-10-04SVC: Replace GetPointer usage with ReadCString in ConnectToPort.Subv1-5/+9
2017-10-04SVC: Replace GetPointer usage with ReadBlock in OutputDebugString.Subv1-2/+4
2017-10-04SVC: Replace GetPointer usage with Read32 in ReplyAndReceive.Subv1-4/+4
2017-10-04SVC: Replace GetPointer usage with Read32 in WaitSynchronizationN.Subv1-4/+4
2017-09-30Moved down_count to CoreTimingHuw Pascoe1-1/+1
2017-09-30Fixed type conversion ambiguityHuw Pascoe1-4/+4
2017-09-28Kernel/Threads: When putting a thread to wait, specify a function to execute when it is awoken.Subv1-4/+65
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-27Kernel/Thread: Allow specifying which process a thread belongs to when creating it.Subv1-2/+3
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-08-29Use recursive_mutex instead of mutex to fix #2902danzel1-1/+1
2017-08-22Kernel/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).Subv1-2/+6
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-06-29Kernel/SVC: Pass the current thread as a parameter to ClientSession::SendSyncRequest.Subv1-1/+1
2017-06-26Kernel/SVC: Partially implemented svcReplyAndReceive.Subv1-1/+108
It behaves mostly as WaitSynchronizationN with wait_all = false, except for IPC buffer translation. The target thread of an IPC response will now wake up when responding. IPC buffer translation is currently not implemented. Error passing back to svcSendSyncRequest is currently not implemented.
2017-06-23Kernel: Implement AcceptSession SVCYuri Kunde Schlesner1-1/+12
2017-06-23Kernel: Implement CreateSessionToPort SVCYuri Kunde Schlesner1-1/+12
2017-06-22Kernel: Implement CreateSession SVCYuri Kunde Schlesner1-3/+16
2017-05-30Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner1-0/+2
2017-05-30Kernel: Move WaitObject to a separate fileYuri Kunde Schlesner1-0/+1
Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
2017-05-30Kernel: Removed HandleTable::GetWaitObjectYuri Kunde Schlesner1-2/+2
This isn't necessary anymore since plain Get works correctly for WaitObjects.
2017-05-25Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner1-65/+31
2017-05-08Remove ability to load symbol mapsYuri Kunde Schlesner1-8/+2
This was now mostly unused except by thread creation, which used a symbol of the entrypoint, if available, to name the thread.
2017-04-01Fix OutputDebugString syscallMichael Theall1-2/+2
2017-03-09Refined thread launch on syscore error messagesFernando Sahmkow1-5/+15
2017-02-22Timers: Return an error when calling SetTimer with negative timeouts.Subv1-0/+5
2017-01-11Threads: Check the process' resource limit for the max allowed priority when creating a thread and remove the priority clamping code.Subv1-5/+7
2017-01-11Thread: Added priority range checking to svcSetThreadPriority and removed priority clamping code from Thread::SetPriority.Subv1-0/+14
2017-01-06Kernel: Fix SharedMemory objects always returning error when addr = 0 (#2404)Hyper1-1/+5
Closes #2400
2017-01-06Kernel: Don't attempt to yield execution in SleepThread(0) if there are no available threads to run.Subv1-0/+5
With this we avoid an useless temporary deschedule of the current thread.
2017-01-05Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on.Subv1-11/+3
2017-01-04Kernel: Use different thread statuses when a thread calls WaitSynchronization1 and WaitSynchronizationN with wait_all = true.Subv1-3/+3
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-04Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexesSubv1-0/+6
2017-01-04Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.Subv1-2/+3
2017-01-04Kernel/Mutex: Implemented priority inheritance.Subv1-9/+0
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-04Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.Subv1-6/+6
This will be useful when implementing mutex priority inheritance.
2017-01-04Kernel/Synch: Do not attempt a reschedule on every syscall.Subv1-2/+17
Not all syscalls should cause reschedules, this commit attempts to remedy that, however, it still does not cover all cases.
2016-12-22core: Replace "AppCore" nomenclature with just "CPU".bunnei1-7/+6
2016-12-22Address clang-format issues.bunnei1-9/+10
2016-12-22core: Remove HLE module, consolidate code & various cleanups.bunnei1-35/+35
2016-12-22core: Consolidate core and system state, remove system module & cleanups.bunnei1-6/+6
2016-12-17Thread: remove the thread from the thread list when exitingwwylele1-1/+1
2016-12-14Fixed the codestyle to match our clang-format rules.Subv1-2/+4
2016-12-14Fixed the codestyle to match our clang-format rules.Subv1-19/+28
2016-12-10Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout.Subv1-1/+1
2016-12-09WaitSynch: Removed unused variables and reduced SharedPtr copies.Subv1-60/+45
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-08Use std::move where appropriate.Subv1-5/+1
2016-12-05Return an error code when connecting to a saturated port.Subv1-1/+2
The error code was taken from the 3DS kernel.
2016-12-05KServerPorts now have an HLE handler "template", which is inherited by all ServerSessions created from it.Subv1-13/+5
2016-12-04Threading: Added some utility functions and const correctness.Subv1-5/+13
2016-12-04Threading: Reworked the way our scheduler works.Subv1-78/+103
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-01Threads do not wait for the server endpoint to call AcceptSession before returning from a ConnectToPort or GetServiceHandle call.Subv1-2/+3
2016-12-01A bit of a redesign.Subv1-2/+9
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-12-01 Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.Subv1-3/+15
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-09-22name objectswwylele1-0/+4
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot1-5/+1
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot1-234/+278
2016-06-11Kernel/SVC: Implemented svcCreatePort.Subv1-1/+20
2016-05-21SVC::WaitSynchronizationN: Reschedule at the endwwylele1-2/+3
2016-05-17Set fpscr for new threadsJannik Vogel1-0/+3
2016-05-13Kernel: Implemented shared memory permissions.Subv1-0/+2
2016-05-13Kernel/SharedMemory: Properly implemented shared memory support.Subv1-12/+35
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-07Kernel/Threading: Warn when a thread can be scheduled in the Syscore (Core 1).Subv1-0/+5
We do not currently implement any cores other than the AppCore (Core 0).
2016-04-29Common: Remove section measurement from profiler (#1731)Yuri Kunde Schlesner1-4/+0
This has been entirely superseded by MicroProfile. The rest of the code can go when a simpler frametime/FPS meter is added to the GUI.
2016-04-21ac:u: stub CloseAsync; check memory size aling in svc:GetProcessInfo(type=2)mailwl1-0/+4
2016-03-13svc: Move ResetType enum to the kernel event headerLioncash1-2/+2
2016-03-01ThreadProcessorId_All on SVC::CreateThreadKloen1-0/+1
2016-01-14HLE/SVC: Implement UnmapMemoryBlock.Subv1-5/+27
This implementation will need to be (almost completely) changed when we implement multiprocess support.
2015-12-25svc: Remove superfluous printf argumentLioncash1-1/+1
2015-12-13svc: Fix compilation with LOG_TRACE enabledLioncash1-1/+1
2015-12-01Kernel: Implement svcGetSystemInfoYuri Kunde Schlesner1-1/+46
This makes smealum/ctrulib@b96dd51d3349961189d4ab1bc2a5c45deff21c09 work with Citra.
2015-08-30SVC: Advance time when calling GetSystemTick to escape busy-wait loopsYuri Kunde Schlesner1-1/+4
Cubic Ninja waited for the frame to end by spinning on a loop calling GetSystemTick while doing nothing else. Since GetSystemTick doesn't cause a reschedule (which advances time), this meant that very little emulated time would pass inside that loop, causing the game to spend most of the frame burning away CPU.
2015-08-25Integrate the MicroProfile profiling libraryYuri Kunde Schlesner1-0/+4
This brings goodies such as a configurable user interface and multi-threaded timeline view.
2015-08-16Kernel: Implement svcGetProcessInfo in a basic wayYuri Kunde Schlesner1-1/+47
This also adds some basic memory usage accounting. These two types are used by Super Smash Bros. during startup.
2015-08-16Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner1-1/+1
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-16Move core/mem_map.{cpp,h} => core/hle/kernel/memory.{cpp,h}Yuri Kunde Schlesner1-1/+1
2015-08-16Kernel: Properly implement ControlMemory FREE and COMMITYuri Kunde Schlesner1-13/+95
2015-07-21dyncom: Pass SVC immediates directly.Lioncash1-4/+3
Previously it would just re-read the already decoded instruction and extract the immediate value.
2015-07-17Kernel/SVC: Implemented svcQueryProcessMemorySubv1-6/+16
2015-07-17Kernel/SVC: Implemented svcQueryMemory.Subv1-2/+14
2015-07-17Core\HLE : Fix Warningzawata1-2/+2
"signed/unsigned mismatch"
2015-06-17kernel: Fix svcWaitSynch to always acquire requested wait objects.bunnei1-9/+17
2015-05-29Remove every trailing whitespace from the project (but externals).Emmanuel Gil Peyrot1-2/+2
2015-05-25Core/SVC: Map the shared memory created in CreateMemoryBlock to the specified address.Subv1-0/+2
This SharedMemory can be passed to service functions (Which should map the memory into their own address space).
2015-05-21Kernel: Move reschedules from SVCs to actual mechanisms that reschedule.bunnei1-20/+2
2015-05-17Implement svcBreakarchshift1-1/+13
2015-05-15Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv1-11/+38
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-15Memmap: Re-organize memory function in two filesYuri Kunde Schlesner1-1/+1
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-12fixup!Subv1-9/+9
2015-05-11Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv1-2/+31
2015-05-11Kernel: Capture SharedMemory attributes at creation, not when mappingYuri Kunde Schlesner1-1/+3
2015-05-07Fix printf format warningYuri Kunde Schlesner1-1/+1
2015-05-07Common: Remove common.hYuri Kunde Schlesner1-0/+1
2015-05-06HLE: Clean up SVC dispatch mechanismYuri Kunde Schlesner1-3/+34
2015-04-10SVC: Assert on unsupported CreateThread processor ID.bunnei1-3/+9
2015-04-10SVC: Update various SVCs to cause a reschedule.bunnei1-2/+22
- CreateMutex/ReleaseMutex/ReleaseSemaphore/SetTimer/CancelTimer/ArbitrateAddress
2015-04-10Thread: Implement priority boost for starved threads.bunnei1-6/+16
SVC: Return correct error code on invalid CreateThread processor ID. SVC: Assert when creating a thread with an invalid userland priority.
2015-04-10SVC: Reschedule on svcCreateThread.bunnei1-0/+2
2015-03-16arm_interface: Get rid of GetTicks.Lioncash1-2/+3
Removes a TODO.
2015-02-11Asserts: break/crash program, fit to style guide; log.h->assert.harchshift1-1/+1
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-10Scheduler refactor Pt. 1Kevin Hartman1-5/+9
* 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-10WaitSynch: Always reschedule (verified behavior on hw).bunnei1-4/+4
2015-02-02Kernel: Stop creating useless Handles during object creationYuri Kunde Schlesner1-7/+11
They're finally unnecessary, and will stop cluttering the application's handle table.
2015-02-02SVC: Enable CloseHandle, clean up DuplicateHandleYuri Kunde Schlesner1-9/+5
2015-02-02Thread: Modernize two functions that slipped through previous rebasesYuri Kunde Schlesner1-3/+3
2015-02-02Make Port/Service registration and querying more HW-accurateYuri Kunde Schlesner1-4/+16
2015-01-30SVC: Use CASCADE_RESULT in SVC handlersYuri Kunde Schlesner1-73/+32
2015-01-30Remove result.h InvalidHandleYuri Kunde Schlesner1-15/+16
It was only being used in two places, where it was replaced by a local constant.
2015-01-30SVC: Change return type of handlers to ResultCodeYuri Kunde Schlesner1-90/+90
2015-01-30Kernel: Convert Event to not use HandlesYuri Kunde Schlesner1-11/+29
2015-01-30Kernel: Convert Timer to (mostly) not use HandlesYuri Kunde Schlesner1-7/+40
2015-01-30Kernel: Convert Mutex to not use HandlesYuri Kunde Schlesner1-5/+19
2015-01-30Kernel: Convert AddressArbiter to not use HandlesYuri Kunde Schlesner1-6/+24
2015-01-30Kernel: Convert Semaphore to not use HandlesYuri Kunde Schlesner1-6/+27
2015-01-30Kernel: Convert SharedMemory to not use HandlesYuri Kunde Schlesner1-15/+29
2015-01-27SVC: Update the SVC function tablepurpasmart961-7/+7
2015-01-22WaitSynchronization: Added a result code for invalid result, fixed bug.bunnei1-3/+9
2015-01-22Thread: Fix WaitSynchronization1 to not set register 1 on thread wakeup.bunnei1-3/+3
2015-01-22Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void.bunnei1-7/+3
2015-01-22WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual.bunnei1-2/+2
2015-01-22Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs.bunnei1-0/+1
2015-01-22Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely.bunnei1-2/+2
2015-01-22SVC: Removed a Sleep that made no sensebunnei1-6/+1
- Would deadlock the calling thread - Code would never get hit anyways
2015-01-22AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense.bunnei1-3/+3
2015-01-22Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.bunnei1-10/+20
2015-01-22WaitSynchronizationN: Improved commentsbunnei1-7/+12
2015-01-22WaitSynchronizationN: Refactor to fix several bugsbunnei1-25/+27
- 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-22Kernel: Separate WaitSynchronization into Wait and Acquire methods.bunnei1-4/+5
2015-01-22WaitSynchronizationN: Handle case where handles=nullptr.bunnei1-0/+4
2015-01-22WaitSynchronizationN: Handle case where handle_count is invalid.bunnei1-3/+7
2015-01-22WaitSynchronizationN: Handle case where handle_count=0.bunnei1-19/+29
2015-01-22WaitSynchronizationN: Implement return valuesbunnei1-27/+50
2015-01-13AddrArbiter: Implement arbitration types 3 and 4.Subv1-1/+1
2015-01-11SVC: Wake up the thread after the delay in WaitSync1Subv1-3/+2
2015-01-10Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance.archshift1-1/+0
2015-01-09Kernel: Start using boost::intrusive_ptr for lifetime managementYuri Kunde Schlesner1-13/+18
2015-01-09Thread: Reduce use of Handles and move some funcs to inside the class.Yuri Kunde Schlesner1-20/+31
2015-01-09Move ThreadContext to core/core.h and deal with the falloutYuri Kunde Schlesner1-0/+1
2015-01-09SVC: Implemented the Timer service calls.Subv1-4/+32
2015-01-09SVC: Fixed SleepThread.Subv1-0/+4
It will now properly wait the specified number of nanoseconds and then wake up the thread.
2015-01-07Warn if a new thread is intended to be run on the system CPU core until we implement correct scheduling for such a thread.Kevin Hartman1-0/+5
2014-12-31SOC_U: Preliminary implementation of sockets.Subv1-1/+13
Stubbed CreateMemoryBlock Using Berkeley sockets, and Winsock2.2 on Windows. So far ftpony creates the socket and accepts incoming connections SOC_U: Renamed functions to maintain consistency Also prevents possible scope errors / conflicts with the actual Berkeley socket functions SOCU: Close all the opened sockets when cleaning up SOCU
2014-12-28Kernel: New handle managerYuri Kunde Schlesner1-19/+9
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-28Rename ObjectPool to HandleTableYuri Kunde Schlesner1-5/+5
2014-12-21License changepurpasmart961-1/+1
2014-12-21Thread: Wait current thread on svc_SleepThreadbunnei1-1/+2
- Removed unused VBLANK sleep mode - Added error log for bad context switch - Renamed VerifyWait to CheckWaitType to be more clear
2014-12-15Remove SyncRequest from K::Object and create a new K::Session typeYuri Kunde Schlesner1-7/+4
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-13Kernel/Semaphores: Fixed buildSubv1-2/+2
2014-12-13SVC: Implemented ReleaseSemaphore.Subv1-3/+10
This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
2014-12-13SVC: Implemented svcCreateSemaphoreSubv1-1/+10
ToDo: Implement svcReleaseSemaphore * Some testing against hardware needed
2014-12-13Convert old logging calls to new logging macrosYuri Kunde Schlesner1-27/+27
2014-12-12MemMap: Renamed "GSP" heap to "linear", as this is not specific to GSP.bunnei1-1/+1
- Linear simply indicates that the mapped physical address is always MappedVAddr+0x0C000000, thus this memory can be used for hardware devices' DMA (such as the GPU).
2014-12-04SVC: Implemented GetThreadId.Subv1-4/+5
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-11-26SVC: Add debug log to ArbitrateAddress.bunnei1-0/+2
2014-11-26SVC: SleepThread should yield to the next ready thread.bunnei1-0/+3
2014-11-24HLE: Revamp error handling throrough the HLE codeYuri Kunde Schlesner1-31/+37
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-19Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generatedEmmanuel Gil Peyrot1-14/+14
2014-11-19Kernel:Add missing permissions in shared memory & svcpurpasmart961-0/+4
2014-11-18core: Mark some hle functions as staticLioncash1-26/+26
These functions are not referred to by their linkage name outside of the translation unit, so they can be marked as static.
2014-10-30Fix some warningsSean1-3/+3
2014-09-09core: Prune redundant includesarchshift1-3/+0
2014-09-09Added string_util to common, small changes in loader.cpparchshift1-1/+1
2014-08-19SVC: Added support for svc_GetSystemTick.bunnei1-1/+6
Changed HLE function return methods to be static inline functions.
2014-08-18Core: Alter the kernel string functions to use std::string instead of const char*.Lioncash1-5/+5
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
2014-08-17Core: Fix a formatting error in svc.cppLioncash1-3/+2
entry_point would not be added to the string. Also used StringFromFormat so that the buffer is unnecessary.
2014-08-08SVC: Fixed typo with MapMemoryBlock DEBUG_LOG call.bunnei1-1/+1
2014-08-06SVC: Removed ArbitrateAddress log message that spams to much.bunnei1-2/+0
2014-07-09Kernel: Added preliminary support for address arbiters.bunnei1-8/+10
AddressArbiter: Added documentation comment, fixed whitespace issue. AddressArbiter: Fixed incorrect comment, reordered if-statement to be more clear. SVC: Removed trailing whitespace.
2014-07-05SharedMemory: Updated MapSharedMemory to use an enum for permissions.bunnei1-10/+9
- Also added some safety checks to MapSharedMemory.
2014-07-05GSP: Fixed to use real shared memory object, various cleanups.bunnei1-5/+6
- Previously, used a hard-coded shared memory handle of 0x10002000 (as used by libctru homebrew) GSP: Added name for shared memory. GSP: Cleaned up assertion message.
2014-06-13SVC: Renamed all function wrapper templates to Wrap, moved to HLE namespace.bunnei1-126/+126
2014-06-13SVC: Cleaned up function wrappers to pass in correct argument types.bunnei1-148/+138
2014-06-13SVC: Moved declaration of "wait" variable in SendSyncRequest for improved readability.bunnei1-1/+1
2014-06-13HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)bunnei1-107/+107
2014-06-13HLE: Updated various handle debug assertions to be more clear.bunnei1-6/+6
2014-06-13Kernel: Added real support for thread and event blockingbunnei1-28/+31
- 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-02svc: updated WaitSynchronizationN to properly use first pointer argumentbunnei1-3/+3
2014-06-02svc: changed DuplicateHandle log message from "error" to "debug"bunnei1-1/+1
2014-06-02svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle supportbunnei1-3/+26
2014-06-02kernel: changed main thread priority to default, updated Kernel::Reschedule to use PrepareReschedulebunnei1-2/+7
2014-06-02svc: cleaned up function_wrappers, updated various SVCs to make use of pointer argumentsbunnei1-16/+18
2014-06-01svc: updated waitSychronization to not overwrite handle on return, added stub for SleepThread (does nothing)bunnei1-2/+21
2014-05-30hle: cleaned up log messagesbunnei1-27/+28
2014-05-30svc: updated OutputDebugString to use OS_LOGbunnei1-1/+1
2014-05-30svc: changed unimplemented SVC log messages from "debug" messages to "error" messagesbunnei1-8/+8
2014-05-30svc: added svcClearEvent, stubbed function for svcArbitrateAddress, and various fixesbunnei1-22/+32
- force kernel reschedule after svcWaitSynchronization - fixed some bugs with passing in pointer arguments - cleaned up some comments and log messages
2014-05-28svc: implemented WaitSynchronization1, WaitSynchronizationN, and CreateEventbunnei1-14/+54
2014-05-27kernel: updated SyncRequest to take boolean thread wait result as a parameterbunnei1-2/+9
2014-05-27svc: added some assertionsbunnei1-6/+4
2014-05-27svc: changed SendSyncRequest to use Kernel::Object SyncRequest (instead of just service Interface class)bunnei1-2/+2
2014-05-27svc: added stub for DuplicateHandle SVC callbunnei1-1/+8
2014-05-23svc: added a check to ensure that a service was implemented before attempting to connect to its portbunnei1-1/+5
2014-05-23thread: renamed "WaitCurThread" to "WaitCurrentThread", removed unused "reason" argumentbunnei1-2/+2
2014-05-23thread: removed unused SwitchContext/Reschedule reason field, added missing arg parameter to SVC CreateThreadbunnei1-8/+5
2014-05-22svc: added Kernel::Reschedule to svc WaitSynchronization1, updated log messages to include newly created handlesbunnei1-4/+7
2014-05-21svc: enabled use of newly created kernel thread handlebunnei1-5/+5
2014-05-21mutex: refactored the interface to code to return a Mutex* handlebunnei1-1/+1
2014-05-21mutex: initial commit of HLE modulebunnei1-4/+5
2014-05-21svc: added some commentsbunnei1-0/+7
2014-05-21thread: moved threading calls to the Kernel namespacebunnei1-2/+2
2014-05-21renamed "syscall" module to "svc" (more accurate naming)bunnei1-5/+7
2014-05-19renamed "session" to "handle"bunnei1-3/+3
2014-05-19fix warningbunnei1-1/+1
2014-05-19renamed "UID" to "Handle" where appropriatebunnei1-2/+2
2014-05-18- added stub for CreateEventbunnei1-8/+22
- changed some stubbed SVCs to return unique handle names for debugging purposes
2014-05-18added stubbed function for WaitSynchronizationNbunnei1-3/+13
2014-05-17cleanups to SVC CreateThreadbunnei1-8/+15
2014-05-16- added SVC stubs for QueryMemory and GetThreadIdbunnei1-2/+14
- added SVC structs MemoryInfo and PageInfo
2014-05-16- added ThreadContext structbunnei1-8/+12
- cleaned up CreateThread svc
2014-05-14added CreateThread, CreateMutex, and ReleaseMutex SVC stubs (just parameter decoding for now)bunnei1-6/+37
2014-05-08removed unnecessary log messagebunnei1-1/+1
2014-05-07- added debug logging to syscall.cppbunnei1-134/+162
- added stubbed HLE syscall functions for svc_GetResourceLimit and svc_GetResourceLimitCurrentValues
2014-05-02- added some function wrappers for HLEbunnei1-2/+17
- added stub for SVC CreateAddressArbiter - added OutputDebugString SVC
2014-04-25fixed bug where svc_ControlMemory was not properly getting passed in parametersbunnei1-2/+2
2014-04-25- added preliminary support for svc_MapMemoryBlockbunnei1-4/+34
- added shared memory region - moarrrr cleanups to memory_map
2014-04-18renamed hw_lcd module to just lcdbunnei1-2/+0
2014-04-18added GSP heap memory allocationbunnei1-1/+25
2014-04-17- fixed tabs in function_wrappers.hbunnei1-126/+138
- fixed log message wording in hle.cpp - added syscall stubs for CloseHandle and WaitSynchronization1
2014-04-13- added HLE to connect to "srv:" servicebunnei1-128/+138
- added a manager for keeping track of services/ports - added a memory mapped region for memory accessed by HLE - added HLE for GetThreadCommandBuffer function
2014-04-12- renamed hle_syscall to just syscallbunnei1-62/+64
- added service.h as an initial service interface
2014-04-11added remaining known syscall functions to Syscall_Tablebunnei1-0/+80
2014-04-11base code to call a syscall from ARM11 appcorebunnei1-4/+51
2014-04-11changed some naming/misc cleanupsbunnei1-2/+2
2014-04-11- removed syscall classes (will just use HLEFunction)bunnei1-4/+6
- added hle.cpp and module registration - removed unused code
2014-04-11added initial modules for setting up SysCall HLEbunnei1-0/+22