Yuri Kunde Schlesner
ec9c773251
Kernel: Remove previous scheduled event when a Timer is re-Set
11 years ago
Yuri Kunde Schlesner
664c79ff47
Thread: Modernize two functions that slipped through previous rebases
11 years ago
Lioncash
3f00dd9117
arm: Clean up ARMul_State
...
Remove unnecessary/unused struct variables.
11 years ago
Lioncash
96c174aed4
shared_memory: Fix assignments in SharedMemory::Map
11 years ago
Yuri Kunde Schlesner
d917a9bf77
Kernel: Mark all appropriate kernel objects as "final"
11 years ago
Yuri Kunde Schlesner
09ae6e1fa3
Remove result.h InvalidHandle
...
It was only being used in two places, where it was replaced by a local
constant.
11 years ago
Yuri Kunde Schlesner
d52d859936
Kernel: Convert Event to not use Handles
11 years ago
Yuri Kunde Schlesner
ad80ff1e32
Kernel: Convert Timer to (mostly) not use Handles
11 years ago
Yuri Kunde Schlesner
882b6fed75
Kernel: Convert Mutex to not use Handles
11 years ago
Yuri Kunde Schlesner
38e7122f23
Kernel: Convert AddressArbiter to not use Handles
11 years ago
Yuri Kunde Schlesner
d9b19be1d9
Kernel: Convert Semaphore to not use Handles
11 years ago
Yuri Kunde Schlesner
4bb33dfc30
Kernel: Convert SharedMemory to not use Handles
11 years ago
Yuri Kunde Schlesner
b5ee4f9df9
Move VAddr/PAddr typedefs to kernel.h
11 years ago
Yuri Kunde Schlesner
9a345de2bd
Kernel: Remove useless/duplicated comments; mark functions static
11 years ago
bunnei
68ddaaa2f5
Thread: Fix WaitSynchronization1 to not set register 1 on thread wakeup.
11 years ago
bunnei
4255f25647
Thread: Use std::find in CheckWait_WaitObject.
11 years ago
bunnei
2f3020a102
Mutex: Cleanup and remove redundant code.
11 years ago
bunnei
f09806aed2
Kernel: Renamed some functions for clarity.
...
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
11 years ago
bunnei
15b6a4d9ad
Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void.
11 years ago
bunnei
c68eb15695
WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual.
11 years ago
bunnei
69c5830ef2
Event: Fix implementation of "non-sticky" events.
11 years ago
bunnei
9e6ec3b6cd
Session: Change to a WaitObject.
11 years ago
bunnei
d2759c578e
Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs.
11 years ago
bunnei
dde02f79af
Mutex: Fix a bug where the thread should not wait if it already has the mutex.
11 years ago
bunnei
9412996c8f
Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely.
11 years ago
bunnei
254e4ebd58
AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense.
11 years ago
bunnei
e5a9f1c644
Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks.
11 years ago
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
11 years ago
bunnei
aa01c57ae9
Kernel: Separate WaitSynchronization into Wait and Acquire methods.
11 years ago
bunnei
7faf2d8e06
WaitSynchronizationN: Implement return values
11 years ago
bunnei
e4a5d8ad4f
Event: Fixed some bugs and cleanup (Subv)
11 years ago
bunnei
1f7a04f05a
Thread: Keep track of multiple wait objects.
11 years ago
bunnei
14cbbf4d9b
Event: Get rid of permanent_lock hack.
11 years ago
bunnei
5e77e2e1de
WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup.
11 years ago
bunnei
c22bac6398
Kernel: Added WaitObject and changed "waitable" objects inherit from it.
11 years ago
Lioncash
a3f5e5605c
core: Fix a few docstrings
11 years ago
Subv
9e2ae289b8
AddrArbiter: Implement arbitration types 3 and 4.
11 years ago
bunnei
542b0b0057
Merge pull request #466 from Subv/wake
...
Thread: Prevent waking a thread multiple times.
11 years ago
Subv
b68d51ed30
Thread: Prevent waking a thread multiple times.
...
If a thread was woken up by something, cancel the wakeup timeout.
11 years ago
Yuri Kunde Schlesner
8ad41775cc
Kernel: Start using boost::intrusive_ptr for lifetime management
11 years ago
Yuri Kunde Schlesner
d751de7341
Kernel: Don't re-assign object's handle when duplicating one
11 years ago
Yuri Kunde Schlesner
78ea76e12f
Thread: Fix nullptr access in a logging function
11 years ago
Yuri Kunde Schlesner
7f1557fbbd
Thread: Rename thread_queue => thread_list
11 years ago
Yuri Kunde Schlesner
9bf8462b96
Thread: Reduce use of Handles and move some funcs to inside the class.
11 years ago
Yuri Kunde Schlesner
ba72208cd4
Kernel: Move Thread's definition to the header file
11 years ago
Yuri Kunde Schlesner
7b3452c730
Move ThreadContext to core/core.h and deal with the fallout
11 years ago
bunnei
d46f650036
Merge pull request #255 from Subv/cbranch_3
...
Implemented timers
11 years ago
Subv
07044651ef
SVC: Implemented the Timer service calls.
11 years ago
Subv
dfc440785a
SVC: Fixed SleepThread.
...
It will now properly wait the specified number of nanoseconds and then wake up the thread.
11 years ago
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.
11 years ago
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.
11 years ago
bunnei
cc23269ff4
Merge pull request #407 from Subv/arbiter
...
AddressArbiter: Ported arbitration type 2 from 3dmoo.
11 years ago
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.
11 years ago
Subv
0276a75f24
AddressArbiter: Ported arbitration type 2 from 3dmoo.
...
(Thanks 3dmoo!)
11 years ago
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.
11 years ago
Yuri Kunde Schlesner
23f2142009
Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants
11 years ago
Yuri Kunde Schlesner
73fba22c01
Rename ObjectPool to HandleTable
11 years ago
bunnei
0de6a08d75
Merge pull request #291 from purpasmart96/license
...
License change
11 years ago
purpasmart96
ebfd831ccb
License change
11 years ago
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
11 years ago
bunnei
2e5869c939
Merge pull request #316 from yuriks/thread-handle
...
Kernel: Implement support for current thread pseudo-handle
11 years ago
Chin
e795692614
Clean up some warnings
11 years ago
Yuri Kunde Schlesner
adee775f44
Kernel: Implement support for current thread pseudo-handle
...
This boots a few (mostly Nintendo 1st party) games further.
11 years ago
bunnei
7bae450379
Merge pull request #185 from purpasmart96/mem_perm
...
Kernel: Add missing permissions
11 years ago
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
11 years ago
Yuri Kunde Schlesner
ca67bb7945
HLE: Rename namespaces to match move & fix initialization order
11 years ago
Yuri Kunde Schlesner
c72ccfa6db
HLE: Move kernel/archive.* to service/fs/
11 years ago
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.)
11 years ago
Subv
ea95876431
Kernel/Semaphore: Small style change
11 years ago
Subv
effb181888
Kernel/Semaphores: Invert the available count checking.
...
Same semantics, idea by @yuriks
11 years ago
Subv
5e25986235
Kernel/Semaphores: Addressed some issues.
11 years ago
Subv
cc81a510e3
Semaphore: Removed an unneeded function
11 years ago
Subv
61434651d8
Semaphores: Addressed some style issues
11 years ago
Subv
abff4a7ee2
Semaphore: Implemented the initial_count parameter.
11 years ago
Subv
49b31badba
SVC: Implemented ReleaseSemaphore.
...
This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
11 years ago
Subv
82c84883a5
SVC: Implemented svcCreateSemaphore
...
ToDo: Implement svcReleaseSemaphore
* Some testing against hardware needed
11 years ago
Lioncash
cfc0ee9c60
kernel: Remove unused log arguments
11 years ago
Yuri Kunde Schlesner
0600e2d8b5
Convert old logging calls to new logging macros
11 years ago
bunnei
3a75c8069e
Merge pull request #256 from Subv/mutex
...
Kernel/Mutex: Properly lock the mutex when a thread enters it
11 years ago
bunnei
dd203f7068
Thread: Fixed to wait on address when in arbitration.
11 years ago
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 .
11 years ago
Subv
bc318c464b
Mutex: Remove some forward declarations
...
Moved Mutex::WaitSynchronization to the end of the file.
11 years ago
Subv
64128aa61a
Mutex: Release all held mutexes when a thread exits.
11 years ago
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.
11 years ago
bunnei
17fae11fc7
Merge pull request #250 from Subv/cbranch_2
...
SVC: Implemented GetThreadId.
11 years ago
bunnei
5056329a80
Merge pull request #222 from archshift/renamexyz
...
Implemented RenameFile and RenameDirectory in FS:USER
11 years ago
Subv
6fac2bf0ab
Threads: Remove a redundant function.
...
Use the next_thread_id variable directly.
11 years ago
Subv
ef1d5cda06
Threads: Implemented a sequential thread id
11 years ago
archshift
139a4d91d9
Updated archive.cpp functions for proper error handling
11 years ago
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.
11 years ago
Lioncash
208598dbe2
kernel: Shorten GetCount
11 years ago
Lioncash
9b68d5e074
kernel: Make some functions const
11 years ago
bunnei
e3d1ffff4b
Merge pull request #225 from bunnei/fix-release-mutex
...
Mutex: Changed behavior to always release mutex for all threads.
11 years ago
bunnei
de851ba1a1
Thread: Check that thread is actually in "wait state" when verifying wait.
11 years ago
bunnei
a449e0e11a
Mutex: Changed behavior to always release mutex for all threads.
11 years ago
archshift
e5ff01c2cd
Implemented RenameDirectory in FS:USER
11 years ago
archshift
45afc15aa6
Implemented RenameFile in FS:USER
11 years ago
Yuri Kunde Schlesner
8189593255
Use pointers instead of passing handles around in some functions.
11 years ago
Yuri Kunde Schlesner
22c86824a4
Remove duplicated docs/update them for changed parameters.
11 years ago
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.
11 years ago
bunnei
ef1b16a7eb
Merge pull request #191 from archshift/deletexyz
...
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
11 years ago
archshift
8aeadbd95a
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
11 years ago
bunnei
c0cd0fa78e
Merge pull request #211 from linkmauve/master
...
Remove trailing spaces from the entire project
11 years ago
bunnei
112768f436
Merge pull request #208 from lioncash/statics
...
Add static to some variables
11 years ago
Emmanuel Gil Peyrot
f5d38649c7
Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated
11 years ago
Lioncash
7cbecde2ca
Add static to some variables
11 years ago
purpasmart96
66431bceda
Kernel:Add missing permissions in shared memory & svc
11 years ago
Lioncash
1a8f466217
Remove extraneous semicolons
11 years ago
bunnei
11641b5e79
Archive: Fixed to not destroy archive handle on close.
11 years ago
bunnei
bcb0dbf7e1
Archive: Fixed close archive before freeing.
11 years ago
bunnei
3e09c07378
FS_User: Support FileSye::Path in a more generic way.
...
added a todo to kernel archive
11 years ago
bunnei
a3107a6b57
FileSys: Updated backend code to use FileSys::Path instead of string for paths.
11 years ago
Lioncash
ac58b76e71
Fix two format strings.
11 years ago
archshift
04c90c395d
Added CreateDirectory function to service/fs.cpp, and in Archive.
11 years ago
Sean
9a012ff007
Fix some warnings
11 years ago
Yuri Kunde Schlesner
d72708c1f5
Add `override` keyword through the code.
...
This was automated using `clang-modernize`.
11 years ago
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.
11 years ago
Emmanuel Gil Peyrot
23c2fbfc7a
FileSys/Kernel: Implement SetSize service call for File objects.
11 years ago
archshift
1966f7b0ad
Use the citra user path for the sdmc directory
11 years ago
Emmanuel Gil Peyrot
3a570a9fee
Kernel: Implement the Close command for Archive, File and Directory.
11 years ago
Emmanuel Gil Peyrot
c197ce2180
Kernel: Add a Directory object and a getter for it from an Archive object.
11 years ago
Emmanuel Gil Peyrot
19d04f3abe
Kernel: Add a File object and a getter for it from an Archive object.
11 years ago
Lioncash
741321ac24
Core: Get rid of unnecessary switch statement in Kernel
11 years ago
archshift
6e606c515f
core: Prune redundant includes
11 years ago
bunnei
304999dfeb
Threading: Fix thread starting to execute first instruction correctly.
11 years ago
archshift
4c4a01bf41
Added FS functions to Archive and Archive_RomFS
11 years ago
Lioncash
ab4648d3ca
Core: Use std::array for managing kernel object space
...
These avoid relying on memset for clearing the arrays.
11 years ago
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.
11 years ago
bunnei
d4bd2f2e5d
Thread: Added more descriptive comment to WaitCurrentThread.
11 years ago
bunnei
2542350b85
AddressArbiter: Removed unnecessary HLE::Reschedule.
11 years ago
bunnei
60078baab1
AddressArbiter: Fixed bug with break statements missing from case statements.
11 years ago
bunnei
7a1f813be1
Kernel: Updated Event and Mutex to specify handle that they are blocking for.
11 years ago
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.
12 years ago
bunnei
ba840d3200
Thread: Added functions to resume threads from address arbitration.
...
Thread: Cleaned up arbitrate address functions.
Thread: Cleaned up ArbitrateAllThreads function.
12 years ago
bunnei
7ff92c36ed
SharedMemory: Updated MapSharedMemory to use an enum for permissions.
...
- Also added some safety checks to MapSharedMemory.
12 years ago
bunnei
e547128185
Kernel: Added support for shared memory objects.
...
SharedMemory: Added optional name field for tracking known objects.
12 years ago
bunnei
542700ccb7
Archive: Added Init/Shutdown methods to reset kernel archive state.
12 years ago
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.
12 years ago
bunnei
8b8c8f4c13
Kernel: Added stubbed code to support creation of kernel Archive objects.
12 years ago
bunnei
b45a38f557
Kernel: Removed unnecessary "#pragma once".
12 years ago
bunnei
f49ac3a2d7
Kernel: Added freeing of kernel objects on emulator shutdown.
12 years ago
bunnei
83a4ad2885
Event: Updated several log messages to be assertions.
12 years ago
bunnei
b62ef4bbd2
Thread: Renamed occurrences of "t" to "thread" to improve readability.
12 years ago
bunnei
5b7cf50a77
Thread: Cleaned up VerifyWait, fixed issue where nullptr msg could unnecessarily be logged.
12 years ago
bunnei
4620e2a741
HLE: Removed usnused EatCycles function.
12 years ago
bunnei
bfdd874b1f
Thread: Moved position of * in arguments.
12 years ago
bunnei
12e2a59565
Thread: Updated VerifyWait to be more readable (but functionally the same).
12 years ago
bunnei
c95972275e
HLE: Updated all uses of NULL to nullptr (to be C++11 compliant)
12 years ago
bunnei
5365ca157d
Kernel: Updated various kernel function "name" arguments to be const references.
12 years ago
bunnei
d7363322c7
HLE: Updated various handle debug assertions to be more clear.
12 years ago