Commit Graph

111 Commits

Author SHA1 Message Date
8cf81643a9 arm_interface: Get rid of GetTicks.
Removes a TODO.
2015-03-16 12:18:37 -04:00
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
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
caa58acc84 WaitSynch: Always reschedule (verified behavior on hw). 2015-02-09 22:05:39 -05:00
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
c4208c1171 SVC: Enable CloseHandle, clean up DuplicateHandle 2015-02-02 15:37:04 -02:00
664c79ff47 Thread: Modernize two functions that slipped through previous rebases 2015-02-02 15:37:01 -02:00
8779b31fe6 Make Port/Service registration and querying more HW-accurate 2015-02-02 15:36:59 -02:00
58b544db99 SVC: Use CASCADE_RESULT in SVC handlers 2015-01-30 11:49:46 -02:00
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
44f90340dc SVC: Change return type of handlers to ResultCode 2015-01-30 11:49:44 -02:00
d52d859936 Kernel: Convert Event to not use Handles 2015-01-30 11:49:43 -02:00
ad80ff1e32 Kernel: Convert Timer to (mostly) not use Handles 2015-01-30 11:47:07 -02:00
882b6fed75 Kernel: Convert Mutex to not use Handles 2015-01-30 11:47:06 -02:00
38e7122f23 Kernel: Convert AddressArbiter to not use Handles 2015-01-30 11:47:06 -02:00
d9b19be1d9 Kernel: Convert Semaphore to not use Handles 2015-01-30 11:47:05 -02:00
4bb33dfc30 Kernel: Convert SharedMemory to not use Handles 2015-01-30 11:47:04 -02:00
206cabc0e4 Merge pull request #412 from purpasmart96/svc_table_cleanup
SVC: Update the SVC function table
2015-01-28 17:36:23 -05:00
62f4365db1 SVC: Update the SVC function table 2015-01-26 20:42:28 -08:00
731154f79e WaitSynchronization: Added a result code for invalid result, fixed bug. 2015-01-21 20:49:43 -05:00
68ddaaa2f5 Thread: Fix WaitSynchronization1 to not set register 1 on thread wakeup. 2015-01-21 20:48:46 -05:00
15b6a4d9ad Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void. 2015-01-21 20:47:49 -05:00
c68eb15695 WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual. 2015-01-21 20:47:49 -05:00
d2759c578e Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs. 2015-01-21 20:47:47 -05:00
9412996c8f Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely. 2015-01-21 20:47:46 -05:00
c06d64528a SVC: Removed a Sleep that made no sense
- Would deadlock the calling thread
- Code would never get hit anyways
2015-01-21 20:47:45 -05:00
254e4ebd58 AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense. 2015-01-21 20:47:45 -05:00
e5a9f1c644 Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks. 2015-01-21 20:47:38 -05:00
6deb1a0119 WaitSynchronizationN: Improved comments 2015-01-21 19:12:51 -05:00
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
aa01c57ae9 Kernel: Separate WaitSynchronization into Wait and Acquire methods. 2015-01-21 19:10:24 -05:00
627e96fc15 WaitSynchronizationN: Handle case where handles=nullptr. 2015-01-21 19:09:10 -05:00
f5c6d367c9 WaitSynchronizationN: Handle case where handle_count is invalid. 2015-01-21 19:09:09 -05:00
064be2b86f WaitSynchronizationN: Handle case where handle_count=0. 2015-01-21 19:09:09 -05:00
7faf2d8e06 WaitSynchronizationN: Implement return values 2015-01-21 19:09:03 -05:00
9e2ae289b8 AddrArbiter: Implement arbitration types 3 and 4. 2015-01-13 14:49:26 -05:00
38da198aa1 SVC: Wake up the thread after the delay in WaitSync1 2015-01-11 10:42:59 -05:00
228843c43e Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance. 2015-01-10 14:32:10 -08:00
8ad41775cc Kernel: Start using boost::intrusive_ptr for lifetime management 2015-01-09 19:43:52 -02:00
6ae12424df Merge pull request #444 from yuriks/handle-reform2
Kernel Lifetime Reform Pt. 2
2015-01-09 12:59:35 -05:00
86e07124ad Merge pull request #436 from kevinhartman/system-core
Warn if a new thread is intended to be run on the system CPU core
2015-01-09 11:14:35 -05:00
9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 2015-01-09 04:02:15 -02:00
7b3452c730 Move ThreadContext to core/core.h and deal with the fallout 2015-01-09 03:51:55 -02:00
d46f650036 Merge pull request #255 from Subv/cbranch_3
Implemented timers
2015-01-08 22:38:33 -05:00
07044651ef SVC: Implemented the Timer service calls. 2015-01-08 21:22:14 -05:00
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
63be6aaadd Warn if a new thread is intended to be run on the system CPU core until we implement correct scheduling for such a thread. 2015-01-07 14:14:48 -08:00
97a7381d29 SOC_U: Preliminary implementation of sockets.
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-31 10:51:44 -05:00
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
73fba22c01 Rename ObjectPool to HandleTable 2014-12-28 11:52:52 -02:00