-
Notifications
You must be signed in to change notification settings - Fork 57
Software Interrupt
Matthias Melcher edited this page Nov 20, 2023
·
9 revisions
Software Interrupts (SWIs) can be used by the OS to run kernel functions that require supervisor mode. They are called with the ARM command SWI n
where n
is the major interrupt ID. Further data may be provided through registers.
When reaching the Generic SWI, the following resisters are available:
Reg | Content |
---|---|
r0 | inArg1 & 0x0F |
r1 | TRUNC(inArg2, kPageSize) |
r2 | gObjectTable |
r3 | 1 |
r4 | inArg1 |
r5 | inArg2 |
r6 | inArg3 |
r12 | inArg4 |
r7 | 0 (err) |
r8 | gCurrentTask |
r9 | 0 |
r10 | kOSErrTaskDoesNotExist |
The available interrupts are:
major | minor | description |
---|---|---|
0x00 | ObjectId GetPortSWI(int what) | |
0x01 | NewtonErr PortSendSWI(ObjectId inPortId, ObjectId inMsgId, ObjectId inMemId, ULong inMsgType, ULong inFlags) | |
0x02 | NewtonErr PortReceiveSWI(ObjectId inId, ObjectId inMsgId, ULong inMsgFilter, ULong inFlags) | |
0x03 | void EnterAtomicSWI() | |
0x04 | void ExitAtomicSWI() | |
0x05 | NewtonErr GenericSWI(minor, ...) | |
0 | TaskSetGlobals | |
1 | TaskGiveObject | |
2 | TaskAcceptObject | |
3 | GetGlobalTime | |
4 | n.a. | |
5 | TaskResetAccountTime | |
6 | TaskGetNextId | |
7 | NewtonErr ForgetPhysMapping(ULong inDomain, VAddr inArg2, ObjectId inPageId) | |
8 | NewtonErr ForgetPermMapping(ULong inDomain, VAddr inVAddr, size_t inSize) | |
9 | NewtonErr ForgetMapping(ULong inDomain, VAddr inVAddr, ObjectId inPageId) | |
10 | NewtonErr RememberPhysMapping(ULong inDomain, VAddr inVAddr, ObjectId inPageId, bool inCacheable) | |
11 | NewtonErr RememberPermMapping(ULong inDomain, VAddr inVAddr, size_t inSize, Perm inPerm) | |
12 | NewtonErr RememberMapping(ULong inDomain, VAddr inVAddr, ULong inPerm, ObjectId inPageId, bool inCacheable) | |
13 | NewtonErr AddPageTable(ULong inArg1, ULong inArg2, ULong inArg3) - returns 0 in r0, that's all | |
14 | NewtonErr RemovePageTable(ULong inArg1, ULong inArg2) - returns -1 in r0, that's all | |
15 | n.a. | |
16 | n.a. | |
17 | PMRelease: NewtonErr ReleasePage(ObjectId inPageId) | |
18 | NewtonErr CopyPhysPgGlue(ObjectId inFromId, ObjectId inToId, ULong inSubPageMask) | |
19 | NewtonErr InvalidatePhys(ObjectId inId) | |
20 | size_t PhysSize(ObjectId inId) | |
21 | PAddr PhysBase(ObjectId inId) | |
22 | ULong PhysAlign(ObjectId inId) | |
23 | bool PhysReadOnly(ObjectId inId) | |
24 | n.a. | |
25 | n.a. | |
26 | ScheduleTask | |
27 | TaskYield | |
28 | NewtonErr Reboot(NewtonErr inError, ULong inRebootType, bool inSafe) | |
29 | void Restart() | |
30 | NewtonErr PrimRegisterDelayedFunction(ObjectId inMsgId, Timeout inTimeout, void * inData, TimeoutProcPtr inProc) | |
31 | NewtonErr PrimRemoveDelayedFunction(ObjectId inMsgId) | |
32 | RememberMappingUsingPAddr: NewtonErr AddPgPAndPermWithPageTable(PAddr inDescriptors, VAddr inVAddr, ULong inPerm, PAddr inPhysAddr, bool inCacheable) | |
33 | void SetDomainRange(PAddr inVAddr, size_t inSize, ULong inDomain) | |
34 | void ClearDomainRange(PAddr inVAddr, size_t inSize) | |
35 | NewtonErr SetEnvironment(ObjectId inEnvId, ObjectId * outEnvId) | |
36 | NewtonErr GetEnvironment(ObjectId * outEnvId) | |
37 | NewtonErr AddDomainToEnvironment(ObjectId inEnvId, ObjectId inDomId, ULong inFlags) | |
38 | NewtonErr RemoveDomainFromEnvironment(ObjectId inEnvId, ObjectId inDomId) | |
39 | NewtonErr EnvironmentHasDomain(ObjectId inEnvId, ObjectId inDomId, bool * outHasDomain, bool * outIsManager) | |
40 | SemGroupSetRefCon | |
41 | SemGroupGetRefCon | |
42 | PAddr VtoP(VAddr inVAddr) | |
43 | RealTimeClockDispatch | |
43.0 | kSetAlarmMessage | |
43.1 | kSetAlarmHandler | |
43.2 | kClearAlarm | |
43.3 | kAlarmStatus | |
43.4 | kCheckInAlarm | |
43.5 | kNewAlarmName | |
43.6 | kCheckOutAlarm | |
43.7 | kAlarmTime | |
43.8 | kSetAlarmTime | |
44 | MemObjManagerDispatch (see: g4MegDomainTable) | |
44.0 | kGetDomainInfoByIndex | |
44.1 | kGetDomainInfoByName | |
44.2 | kGetEnvInfo | |
44.3 | kGetEnvDomainName | |
44.4 | kGetEntryByIndex | |
44.5 | kGetEntryByName | |
44.6 | kSetEntryByIndex | |
44.7 | kSetEntryByName | |
45 | NetworkPersistentInfo | |
46 | TaskBequeath | |
47 | PrimGetPatchInfo | |
48 | ResetRebootReason | |
49 | NewtonErr RemovePMappings(PAddr inBase, size_t inSize) | |
50 | ClearFIQ | |
51 | SetTabletCalibration | |
52 | GetTabletCalibration | |
53 | SRegisterLoadedCodeWithDebugger | |
54 | SDeregisterLoadedCodeWithDebugger | |
55 | SInformDebuggerMemoryReloaded | |
56 | BackupPatch | |
57 | NewtonErr MakePhysInaccessible(ObjectId inId) | |
58 | NewtonErr MakePhysAccessible(ObjectId inId) | |
59 | VAddr GetRExConfigEntry(ULong inId, ULong inTag, size_t * outSize) | |
60 | NewtonErr ForgetPhysMapping(), see TaskSwitchedGlobals() | |
61 | NewtonErr RememberPhysMapping(), see TaskSwitchedGlobals() | |
62 | NewtonErr ChangeVirtualMapping(), see TaskSwitchedGlobals() | |
63 | NewtonErr ReleasePageTable(VAddr inVAddr) | |
64 | GetRExPtr | |
65 | GetLastRExConfigEntry | |
66 | SRegisterPackageWithDebugger | |
67 | ResetPortFlags | |
68 | PowerOffSystem | |
69 | PauseSystem | |
70 | CleanPageInIandDCacheSWIGlue | |
71 | CleanDCandFlushICSWIGlue | |
72 | CleanPageInDCSWIGlue | |
73 | CleanRangeInDCSWIGlue | |
74 | CopyPagesAfterStackCollided | |
75 | GetTaskStackInfo(const CUTask * inTask, VAddr * outStackTop, VAddr * outStackBase) | |
0x06 | GenerateMessageIRQ | |
0x07 | PurgeMMUTLBEntry | |
0x08 | FlushMMU | |
0x09 | FlushIDC | |
0x0A | GetCPUVersion | |
0x0B | SemaphoreOpGlue(ObjectId inGroupId, ObjectId inListId, SemFlags inBlocking, CTask * inTask) | |
0x0C | SetDomainRegister | |
0x0D | NewtonErr SMemSetBufferSWI(ObjectId id, void * buffer, size_t size, ULong permissions) | |
0x0E | NewtonErr SMemGetSizeSWI(ObjectId id, size_t * returnSize, void ** returnBuffer, OpaqueRef * refConPtr) | |
0x0F | NewtonErr SMemCopyToSharedSWI(ObjectId inId, void * inBuffer, size_t inSize, ULong inOffset, ObjectId inSendersMsgId, ULong inSendersSignature) | |
0x10 | NewtonErr SMemCopyFromSharedSWI(ObjectId inId, void * outBuffer, size_t inSize, ULong inOffset, ObjectId inSendersMsgId, ULong inSendersSignature) | |
0x11 | NewtonErr SMemMsgSetTimerParmsSWI(ObjectId id, ULong timeout, ULong timeLow, ULong timeHigh) | |
0x12 | NewtonErr SMemMsgSetMsgAvailPortSWI(ObjectId id, ULong availPort) | |
0x13 | NewtonErr SMemMsgGetSenderTaskIdSWI(ObjectId id, ObjectId * senderTaskId) | |
0x14 | NewtonErr SMemMsgSetUserRefConSWI(ObjectId id, OpaqueRef refCon) | |
0x15 | NewtonErr SMemMsgGetUserRefConSWI(ObjectId id, OpaqueRef * refConPtr) | |
0x16 | NewtonErr SMemMsgCheckForDoneSWI(ObjectId id, ULong flags, ObjectId * sentById, ObjectId * replyMemId, ULong * msgType, ULong * signature) | |
0x17 | NewtonErr SMemMsgMsgDoneSWI(ObjectId id, NewtonErr result, ULong signature) | |
0x18 | TurnOffCache | |
0x19 | TurnOnCache | |
0x1A | LowLevelCopyDone(NewtonErr inErr, CTask * inTask, VAddr inReturn) | |
0x1B | NewtonErr MonitorDispatchSWI(ObjectId inMonitorId, int inSelector, OpaqueRef inData) | |
0x1C | NewtonErr MonitorExitSWI(int monitorResult, void * continuationPC) | |
0x1D | void MonitorThrowSWI(ExceptionName, void *, ExceptionDestructor) | |
0x1E | EnterFIQAtomicSWI | |
0x1F | ExitFIQAtomicSWI | |
0x20 | NewtonErr MonitorFlushSWI(ObjectId inMonitorId) | |
0x21 | PortResetFilterSWI | |
0x22 | DoSchedulerSWI |