Skip to content

Software Interrupt

Matthias Melcher edited this page Nov 20, 2023 · 9 revisions

Software Interrupts (SWIs) can be used by the OS to run 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. All SWIs end in the task switcher.

When reaching the 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 GetPortSWI
0x01 PortSendSWI
0x02 PortReceiveSWI
0x03 EnterAtomicSWI
0x04 ExitAtomicSWI
0x05 Generic, can only be called from user mode
0 TaskSetGlobals
1 TaskGiveObject
2 TaskAcceptObject
3 GetGlobalTime
4 n.a.
5 TaskResetAccountTime
6 TaskGetNextId
7 ForgetPhysMapping
8 ForgetPermMapping
9 ForgetMapping
10 RememberPhysMapping
11 RememberPermMapping
12 RememberMapping
13 AddPageTable
14 RemovePageTable
15 n.a.
16 n.a.
17 PMRelease
18 CopyPhysPgGlue
19 InvalidatePhys
20 PhysSize
21 PhysBase
22 PhysAlign
23 PhysReadOnly
24 n.a.
25 n.a.
26 ScheduleTask
27 TaskYield
28 Reboot
29 Restart
30 PrimRegisterDelayedFunction
31 PrimRemoveDelayedFunction
32 RememberMappingUsingPAddr
33 SetDomainRange
34 ClearDomainRange
35 SetEnvironment
36 GetEnvironment
37 AddDomainToEnvironment
38 RemoveDomainFromEnvironment
39 EnvironmentHasDomain
40 SemGroupSetRefCon
41 SemGroupGetRefCon
42 VtoP
43 RealTimeClockDispatch
44 MemObjManagerDispatch
45 NetworkPersistentInfo
46 TaskBequeath
47 PrimGetPatchInfo
48 ResetRebootReason
49 RemovePMappings
50 ClearFIQ
51 SetTabletCalibration
52 GetTabletCalibration
53 SRegisterLoadedCodeWithDebugger
54 SDeregisterLoadedCodeWithDebugger
55 SInformDebuggerMemoryReloaded
56 BackupPatch
57 MakePhysInaccessible
58 MakePhysAccessible
59 GetRExConfigEntry
60 ForgetPhysMapping
61 RememberPhysMapping
62 ChangeVirtualMapping
63 ReleasePageTable
64 GetRExPtr
65 GetLastRExConfigEntry
66 SRegisterPackageWithDebugger
67 ResetPortFlags
68 PowerOffSystem
69 PauseSystem
70 CleanPageInIandDCacheSWIGlue
71 CleanDCandFlushICSWIGlue
72 CleanPageInDCSWIGlue
73 CleanRangeInDCSWIGlue
74 CopyPagesAfterStackCollided
75 GetTaskStackInfo
0x06 GenerateMessageIRQ
0x07 PurgeMMUTLBEntry
0x08 FlushMMU
0x09 FlushIDC
0x0A GetCPUVersion
0x0B SemaphoreOpGlue
0x0C SetDomainRegister
0x0D SMemSetBufferSWI
0x0E SMemGetSizeSWI
0x0F SMemCopyToSharedSWI
0x10 SMemCopyFromSharedSWI
0x11 SMemMsgSetTimerParmsSWI
0x12 SMemMsgSetMsgAvailPortSWI
0x13 SMemMsgGetSenderTaskIdSWI
0x14 SMemMsgSetUserRefConSWI
0x15 SMemMsgGetUserRefConSWI
0x16 SMemMsgCheckForDoneSWI
0x17 SMemMsgMsgDoneSWI
0x18 TurnOffCache
0x19 TurnOnCache
0x1B MonitorDispatchSWI
0x1C MonitorExitSWI
0x1D MonitorThrowSWI
0x1E EnterFIQAtomicSWI
0x1F ExitFIQAtomicSWI
0x20 MonitorFlushSWI
0x21 PortResetFilterSWI
0x22 DoSchedulerSWI

Clone this wiki locally