In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "IOP OS"

From WiiBrew
Jump to navigation Jump to search
(SSL only uses IOP OS in IOS9)
(OSAlloc isn't actually a function in revolution os. it might be a DS SDK function though)
Line 1: Line 1:
'''IOP OS''' is a set of functions in the NET module (as well as SSL in [[IOS9]]) in [[IOS]] that convert [[Revolution OS]] calls to IOS [[IOS/Syscalls|syscalls]]; for example, OSAlloc is implemented as a call to IOS_Alloc.
+
'''IOP OS''' is a set of functions in the NET module (as well as SSL in [[IOS9]]) in [[IOS]] that convert [[Revolution OS]] (or possibly NTR OS, as certain features such as the number of threadSpecifics differ from Revolution OS) calls to IOS [[IOS/Syscalls|syscalls]].
  
 
== Toggling interrupts ==
 
== Toggling interrupts ==

Revision as of 08:42, 25 June 2022

IOP OS is a set of functions in the NET module (as well as SSL in IOS9) in IOS that convert Revolution OS (or possibly NTR OS, as certain features such as the number of threadSpecifics differ from Revolution OS) calls to IOS syscalls.

Toggling interrupts

Disabling interrupts is simulated by locking a mutex (but not an OSMutex) implemented as a message queue and changing the current thread priority to 0x38 (higher than other threads in the process). While this does not completely prevent concurrent execution within the module, it is enough for most uses of OSDisableInterrupts. Despite this, the design used may be a mistake when porting the code to IOS, since lower priority Revolution OS threads can starve from being blocked by higher priority threads, which would achieve this goal.

Threads

Threads are implemented as a proxy to IOS threads. Because of this, OSThreadQueue is only used for suspended queues.

struct OSThread {
	int threadId;
	int priority;
	void *threadSpecific;
	struct OSThread *next;
}

struct OSThreadQueue {
	struct OSThread *head;
	struct OSThread *tail;
}

Mutexes

Mutexes are implemented as message queues that are read from to lock the mutex and sent to to unlock the mutex.

struct OSMutex {
	int mqid;
	int mq;
	int count;
	int owner; // thread id
}