IOP OS: Difference between revisions
Jump to navigation
Jump to search
Hallowizer (talk | contribs) added interrupts and threads |
Hallowizer (talk | contribs) added info on mutexes |
||
| Line 2: | Line 2: | ||
== Toggling interrupts == | == Toggling interrupts == | ||
Disabling interrupts is simulated by locking a mutex implemented as a message queue and changing the current thread priority to 0x38. While this does not completely prevent concurrent execution within the module,{{check}} it is enough for most uses of <code>OSDisableInterrupts</code>. | Disabling interrupts is simulated by locking a mutex (but not an <code>OSMutex</code>) implemented as a message queue and changing the current thread priority to 0x38. While this does not completely prevent concurrent execution within the module,{{check}} it is enough for most uses of <code>OSDisableInterrupts</code>. | ||
== Threads == | == Threads == | ||
| Line 18: | Line 18: | ||
struct OSThread *head; | struct OSThread *head; | ||
struct OSThread *tail; | struct OSThread *tail; | ||
} | |||
</pre> | |||
== Mutexes == | |||
Mutexes are implemented as message queues that are read from to lock the mutex and sent to to unlock the mutex. | |||
<pre> | |||
struct OSMutex { | |||
int mqid; | |||
int mq; | |||
int count; | |||
int owner; // thread id | |||
} | } | ||
</pre> | </pre> | ||
Revision as of 00:16, 18 June 2022
IOP OS is a set of functions in IOS's networking code that convert Revolution OS calls to IOS syscalls; for example, OSAlloc is implemented as a call to IOS_Alloc.
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. While this does not completely prevent concurrent execution within the module,[check] it is enough for most uses of OSDisableInterrupts.
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
}