diff --git a/Internal/NKOpaque.a b/Internal/NKOpaque.a deleted file mode 100644 index ce3affd..0000000 --- a/Internal/NKOpaque.a +++ /dev/null @@ -1,678 +0,0 @@ -; Opaque NanoKernel structures: -; - stored in the NanoKernel pool (not always) -; - associated with a class number and opaque ID (not always) -; - referenced by opaque ID (for MPLibrary's benefit) - - - - - -;_______________________________________________________________________ -; ID CLASS 1: PROCESS -; (size: 32b, thud command: id -p) -; -; The NanoKernel's internal representation of a cooperative process -; within the blue environment. Processes and tasks have a many-to-one -; relationship. -; -; There is a special 'blue' process that owns the blue task and all -; the CPU idle tasks. -;_______________________________________________________________________ - -Process record 0,INCR - -kIDClass equ 1 -kFirstID equ 0x00010001 -kSignature equ 'PROC' - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 00 -Signature ds.l 1 ; 04 ; 'PROC' -Flags ds.l 1 ; 08 ; MPCall_5 does something here -kFlag0 equ 0 -kFlag1 equ 1 -kFlag2 equ 2 -kFlag3 equ 3 -kFlag4 equ 4 -kFlag5 equ 5 -kFlag6 equ 6 -kFlag7 equ 7 -kFlag8 equ 8 -kFlag9 equ 9 -kFlag10 equ 10 -kFlag11 equ 11 -kFlag12 equ 12 -kFlag13 equ 13 -kFlag14 equ 14 -kFlag15 equ 15 -kFlag16 equ 16 -kFlag17 equ 17 -kFlag18 equ 18 -kFlag19 equ 19 -kFlag20 equ 20 -kFlag21 equ 21 -kFlag22 equ 22 -kFlag23 equ 23 -kFlag24 equ 24 -kFlag25 equ 25 -kFlag26 equ 26 -kFlag27 equ 27 -kFlag28 equ 28 -kFlag29 equ 29 -kFlag30 equ 30 -kFlag31 equ 31 -SystemAddressSpaceID ds.l 1 ; 0c ; set by Init.s after addrspc creation -TaskCount ds.l 1 ; 10 ; incremented by CreateTask -SystemAddressSpacePtr ds.l 1 ; 14 -AddressSpaceCount ds.l 1 ; 18 ; incremented by NKCreateAddressSpaceSub - ds.l 1 ; 1c - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 2: TASK -; (size: 1k, thud command: id -t) -; -; What the MPLibrary and NanoKernel call the unit of multitasking. -; (Remember that 'Thread' and 'Process' were taken.) -; -; Contains space for a ContextBlock in the style of the ECB, but -; blue's ContextBlockPtr is redirected to the ECB. -;_______________________________________________________________________ - -Task record 0,INCR - -kIDClass equ 2 -kFirstID equ 0x00020001 -kSignature equ 'TASK' - -;_______________________ -; Task priorities -;_______________________ - -kCriticalPriority equ 0 -kLatencyProtectPriority equ 1 -kNominalPriority equ 2 -kIdlePriority equ 3 - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 000 -Signature ds.l 1 ; 004 -QueueMember ds.l 4 ; 008:018 ; a task is always a member of a queue, e.g. the RDYQ -State ds.b 1 ; 018 ; non-zero when running -Priority ds.b 1 ; 019 ; CreateTask sets 2 by default -CPUIndex ds.w 1 ; 01a -Weight ds.l 1 ; 01c ; default is 100, blue gets 200, idle gets 1 - -Timer ds.b 64 ; 020:060 - -ProcessID ds.l 1 ; 060 -Flags ds.l 1 ; 064 ; IntAlignment is interested in bit 9, MPCalls 52/116 in bit 15 -kFlag0 equ 0 -kFlag1 equ 1 -kFlag2 equ 2 -kFlag3 equ 3 -kFlag4 equ 4 -kFlag5 equ 5 -kFlag6 equ 6 -kFlag7 equ 7 -kFlag8 equ 8 -kFlagTakesAllExceptions equ 9 -kFlag10 equ 10 -kFlag11 equ 11 -kFlag12 equ 12 ; set for idle1, idle2 -kFlag13 equ 13 -kFlagNotDebuggable equ 14 ; set for blue, idle1 -kFlagBlue equ 15 -kFlag16 equ 16 -kFlag17 equ 17 -kFlagPageFaulted equ 18 -kFlag19 equ 19 -kFlag20 equ 20 -kFlagPerfMon equ 21 ; set by MPMarkPMFTask, means perf monitor -kFlagStopped equ 22 -kFlag23 equ 23 -kFlag24 equ 24 -kFlag25 equ 25 ; set for idle1, idle2 -kFlag26 equ 26 ; set for blue, cleared when preempted, set when run -kFlagSchToInterruptEmu equ 27 ; set when scheduler should trigger a 68k interrupt in this task -kFlag28 equ 28 ; set for blue -kFlag29 equ 29 -kFlagAborted equ 30 -kFlag31 equ 31 - - ds.l 1 ; 068 -OwningProcessPtr ds.l 1 ; 06c -AddressSpacePtr ds.l 1 ; 070 ; borrowed from PROC argument to CreateTask -Name ds.l 1 ; 074 ; 'blue', creator of owning cooperative process, etc -CpuID ds.l 1 ; 078 - ds.l 1 ; 07c -CreateTime3 ds.d 1 ; 080 -ContextBlockPtr ds.l 1 ; 088 ; points internally by default, and to EDP.ECB in blue -VectorSaveArea ds.l 1 ; 08c - ds.l 1 ; 090 - ds.l 1 ; 094 - ds.l 1 ; 098 -NotificationPtr ds.l 1 ; 09c -PageFaultSema ds.b 32 ; 0a0:0c0 ; task blocks on this fake sema, only to run when high-priority blue is done -Zero1 ds.l 1 ; 0c0 -Zero2 ds.l 1 ; 0c4 -CreateTime1 ds.d 1 ; 0c8 -CreateTime2 ds.d 1 ; 0d0 - ds.l 1 ; 0d8 - ds.l 1 ; 0dc -CodeFaultCtr ds.l 1 ; 0e0 ; these two only climb when VM is on -DataFaultCtr ds.l 1 ; 0e4 -PreemptCtr ds.l 1 ; 0e8 -SomeLabelField ds.l 1 ; 0ec -VecBase ds.l 1 ; 0f0 -ExceptionHandlerID ds.l 1 ; 0f4 ; a queue -ErrToReturnIfIDie ds.l 1 ; 0f8 - ds.l 1 ; 0fc -ContextBlock ds.b 768 ; 100:400 ; like the EDP's Emulator Context Block -- unsure of size - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 3: TIMER -; (size: 64b, thud command: id -tm) -; -; "Prev" is actually the next timer to fire! -;_______________________________________________________________________ - -Timer record 0,INCR - -kIDClass equ 3 -kFirstID equ 0x00030001 -kSignature equ 'TIME' - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 00 ; task+20 -Signature ds.l 1 ; 04 ; task+24 -QueueLLL ds.l 1 ; 08 ; task+28 ; overlaps with the below bytefields, as a union? - ds.l 1 ; 0c ; task+2c -ProcessID ds.l 1 ; 10 ; task+30 - -Kind ds.b 1 ; 14 ; task+34 ; InitTMRQs sets to 6, MPCall 55 to 1, MPCall 52 to 2 -kKind1 equ 1 -kKind2 equ 2 -kKind3 equ 3 -kKind4 equ 4 -kKind5 equ 5 -kKind6 equ 6 -kKind7 equ 7 - -Byte1 ds.b 1 ; 15 ; task+35 -KeepAfterFiring ds.b 1 ; 16 ; task+36 ; InitTMRQs sets to 1 -Byte3 ds.b 1 ; 17 ; task+37 ; called_by_init_tmrqs sets to 1 - -MessageQueueID -ParentTaskPtr ds.l 1 ; 18 ; task+38 ; task to be unblocked when timer fires -ReservedMessage ds.l 1 ; 1c ; task+3c ; 'note' allocated when timer armed -Message1 ds.l 1 ; 20 ; task+40 ; if I hit a message queue -Message2 ds.l 1 ; 24 ; task+44 -Message3 ds.l 1 ; 28 ; task+48 -EventGroupID ds.l 1 ; 2c ; task+4c ; if I hit an event group -EventGroupFlags ds.l 1 ; 30 ; task+50 -SemaphoreID ds.l 1 ; 34 ; task+54 -Time ds.l 2 ; 38 ; task+58 ; set from first two args to MPCall 55 - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 4: QUEUE -; (size: 52b, thud command: id -q) -; -;_______________________________________________________________________ - -Queue record 0,INCR - -kIDClass equ 4 -kFirstID equ 0x00040001 - -;_______________________ -; Fields -;_______________________ - -BlockedTasks ds.l 4 ; 00:10 ; titled MSGQ ; waiting for messages -Messages ds.l 4 ; 10:20 ; titled NOTQ ; waiting for tasks -ProcessID ds.l 1 ; 20 ; why associate a queue with a process? -ReserveCount ds.l 1 ; 24 ; as number of messages, from MPSetQueueReserve -ReservePtr ds.l 1 ; 28 ; ptr to first element of -BlockedTaskCount ds.l 1 ; 2c -MessageCount ds.l 1 ; 30 - -Size equ * - endr - - - -ReadyQueue record 0,INCR - -LLL ds.l 4 ; 00:10 ; nothing fancy, freeform contains priority flag -Counter ds.l 1 ; 10 ; SchInit sets, SchRdyTaskLater bumps, major_0x13e4c decs -TotalWeight ds.l 1 ; 14 ; divide available time by these -Timecake ds.d 1 ; 18 ; period of ~1ms, 8ms, 64ms, 512ms - - - org 0x20 -; Constants -kSignature equ 'RDYQ' - - endr - - - - -Message record 0,INCR - -kSignature equ 'note' -kReservedSignature equ 'notr' - -LLL ds.l 4 ; 00:10 ; singly linked (next ptrs) only -Word1 ds.l 1 ; 10 -Word2 ds.l 1 ; 14 -Word3 ds.l 1 ; 18 - -Size equ * - endr - - -kTimerQueueSignature equ 'TMRQ' -kDelayQueueSignature equ 'DLYQ' -kDbugQueueSignature equ 'DBUG' -kPageQueueSignature equ 'PAGQ' -kNotQueueSignature equ 'NOTQ' -kSemaQueueSignature equ 'SEMQ' - - - - -;_______________________________________________________________________ -; ID CLASS 5: SEMAPHORE -; (size: 32b, thud command: id -s) -; -;_______________________________________________________________________ - -Semaphore record 0,INCR - -kIDClass equ 5 -kFirstID equ 0x00050001 -kSignature equ 'SEMA' - -;_______________________ -; Fields -;_______________________ - -BlockedTasks ds.l 4 ; 00:10 ; blocked tasks -Value ds.l 1 ; 10 ; negative if tasks are blocked??? -MaxValue ds.l 1 ; 14 -ProcessID ds.l 1 ; 18 -BlockedTaskCount ds.l 1 ; 1c ; starts as 0 - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 6: CRITICAL REGION -; (size: 36b, thud command: id -r) -; -;_______________________________________________________________________ - -CriticalRegion record 0,INCR - -kIDClass equ 6 -kFirstID equ 0x00060001 -kSignature equ 'CRGN' - -;_______________________ -; Fields -;_______________________ - -LLL ds.l 4 ; 00:10 -ProcessID ds.l 4 ; 10:20 ; lll.freeform is the field? - ds.l 1 ; 20 - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 7: CPU -; (size: 32+800+128 = 960b, thud command: id -c) -; -;_______________________________________________________________________ - -CPU record 0,INCR - -kIDClass equ 7 -kFirstID equ 0x00070001 -kSignature equ 'CPU ' - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 00 -Signature ds.l 1 ; 04 -LLL ds.l 4 ; 08:18 ; member of CGRP -Flags ds.l 1 ; 18 ; contains 0x0000000f ; cannot delete if this field & 9 -IdleTaskPtr ds.l 1 ; 1c - -EWABase ds.b 800 ; negative-indexed parts of EWA -EWA ds.b 128 ; positive-indexed parts of EWA - -kFlag0 equ 0 -kFlag1 equ 1 -kFlag2 equ 2 -kFlag3 equ 3 -kFlag4 equ 4 -kFlag5 equ 5 -kFlag6 equ 6 -kFlag7 equ 7 -kFlag8 equ 8 -kFlag9 equ 9 -kFlag10 equ 10 -kFlag11 equ 11 -kFlag12 equ 12 -kFlag13 equ 13 -kFlag14 equ 14 -kFlag15 equ 15 -kFlag16 equ 16 -kFlag17 equ 17 -kFlag18 equ 18 -kFlag19 equ 19 -kFlag20 equ 20 -kFlag21 equ 21 -kFlag22 equ 22 -kFlag23 equ 23 -kFlag24 equ 24 -kFlag25 equ 25 -kFlag26 equ 26 -kFlag27 equ 27 -kFlagScheduled equ 28 -kFlag29 equ 29 -kFlag30 equ 30 -kFlag31 equ 31 - - -Size equ * - endr - - - - - -;_______________________________________________________________________ -; ID CLASS 8: ADDRESS SPACE -; (size: 192b, thud command: id -sp) -; -;_______________________________________________________________________ - -AddressSpace record 0,INCR - -kIDClass equ 8 -kFirstID equ 0x00080001 -kSignature equ 'SPAC' - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 00 -Signature ds.l 1 ; 04 -Flags ds.l 1 ; 08 -kFlag30 equ 30 -TaskCount ds.l 1 ; 0c ; incremented by CreateTask -RsrvList ds.l 4 ; 10:20 ; LLL -AreaList ds.l 4 ; 20:30 ; LLL -SRs ds.l 16 ; 30:70 ; segment register values -ParentCoherenceSpecialPtr ds.l 1 ; 70 ; SpecialPtr of owning cgrp (in list owned by Cpu) -ProcessID ds.l 1 ; 74 ; ID of owning PROC - ds.l 1 ; 78 - ds.l 1 ; 7c -BATs -BAT0U ds.l 1 ; 80 -BAT0L ds.l 1 ; 84 -BAT1U ds.l 1 ; 88 -BAT1L ds.l 1 ; 8c -BAT2U ds.l 1 ; 90 -BAT2L ds.l 1 ; 94 -BAT3U ds.l 1 ; 98 -BAT3L ds.l 1 ; 9c -ExtraBATs ; the flag that enables these is never set? -ExtraBAT0U ds.l 1 ; a0 -ExtraBAT0L ds.l 1 ; a4 -ExtraBAT1U ds.l 1 ; a8 -ExtraBAT1L ds.l 1 ; ac -ExtraBAT2U ds.l 1 ; b0 -ExtraBAT2L ds.l 1 ; b4 -ExtraBAT3U ds.l 1 ; b8 -ExtraBAT3L ds.l 1 ; bc - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 9: EVENT GROUP -; (size: 32b, thud command: id -e) -; -;_______________________________________________________________________ - -EventGroup record 0,INCR - -kIDClass equ 9 -kFirstID equ 0x00090001 -kSignature equ 'EVNT' - -;_______________________ -; Fields -;_______________________ - -LLL ds.l 4 ; 00:10 ; first field is ID -Flags ds.l 1 ; 10 -ProcessID ds.l 1 ; 14 -SWI ds.l 1 ; 18 ; contains 1-8 +/- 16 ; flag 27 (=16) means "is swi" -Counter ds.l 1 ; 1c - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 10: COHERENCE GROUP -; (size: 88b, thud command: id -cg) -; -;_______________________________________________________________________ - -CoherenceGroup record 0,INCR - -kIDClass equ 10 -kFirstID equ 0x000a0001 -kSignature equ 'CGRP' - -;_______________________ -; Fields -;_______________________ - -CPUList ds.l 4 ; 00:10 ; CPUs on this "motherboard" -LLL ds.l 4 ; 10:20 ; member of global CGRP list -CpuCount ds.l 1 ; 20 -ScheduledCpuCount ds.l 1 ; 24 -LA_CpuPlugin ds.l 1 ; 28 ; page-aligned -PA_CpuPlugin ds.l 1 ; 2c ; page-aligned -CpuPluginSize ds.l 1 ; 30 ; page-aligned size -LA_CpuPluginDesc ds.l 1 ; 34 ; non-page-aligned ; [1c] = count, [20...] = entry table -PA_CpuPluginDesc ds.l 1 ; 38 ; non-page-aligned -PA_CpuPluginTOC ds.l 1 ; 3c ; "table of contents": a TVector pointer for each selector -PA_CpuPluginStackPtrs ds.l 1 ; 40 ; array of stack pointers (one per CPU) -CpuPluginSelectorCount ds.l 1 ; 44 ; max of 64 -Incrementer ds.l 1 ; 48 ; number of NKCreateAddressSpaceSub calls % 1M -CpuPluginSpacePtr ds.l 1 ; 4c ; space that cpup runs in - ds.l 1 ; 50 - ds.l 1 ; 54 - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 11: AREA -; (size: 160b, thud command: id -a) -; -; A contiguous region of effective addresses with similar properties. -;_______________________________________________________________________ - -Area record 0,INCR - -kIDClass equ 11 -kFirstID equ 0x000b0001 -kSignature equ 'AREA' - -kPLEFlagIsInHTAB equ 20 ; bits 0-19 = HTAB offset if set, else physical page -kPLEFlagHasPhysPage equ 31 - -;_______________________ -; Fields -;_______________________ - -ID ds.l 1 ; 00 -Signature ds.l 1 ; 04 -Flags ds.l 1 ; 08 -kDontOwnPageMapArray equ 25 -kPageMapArrayIs2D equ 26 -kPageMapArrayInPool equ 27 -kAliasFlag equ 28 -kPrivilegedFlag equ 29 -kFaultCtrArrayIs2D equ 30 -kFaultCtrArrayInPool equ 31 -ProcessID ds.l 1 ; 0c -AddressSpaceID ds.l 1 ; 10 -ParentAreaID ds.l 1 ; 14 ; if alias -BackingProviderID ds.l 1 ; 18 ; notification ID -PTEConfig ds.l 1 ; 1c -FlagsAndMinAlign ds.l 1 ; 20 ; detailed description to come -LogicalBase ds.l 1 ; 24 -LogicalEnd ds.l 1 ; 28 ; the last valid address in the area -Length ds.l 1 ; 2c ; in actual bytes! -LogicalSeparation ds.l 1 ; 30 ; min logical distance to any other area -Counter ds.l 1 ; 34 -BytesMapped ds.l 1 ; 38 ; total size of pages actually mapped to me -FaultCtrArrayPtr ds.l 1 ; 3c ; in paged areas, tracks how many times pages are added to HTAB -PageMapArrayPtr ds.l 1 ; 40 ; in paged areas, stores PTE template for each page -AliasLLL ds.l 4 ; 44:54 -LLL ds.l 4 ; 54:64 ; member of address space - ds.l 1 ; 64 -PageSize ds.l 1 ; 68 ; always 4k, the size of a PPC page -AddressSpacePtr ds.l 1 ; 6c -ContigPTETemplate ds.l 1 ; 70 ; in contig areas, acts as PTE template for every page (whole Area is same page) -PagedPTETemplate ds.l 1 ; 74 ; when paged area is created this fills PageMapArray -AlignmentMask ds.l 1 ; 78 ; bit mask that LogicalBase is aligned to -DefaultAlignmentMask ds.l 1 ; 7c ; always 0xFFFFF000 (page alignment) - ds.l 1 ; 80 -BackingProviderMisc ds.l 1 ; 84 ; seems to be arbitrary (third arg to MPSetAreaBackingProvider) - ds.l 1 ; 88 - ds.l 1 ; 8c -FenceLLL ds.l 4 ; 90:a0 ; function unknown, id is 'fenc' - -Size equ * - endr - -; Page List Entry bits: - - - - - -;_______________________________________________________________________ -; ID CLASS 12: NOTIFICATION -; (size: 40b, thud command: id -n) -; -;_______________________________________________________________________ - -Notification record 0,INCR - -kIDClass equ 12 -kFirstID equ 0x000c0001 -kSignature equ 'KNOT' - -;_______________________ -; Fields -;_______________________ - -TaskPtr ds.l 1 ; 00 ; (set on init) -Signature ds.l 1 ; 04 ; (set on init) -ProcessID ds.l 1 ; 08 ; (set on init) - -QueueID ds.l 1 ; 0c ; message queue -MsgWord1 ds.l 1 ; 10 -MsgWord2 ds.l 1 ; 14 -MsgWord3 ds.l 1 ; 18 - -EventGroupID ds.l 1 ; 1c -EventFlags ds.l 1 ; 20 - -SemaphoreID ds.l 1 ; 24 - -Size equ * - endr - - - - -;_______________________________________________________________________ -; ID CLASS 13: CONSOLE LOG -; (size: 16b, thud command: id -nc) -; -; Never seen one in the wild -- must have been in debug builds. -;_______________________________________________________________________ - -ConsoleLog record 0,INCR - -kIDClass equ 13 -kFirstID equ 0x000d0001 - -;_______________________ -; Fields -;_______________________ - - ds.l 1 ; 00 - ds.l 1 ; 04 -ProcessID ds.l 1 ; 08 - ds.l 1 ; 0c - -Size equ * - endr