Identify all accesses to the Primary System Area

Whenever a field was added to the end of the Primary System Area (PSA)
record, the offsets of all other fields would change. When reversing NK
version 02.27, I noticed that 32 bytes had been added to the end of the
PSA between 02.27 and 02.28. To build a byte-perfect 02.27, all
references to PSA fields must therefore use the record definition in
NKPublic.s instead of a numeric offset.

In this commit, all PSA references are identified by field name (_FFF if
the field has not yet been reversed).
This commit is contained in:
Elliot Nunn 2018-04-22 17:13:30 +08:00
parent 8754365ae0
commit 3302c1ba99
17 changed files with 231 additions and 224 deletions

View File

@ -98,7 +98,7 @@ Size equ *
; the negative offsets.
;_______________________________________________________________________
PSA record -0xb90,INCR
PSA record {EndOfPSA},INCR
Base
@ -119,11 +119,11 @@ DelayQueue ds.l 4 ; -a44:-a34
DbugQueue ds.l 4 ; -a34:-a24
PageQueue ds.l 4 ; -a24:-a14
NotQueue ds.l 4 ; -a14:-a04
ds.l 1 ; -a04
_a04 ds.l 1 ; -a04
QueueRelatedZero1 ds.l 1 ; -a00 ; set to zero when queues are inited
QueueRelatedZero2 ds.l 1 ; -9fc ; same again
ds.l 1 ; -9f8
ds.l 1 ; -9f4
_9f8 ds.l 1 ; -9f8
_9f4 ds.l 1 ; -9f4
ReadyQueues
CriticalReadyQ ds.l 8 ; -9f0:-9d0 ; unblocked tasks with priority 0
LatencyProtectReadyQ ds.l 8 ; -9d0:-9b0 ; unblocked tasks with priority 1
@ -135,12 +135,13 @@ FlagsTemplate ds.l 1 ; -968 ; typically just EWA.kFlagVec
UserModeMSR ds.l 1 ; -964
ThudBuffer ds.b 96 ; -960:-900 ; that's the kernel debugger
NoIdeaR23 ds.l 1 ; -900 ; r23 copies here... replated to RTAS?
ds.l 1 ; -8fc
ds.l 1 ; -8f8
ds.l 1 ; -8f4
_8fc ds.l 1 ; -8fc
_8f8 ds.l 1 ; -8f8
_8f4 ds.w 1 ; -8f4
_8f2 ds.w 1 ; -8f2
PA_BlueTask ds.l 1 ; -8f0 ; set at the same time as the one below
ds.l 1 ; -8ec
ds.l 1 ; -8e8
_8ec ds.l 1 ; -8ec
_8e8 ds.l 1 ; -8e8
OtherSystemContextPtr ds.l 1 ; -8e4 ; sometimes set to PA_ECB
VectorRegInitWord ds.l 1 ; -8e0 ; task vector regs get inited with this word x 4
SevenFFFDead2 ds.l 1 ; -8dc
@ -155,69 +156,75 @@ ProcessorState ds.b 128 ; -4d0:-450 ; interesting what this gets used by
FreeList ds.l 4 ; -450:-440
MCR ds.l 1 ; -440 ; reported by heartbeat code
Pending68kInt ds.w 1 ; -43c ; used when Sch interrupts blue task (-1 means "none")
ds.w 1 ; -43a
_43a ds.w 1 ; -43a
DecClockRateHzCopy ds.l 1 ; -438 ; copied by Init.s
OtherTimerQueuePtr ds.l 1 ; -434 ; unsigned timer queue in the pool, set by InitTMRQs
FreePageCount ds.l 1 ; -430 ; zeroed by InitFreeList
UnheldFreePageCount ds.l 1 ; -42c
ExternalHandlerID ds.l 1 ; -428 ; notification for PIH to bump
SystemAddressSpaceID ds.l 1 ; -424
ds.l 1 ; -420
_420 ds.l 1 ; -420
blueProcessPtr ds.l 1 ; -41c ; physical ptr to first type-1 struct created
ThermalHandlerID ds.l 1 ; -418 ; is a Note struct
PMFHandlerID ds.l 1 ; -414 ; also a Note struct
BlueSpinningOn ds.l 1 ; -410 ; ID or 0 or -1
ds.l 1 ; -40c
ds.l 1 ; -408
ds.l 1 ; -404
ds.l 1 ; -400
_40c ds.l 1 ; -40c
_408 ds.l 1 ; -408
_404 ds.l 1 ; -404
_400 ds.l 1 ; -400
OtherSystemAddrSpcPtr ds.l 1 ; -3fc
OtherSystemAddrSpcPtr2 ds.l 1 ; -3f8 ; copied from the one above by InitFreeList
ZeroedByInitFreeList3 ds.l 1 ; -3f4
ds.l 1 ; -3f0
ds.l 1 ; -3ec
ds.l 1 ; -3e8
ds.l 1 ; -3e4
ds.l 1 ; -3e0
ds.l 1 ; -3dc
ds.l 1 ; -3d8
ds.l 1 ; -3d4
ds.l 1 ; -3d0
ds.l 1 ; -3cc
ds.l 1 ; -3c8
ds.l 1 ; -3c4
ds.l 1 ; -3c0
ds.l 1 ; -3bc
ds.l 1 ; -3b8
ds.l 1 ; -3b4
ds.l 1 ; -3b0
ds.l 1 ; -3ac
ds.l 1 ; -3a8
ds.l 1 ; -3a4
ds.l 1 ; -3a0
ds.l 1 ; -39c
ds.l 1 ; -398
ds.l 1 ; -394
ds.l 1 ; -390
ds.l 1 ; -38c
ds.l 1 ; -388
ds.l 1 ; -384
ds.l 1 ; -380
ds.l 1 ; -37c
ds.l 1 ; -378
ds.l 1 ; -374
ds.l 1 ; -370
ds.l 1 ; -36c
ds.l 1 ; -368
ds.l 1 ; -364
ds.l 1 ; -360
ds.l 1 ; -35c
ds.l 1 ; -358
ds.l 1 ; -354
ds.l 1 ; -350
ds.l 1 ; -34c
ds.l 1 ; -348
ds.l 1 ; -344
_3f0 ds.l 1 ; -3f0
_3ec ds.l 1 ; -3ec
_3e8 ds.l 1 ; -3e8
_3e4 ds.l 1 ; -3e4
_3e0 ds.l 1 ; -3e0
_3dc ds.l 1 ; -3dc
_3d8 ds.l 1 ; -3d8
_3d4 ds.l 1 ; -3d4
_3d0 ds.l 1 ; -3d0
_3cc ds.l 1 ; -3cc
_3c8 ds.l 1 ; -3c8
_3c4 ds.l 1 ; -3c4
_3c0 ds.l 1 ; -3c0
_3bc ds.l 1 ; -3bc
_3b8 ds.l 1 ; -3b8
_3b4 ds.l 1 ; -3b4
_3b0 ds.l 1 ; -3b0
_3ac ds.l 1 ; -3ac
_3a8 ds.l 1 ; -3a8
_3a4 ds.l 1 ; -3a4
_3a0 ds.l 1 ; -3a0
_39c ds.l 1 ; -39c
_398 ds.l 1 ; -398
_394 ds.l 1 ; -394
_390 ds.l 1 ; -390
_38c ds.l 1 ; -38c
_388 ds.l 1 ; -388
_384 ds.l 1 ; -384
_380 ds.l 1 ; -380
_37c ds.l 1 ; -37c
_378 ds.l 1 ; -378
_374 ds.l 1 ; -374
_370 ds.l 1 ; -370
_36c ds.l 1 ; -36c
_368 ds.l 1 ; -368
_364 ds.l 1 ; -364
_360 ds.w 1 ; -360
_35e ds.w 1 ; -35e
_35c ds.w 1 ; -35c
_35a ds.w 1 ; -35a
_358 ds.w 1 ; -358
_356 ds.w 1 ; -356
_354 ds.l 1 ; -354
_350 ds.l 1 ; -350
_34c ds.l 1 ; -34c
_348 ds.l 1 ; -348
_344 ds.l 1 ; -344
EWAFiller ds.b 0x340
EndOfPSA
endr

View File

@ -32,7 +32,7 @@ NKDebug
lwz r1, EWA.PA_KDP(r1)
li r30, 0
addi r29, r1, -0x960
addi r29, r1, PSA.ThudBuffer
@cmdloop
lbzx r31, r8, r30
stbx r31, r29, r30
@ -40,17 +40,17 @@ NKDebug
cmpwi r31, 0
bne @cmdloop
lwz r31, -0x404(r1)
lwz r31, PSA._404(r1)
stw r8, -0x404(r1)
stw r8, PSA._404(r1)
bl panic
lwz r8, -0x404(r1)
lwz r8, PSA._404(r1)
li r0, 0
stw r0, 0(r8)
stw r31, -0x404(r1)
stw r31, PSA._404(r1)
b ReturnZeroFromMPCall

View File

@ -369,7 +369,7 @@ convert_pmdts_to_areas ; OUTSIDE REFERER
stw r8, 0x0040(r31)
lwz r8, Area.Flags(r31)
ori r8, r8, 0x40
lwz r9, -0x0430(r1)
lwz r9, PSA.FreePageCount(r1)
cmpwi r9, noErr
bgt @_374
@ -1205,25 +1205,25 @@ createarea_0x4e0
srwi r29, r29, 11
createarea_0x4e8
lwz r18, -0x0430(r1)
lwz r18, PSA.FreePageCount(r1)
add. r8, r27, r29
ble major_0x102c8
cmpw r8, r18
bgt major_0x102c8
lwz r16, -0x0430(r1)
lwz r16, PSA.FreePageCount(r1)
lwz r17, PSA.UnheldFreePageCount(r1)
subf r16, r8, r16
subf r17, r8, r17
stw r16, -0x0430(r1)
stw r16, PSA.FreePageCount(r1)
stw r17, PSA.UnheldFreePageCount(r1)
mr. r18, r27
beq createarea_0x5a0
lwz r16, -0x0448(r1)
lwz r16, PSA.FreeList + LLL.Next(r1)
RemoveFromList r16, scratch1=r17, scratch2=r19
addi r18, r18, -0x01
stw r16, 0x0040(r31)
cmpwi r18, 0x00
lwz r17, -0x0448(r1)
lwz r17, PSA.FreeList + LLL.Next(r1)
mr r8, r16
subi r16, r16, 4
bgt createarea_0x564
@ -1238,19 +1238,19 @@ createarea_0x564
mr r8, r17
li r9, 0x400
bl major_0x10284
lwz r17, -0x0448(r1)
lwz r17, PSA.FreeList + LLL.Next(r1)
cmpwi r18, 0x00
bgt createarea_0x564
createarea_0x5a0
mr. r18, r29
beq createarea_0x62c
lwz r16, -0x0448(r1)
lwz r16, PSA.FreeList + LLL.Next(r1)
RemoveFromList r16, scratch1=r17, scratch2=r19
addi r18, r18, -0x01
stw r16, 0x003c(r31)
cmpwi r18, 0x00
lwz r17, -0x0448(r1)
lwz r17, PSA.FreeList + LLL.Next(r1)
mr r8, r16
subi r16, r16, 4
bgt createarea_0x5f0
@ -1265,7 +1265,7 @@ createarea_0x5f0
mr r8, r17
li r9, 0x800
bl major_0x102a8
lwz r17, -0x0448(r1)
lwz r17, PSA.FreeList + LLL.Next(r1)
cmpwi r18, 0x00
bgt createarea_0x5f0
@ -1321,7 +1321,7 @@ major_0x102a8_0xc
major_0x102c8 ; OUTSIDE REFERER
_AssertAndRelease PSA.PoolLock, scratch=r16
addi r30, r8, 0x08
lwz r8, -0x0420(r1)
lwz r8, PSA._420(r1)
; r8 = id
bl LookupID
@ -2687,7 +2687,7 @@ MPCall_98_0x184
DeclareMPCall 82, MPCall_82
MPCall_82 ; OUTSIDE REFERER
lwz r8, -0x0420(r1)
lwz r8, PSA._420(r1)
cmpwi r8, 0x00
bne ReturnMPCallOOM
@ -2700,7 +2700,7 @@ MPCall_82 ; OUTSIDE REFERER
cmpwi r9, Notification.kIDClass
bne ReleaseAndReturnMPCallInvalidIDErr
stw r3, -0x0420(r1)
stw r3, PSA._420(r1)
; r1 = kdp
b ReleaseAndReturnZeroFromMPCall
@ -2722,7 +2722,7 @@ MPCall_83 ; OUTSIDE REFERER
MPCall_83_0x5c ; OUTSIDE REFERER
lwz r8, -0x0420(r1)
lwz r8, PSA._420(r1)
; r8 = id
bl LookupID
@ -2743,14 +2743,14 @@ MPCall_83_0x5c ; OUTSIDE REFERER
b ReleaseAndReturnMPCallOOM
MPCall_83_0x90 ; OUTSIDE REFERER
addi r18, r1, -0x450
lwz r8, -0x0448(r1)
addi r18, r1, PSA.FreeList
lwz r8, PSA.FreeList + LLL.Next(r1)
cmpw r8, r18
beq MPCall_83_0xec
RemoveFromList r8, scratch1=r16, scratch2=r17
lwz r16, -0x0430(r1)
lwz r16, PSA.FreePageCount(r1)
addi r16, r16, -0x01
stw r16, -0x0430(r1)
stw r16, PSA.FreePageCount(r1)
lwz r17, 0x0004(r8)
mfspr r16, dec
eqv. r17, r18, r17
@ -2775,7 +2775,7 @@ MPCall_84 ; OUTSIDE REFERER
lwz r16, 0x0004(r3)
lwz r17, 0x0000(r3)
addi r18, r1, -0x450
addi r18, r1, PSA.FreeList
eqv. r16, r16, r17
cmpw cr1, r17, r18
bne MPCall_84_0x3c
@ -3138,8 +3138,8 @@ NKMakePhysicallyContiguous_0xe0
_Lock PSA.PoolLock, scratch1=r16, scratch2=r17
addi r18, r1, -0x450
lwz r8, -0x0448(r1)
addi r18, r1, PSA.FreeList
lwz r8, PSA.FreeList + LLL.Next(r1)
cmpw r8, r18
beq NKMakePhysicallyContiguous_0x174
b NKMakePhysicallyContiguous_0x174
@ -3753,12 +3753,12 @@ MPCall_95_0x44
lwz r8, PSA.UnheldFreePageCount(r1)
cmpwi r8, 0x00
ble ReleaseAndReturnMPCallOOM
lwz r27, -0x0438(r1)
lwz r27, PSA.DecClockRateHzCopy(r1)
srwi r27, r27, 15
mfspr r8, dec
subf r27, r27, r8
lwz r8, -0x03f8(r1)
lwz r9, -0x03f4(r1)
lwz r8, PSA.OtherSystemAddrSpcPtr2(r1)
lwz r9, PSA.ZeroedByInitFreeList3(r1)
mr r30, r9
bl FindAreaAbove
mr r31, r8
@ -3845,11 +3845,11 @@ MPCall_95_0x1c0
MPCall_95_0x1c8
cmpwi r4, 0x00
stw r29, -0x03f4(r1)
stw r29, PSA.ZeroedByInitFreeList3(r1)
beq ReleaseAndReturnMPCallOOM
lwz r8, 0x0068(r31)
add r8, r8, r5
stw r8, -0x03f4(r1)
stw r8, PSA.ZeroedByInitFreeList3(r1)
; r1 = kdp
b ReleaseAndReturnZeroFromMPCall

View File

@ -11,7 +11,7 @@ prints ; OUTSIDE REFERER
stw r24, -0x0110(r1)
stw r25, -0x010c(r1)
lwz r1, -0x0004(r1)
lwz r28, -0x0900(r1)
lwz r28, PSA.NoIdeaR23(r1)
lwz r29, 0x0edc(r1)
_Lock PSA.DbugLock, scratch1=r30, scratch2=r31
@ -114,7 +114,7 @@ print_common ; OUTSIDE REFERER
beq cr7, print_common_0x8c
mtmsr r31
isync
lwz r29, -0x0438(r1)
lwz r29, PSA.DecClockRateHzCopy(r1)
srwi r29, r29, 8
mfspr r30, dec
subf r29, r29, r30
@ -188,7 +188,7 @@ printd ; OUTSIDE REFERER
stw r24, -0x0110(r1)
stw r25, -0x010c(r1)
lwz r1, -0x0004(r1)
lwz r28, -0x0900(r1)
lwz r28, PSA.NoIdeaR23(r1)
lwz r29, 0x0edc(r1)
_Lock PSA.DbugLock, scratch1=r30, scratch2=r31
@ -345,7 +345,7 @@ print_unknown ; OUTSIDE REFERER
print_digity_common ; OUTSIDE REFERER
lwz r1, -0x0004(r1)
lwz r28, -0x0900(r1)
lwz r28, PSA.NoIdeaR23(r1)
lwz r29, 0x0edc(r1)
_Lock PSA.DbugLock, scratch1=r30, scratch2=r31
@ -420,7 +420,7 @@ getchar ; OUTSIDE REFERER
stw r25, -0x010c(r1)
lwz r1, EWA.PA_KDP(r1)
lwz r28, -0x0900(r1)
lwz r28, PSA.NoIdeaR23(r1)
cmpwi cr7, r28, 0x00
li r8, -0x01
beq cr7, print_return
@ -452,7 +452,7 @@ printc ; OUTSIDE REFERER
stw r24, -0x0110(r1)
stw r25, -0x010c(r1)
lwz r1, -0x0004(r1)
lwz r28, -0x0900(r1)
lwz r28, PSA.NoIdeaR23(r1)
lwz r29, 0x0edc(r1)
_Lock PSA.DbugLock, scratch1=r30, scratch2=r31

View File

@ -68,12 +68,12 @@ InitIDIndex
; RET ID r8
MakeID
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
lhz r19, 0x0000(r18)
mr r21, r19
@_c
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
rlwinm r20, r19, 25, 23, 29
addi r20, r20, 0x08
clrlwi. r19, r19, 0x17
@ -104,7 +104,7 @@ MakeID
b @_c
@_70
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
mr r21, r8
lhz r19, 0x0002(r18)
mr r22, r9
@ -124,7 +124,7 @@ MakeID
mtlr r23
li r8, 0x00
beqlr
lwz r17, -0x0a98(r1)
lwz r17, PSA.IndexPtr(r1)
lhz r19, 0x0002(r17)
addi r19, r19, 0x200
rlwinm r20, r19, 25, 23, 29
@ -150,7 +150,7 @@ MakeID
stw r9, KDP.NanoKernelInfo + NKNanoKernelInfo.IDCtr(r1)
lhz r20, 0x0000(r18)
lhz r8, 0x0002(r22)
lwz r21, -0x0a98(r1)
lwz r21, PSA.IndexPtr(r1)
add r19, r19, r20
addi r8, r8, 0x01
lhz r20, 0x0002(r18)
@ -174,7 +174,7 @@ MakeID
DeleteID
rlwinm r20, r8, 9, 23, 29
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
addi r20, r20, 0x08
rlwinm. r19, r8, 16, 23, 31
lwzx r18, r18, r20
@ -212,7 +212,7 @@ DeleteID
LookupID
rlwinm r20, r8, 9, 23, 29
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
addi r20, r20, 0x08
rlwinm. r19, r8, 16, 23, 31
lwzx r18, r18, r20
@ -245,7 +245,7 @@ LookupID
GetNextIDOfClass
rlwinm r20, r8, 9, 23, 29
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
addi r20, r20, 0x08
rlwinm. r19, r8, 16, 23, 31
lwzx r18, r18, r20
@ -273,7 +273,7 @@ GetNextIDOfClass
lhz r20, 0x0000(r18)
addi r20, r20, 0x200
rlwinm. r20, r20, 25, 23, 29
lwz r18, -0x0a98(r1)
lwz r18, PSA.IndexPtr(r1)
beqlr
addi r20, r20, 0x08
li r19, 0x00

View File

@ -2018,14 +2018,14 @@ AcquireLock ; OUTSIDE REFERER
mr r25, r29
lwz r30, -0x0004(r22)
mfdec r29
lwz r28, -0x0438(r30)
lwz r28, PSA.DecClockRateHzCopy(r30)
slwi r28, r28, 3
subf r29, r28, r29
b @0xc0
@0xa8
lwz r30, -0x0004(r22)
lwz r28, -0x0b30(r30)
lwz r28, PSA.ThudLock(r30)
cmpwi r28, 0x00
beq- @0xc0
mfdec r29

View File

@ -1849,7 +1849,7 @@ IntPerfMonitor ; OUTSIDE REFERER
_Lock PSA.SchLock, scratch1=r8, scratch2=r9
lwz r8, -0x0414(r1)
lwz r8, PSA.PMFHandlerID(r1)
; r8 = id
bl LookupID

View File

@ -1041,7 +1041,7 @@ MPCall_38_0x14
lwz r16, 0x0060(r8)
rlwinm. r17, r17, 0, 15, 15
beq MPCall_38_0x48
lwz r16, -0x041c(r1)
lwz r16, PSA.blueProcessPtr(r1)
lwz r16, 0x0000(r16)
MPCall_38_0x48
@ -1800,9 +1800,9 @@ NKSetClockStep ; OUTSIDE REFERER
_Lock PSA.SchLock, scratch1=r16, scratch2=r17
lwz r16, 0x0008(r18)
stw r16, -0x0438(r1)
stw r16, PSA.DecClockRateHzCopy(r1)
bgt cr1, NKSetClockStep_0xec
lwz r31, -0x0434(r1)
lwz r31, PSA.OtherTimerQueuePtr(r1)
lbz r18, 0x0017(r31)
cmpwi r18, 0x00
@ -1815,7 +1815,7 @@ NKSetClockStep ; OUTSIDE REFERER
b ReleaseAndReturnZeroFromMPCall
NKSetClockStep_0xec
lwz r31, -0x0434(r1)
lwz r31, PSA.OtherTimerQueuePtr(r1)
lbz r18, 0x0017(r31)
cmpwi r18, 0x01
@ -1836,15 +1836,15 @@ NKSetClockStep_0xec
; There's a one-billion constant in here, for fractional
; expression.
; -0x36c(r1) = tb_drift_numerator
; -0x368(r1) = tb_drift_denominator
; PSA._36c(r1) = tb_drift_numerator
; PSA._368(r1) = tb_drift_denominator
; > r3 = to
DeclareMPCall 132, NKSetClockDriftCorrection
NKSetClockDriftCorrection ; OUTSIDE REFERER
lwz r31, -0x0364(r1)
lwz r31, PSA._364(r1)
mfsprg r9, 0
cmpwi r31, 0x00
beq ReturnMPCallOOM
@ -1875,8 +1875,8 @@ NKSetClockDriftCorrection_0x64
addi r17, r17, 0x01
NKSetClockDriftCorrection_0x6c
stw r17, -0x036c(r1)
stw r18, -0x0368(r1)
stw r17, PSA._36c(r1)
stw r18, PSA._368(r1)
_log 'TB drift adjusted to '
mr r8, r3
bl Printd
@ -1890,7 +1890,7 @@ NKSetClockDriftCorrection_0x6c
_Lock PSA.SchLock, scratch1=r16, scratch2=r17
lwz r31, -0x0364(r1)
lwz r31, PSA._364(r1)
lbz r18, 0x0017(r31)
cmpwi r18, 0x01
@ -1910,9 +1910,9 @@ NKSetClockDriftCorrection_0x12c
_Lock PSA.SchLock, scratch1=r16, scratch2=r17
li r17, 0x00
stw r17, -0x036c(r1)
stw r17, -0x0368(r1)
lwz r31, -0x0364(r1)
stw r17, PSA._36c(r1)
stw r17, PSA._368(r1)
lwz r31, PSA._364(r1)
lbz r18, 0x0017(r31)
cmpwi r18, 0x00
@ -1946,7 +1946,7 @@ MPCall_115 ; OUTSIDE REFERER
_Lock PSA.DbugLock, scratch1=r16, scratch2=r17
lwz r30, -0x0404(r1)
lwz r30, PSA._404(r1)
MPCall_115_0x54
addi r30, r30, 0x01
@ -1979,7 +1979,7 @@ MPCall_115_0x94
beq ReleaseAndReturnMPCallOOM
MPCall_115_0xd0
lwz r28, -0x0404(r1)
lwz r28, PSA._404(r1)
lwz r29, 0x000c(r31)
li r5, 0x00
not r27, r4
@ -2076,7 +2076,7 @@ MPCall_133_0x3c
li r16, 0x00
MPCall_133_0x5c
sth r16, -0x0360(r1)
sth r16, PSA._360(r1)
MPCall_133_0x60
beq cr1, MPCall_133_0x70
@ -2084,7 +2084,7 @@ MPCall_133_0x60
li r17, 0x00
MPCall_133_0x6c
sth r17, -0x035e(r1)
sth r17, PSA._35e(r1)
MPCall_133_0x70
srawi r16, r5, 16
@ -2096,7 +2096,7 @@ MPCall_133_0x70
li r16, 0x00
MPCall_133_0x8c
sth r16, -0x035c(r1)
sth r16, PSA._35c(r1)
MPCall_133_0x90
beq cr1, MPCall_133_0xa0
@ -2104,7 +2104,7 @@ MPCall_133_0x90
li r17, 0x00
MPCall_133_0x9c
sth r17, -0x035a(r1)
sth r17, PSA._35a(r1)
MPCall_133_0xa0
; r1 = kdp

View File

@ -117,7 +117,7 @@ CommonPIHPath_0xc ; OUTSIDE REFERER
@no_handler_notification
li r27, 0x00
lwz r23, 0x067c(r1)
stw r27, -0x0428(r1)
stw r27, PSA.ExternalHandlerID(r1)
_AssertAndRelease PSA.SchLock, scratch=r8
bl Restore_r14_r19
@ -374,7 +374,7 @@ PBX_PIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne PBX_PIH_0x38
@ -386,7 +386,7 @@ PBX_PIH_0x38
mtsprg 3, r9
lis r22, 0x50f3
mfmsr r23
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -438,7 +438,7 @@ GazellePIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne GazellePIH_0x38
@ -451,7 +451,7 @@ GazellePIH_0x38
lis r22, -0xd00
mfmsr r20
ori r23, r20, 0x10
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -526,7 +526,7 @@ TNT_PIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne TNT_PIH_0x38
@ -539,7 +539,7 @@ TNT_PIH_0x38
lis r22, -0xd00
mfmsr r20
ori r23, r20, 0x10
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -602,7 +602,7 @@ GossamerPIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne GossamerPIH_0x38
@ -615,7 +615,7 @@ GossamerPIH_0x38
mfmsr r20
ori r23, r20, 0x10
lis r22, -0xd00
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -695,7 +695,7 @@ NewWorldPowerBookPIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne NewWorldPowerBookPIH_0x38
@ -709,7 +709,7 @@ NewWorldPowerBookPIH_0x38
mfmsr r20
ori r23, r20, 0x10
lwz r22, 0x0ec0(r26)
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -772,7 +772,7 @@ CordycepsPIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne CordycepsPIH_0x38
@ -836,7 +836,7 @@ NewWorldPIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne NewWorldPIH_0x38
@ -851,7 +851,7 @@ NewWorldPIH_0x38
lhz r27, 0x0910(r1)
lwz r22, 0x0f18(r20)
li r28, 0x00
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22
@ -1024,7 +1024,7 @@ UnknownPIH
bl SchSaveStartingAtR20
; r8 = sprg0 (not used by me)
addi r9, r1, -0x750
addi r9, r1, PSA.BlueVecBase
andis. r8, r11, 0x02
mfsprg r30, 3
bne UnknownPIH_0x38
@ -1039,7 +1039,7 @@ UnknownPIH_0x38
lhz r27, 0x0910(r1)
lwz r22, 0x0f18(r20)
li r28, 0x00
lwz r25, -0x03fc(r1)
lwz r25, PSA.OtherSystemAddrSpcPtr(r1)
rlwinm r24, r22, 6, 26, 29
addi r25, r25, 0x30
mfsrin r21, r22

View File

@ -115,7 +115,7 @@ InitReplacement
li r10, 0x00
rlwimi r10, r12, 0, 12, 15
rlwimi r10, r12, 0, 28, 30
stw r10, -0x0968(r1)
stw r10, PSA.FlagsTemplate(r1)
; Cook up a MSR:

View File

@ -296,7 +296,7 @@ Restore_v0_v31 ; OUTSIDE REFERER
mtcr r11
mtvscr v0
lwz r8, -0x0004(r1)
li r9, -0x8e0
li r9, PSA.VectorRegInitWord
lvx v31, r8, r9
vor v0, v31, v31
bge major_0x13988_0x108
@ -1178,14 +1178,14 @@ major_0x142dc_0x38
major_0x142dc_0x58 ; OUTSIDE REFERER
lwz r27, -0x0970(r1)
lwz r27, PSA.PriorityFlags(r1)
major_0x142dc_0x5c
mr r30, r31
cmpwi r27, 0x00
cntlzw r26, r27
beq major_0x142dc_0x140
addi r25, r1, -0x9f0
addi r25, r1, PSA.CriticalReadyQ
mulli r26, r26, 0x20
add r26, r26, r25
lwz r29, 0x0008(r26)
@ -1229,7 +1229,7 @@ major_0x142dc_0xd8 ; OUTSIDE REFERER
subf r28, r27, r28
stw r28, 0x0014(r26)
lwz r28, 0x0010(r26)
lwz r27, -0x0970(r1)
lwz r27, PSA.PriorityFlags(r1)
addi r28, r28, -0x01
cmpwi r28, 0x00
stw r28, 0x0010(r26)
@ -1237,7 +1237,7 @@ major_0x142dc_0xd8 ; OUTSIDE REFERER
bne major_0x142dc_0x140
lwz r28, 0x0000(r26)
andc r27, r27, r28
stw r27, -0x0970(r1)
stw r27, PSA.PriorityFlags(r1)
major_0x142dc_0x140
lwz r25, 0x0064(r30)
@ -1249,7 +1249,7 @@ major_0x142dc_0x140
ori r27, r27, 0x200
stb r26, 0x0018(r30)
stw r27, 0x0064(r30)
addi r25, r1, -0xa34
addi r25, r1, PSA.DbugQueue
addi r26, r30, 0x08
stw r25, 0x0000(r26)
InsertAsPrev r26, r25, scratch=r27
@ -2222,7 +2222,7 @@ SchIdleTaskStopper
li r9, 0x00
stw r9, 0x001c(r31)
bl SchTaskUnrdy
addi r16, r1, -0xa44
addi r16, r1, PSA.DelayQueue
addi r17, r8, 0x08
stw r16, 0x0000(r17)
InsertAsPrev r17, r16, scratch=r18

View File

@ -36,20 +36,20 @@ InitScreenConsole_0x18
InitScreenConsole_0x2c
addi r31, r30, 0x1000
stw r30, -0x0004(r31)
stw r30, -0x0404(r1)
stw r30, -0x0400(r1)
stw r30, PSA._404(r1)
stw r30, PSA._400(r1)
li r29, ScreenConsoleY
sth r29, -0x0360(r1)
sth r29, PSA._360(r1)
li r29, ScreenConsoleX
sth r29, -0x035e(r1)
sth r29, PSA._35e(r1)
li r29, ScreenConsoleHeight
sth r29, -0x035c(r1)
sth r29, PSA._35c(r1)
li r29, ScreenConsoleWidth
sth r29, -0x035a(r1)
sth r29, PSA._35a(r1)
li r29, 0x5e
sth r29, -0x0358(r1)
sth r29, PSA._358(r1)
li r29, 0x30
sth r29, -0x0356(r1)
sth r29, PSA._356(r1)
lmw r29, -0x0110(r1)
blr
@ -58,14 +58,14 @@ InitScreenConsole_0x2c
; > r1 = kdp
ScreenConsole_putchar ; OUTSIDE REFERER
lwz r30, -0x0404(r1)
lwz r30, PSA._404(r1)
stb r29, 0x0000(r30)
addi r30, r30, 0x01
andi. r29, r30, 0xfff
stw r30, -0x0404(r1)
stw r30, PSA._404(r1)
bnelr
lwz r30, -0x1000(r30)
stw r30, -0x0404(r1)
stw r30, PSA._404(r1)
blr
@ -73,19 +73,19 @@ ScreenConsole_putchar ; OUTSIDE REFERER
; > r1 = kdp
ScreenConsole_redraw ; OUTSIDE REFERER
stmw r2, -0x03e8(r1)
stmw r2, PSA._3e8(r1)
mflr r14
mfcr r15
stw r14, -0x03f0(r1)
stw r15, -0x03ec(r1)
addi r26, r1, -0x690
stw r14, PSA._3f0(r1)
stw r15, PSA._3ec(r1)
addi r26, r1, PSA.GreenVecBase
mfsprg r2, 3
mtsprg 3, r26
lwz r26, 0x0edc(r1)
andi. r26, r26, 0x08
beq major_0x18bec
lwz r14, -0x0404(r1)
lwz r15, -0x0400(r1)
lwz r14, PSA._404(r1)
lwz r15, PSA._400(r1)
cmpw r14, r15
beq major_0x18bec
bl major_0x18c18
@ -101,8 +101,8 @@ ScreenConsole_redraw_0x40
bl funny_thing
bl major_0x18e24
bl funny_thing
lwz r14, -0x0404(r1)
lwz r15, -0x0400(r1)
lwz r14, PSA._404(r1)
lwz r15, PSA._400(r1)
li r16, 0x00
ScreenConsole_redraw_0x74
@ -124,7 +124,7 @@ ScreenConsole_redraw_0x90
beq ScreenConsole_redraw_0x74
beq cr1, ScreenConsole_redraw_0xe4
bl major_0x18e54
lhz r17, -0x0358(r1)
lhz r17, PSA._358(r1)
cmpw r9, r17
blt ScreenConsole_redraw_0x74
@ -135,18 +135,18 @@ ScreenConsole_redraw_0xc0
ScreenConsole_redraw_0xcc
bl funny_thing
lhz r17, -0x0356(r1)
lhz r17, PSA._356(r1)
cmpw r10, r17
blt ScreenConsole_redraw_0x74
stw r16, -0x0400(r1)
stw r16, PSA._400(r1)
b ScreenConsole_redraw_0x40
ScreenConsole_redraw_0xe4
lhz r17, -0x0356(r1)
lhz r17, PSA._356(r1)
addi r17, r17, -0x01
cmpw r10, r17
blt ScreenConsole_redraw_0x74
lwz r17, -0x0438(r1)
lwz r17, PSA.DecClockRateHzCopy(r1)
slwi r25, r17, 2
add r25, r25, r17
mfspr r17, dec
@ -183,11 +183,11 @@ ScreenConsole_redraw_0x150
major_0x18bec ; OUTSIDE REFERER
mtsprg 3, r2
lwz r14, -0x03f0(r1)
lwz r15, -0x03ec(r1)
lwz r14, PSA._3f0(r1)
lwz r15, PSA._3ec(r1)
mtlr r14
mtcr r15
lmw r2, -0x03e8(r1)
lmw r2, PSA._3e8(r1)
blr
@ -202,7 +202,7 @@ major_0x18c08 ; OUTSIDE REFERER
major_0x18c18 ; OUTSIDE REFERER
mflr r13
lwz r27, -0x08f8(r1)
lwz r27, PSA._8f8(r1)
cmpwi r27, 0x00
bne major_0x18c18_0x40
lwz r27, 0x0630(r1)
@ -212,11 +212,11 @@ major_0x18c18 ; OUTSIDE REFERER
lwz r31, 0x037c(r27)
cmpwi r31, 0x00
beq major_0x18c18_0x40
stw r31, -0x08f8(r1)
stw r31, PSA._8f8(r1)
lhz r31, 0x0384(r27)
sth r31, -0x08f4(r1)
sth r31, PSA._8f4(r1)
lhz r31, 0x0386(r27)
sth r31, -0x08f2(r1)
sth r31, PSA._8f2(r1)
major_0x18c18_0x40
li r27, 0x8a4
@ -256,14 +256,14 @@ major_0x18c18_0x40
srwi r6, r6, 3
cmplwi r6, 0x08
bgt major_0x18c18_0xe0
stw r3, -0x08f8(r1)
sth r5, -0x08f4(r1)
sth r6, -0x08f2(r1)
stw r3, PSA._8f8(r1)
sth r5, PSA._8f4(r1)
sth r6, PSA._8f2(r1)
major_0x18c18_0xe0
lwz r3, -0x08f8(r1)
lhz r5, -0x08f4(r1)
lhz r6, -0x08f2(r1)
lwz r3, PSA._8f8(r1)
lhz r5, PSA._8f4(r1)
lhz r6, PSA._8f2(r1)
cmpwi r3, 0x00
bne major_0x18d5c
b major_0x18bec
@ -341,18 +341,18 @@ major_0x18d5c_0x70
major_0x18d5c_0x88
isync
mfmsr r22
lhz r29, -0x0360(r1)
lhz r30, -0x035c(r1)
lhz r29, PSA._360(r1)
lhz r30, PSA._35c(r1)
subf r29, r29, r30
li r30, 0x0a
divw r29, r29, r30
sth r29, -0x0356(r1)
lhz r29, -0x035e(r1)
lhz r30, -0x035a(r1)
sth r29, PSA._356(r1)
lhz r29, PSA._35e(r1)
lhz r30, PSA._35a(r1)
subf r29, r29, r30
li r30, 0x06
divw r29, r29, r30
sth r29, -0x0358(r1)
sth r29, PSA._358(r1)
mtlr r13
blr
@ -362,7 +362,7 @@ major_0x18e24 ; OUTSIDE REFERER
mflr r12
major_0x18e24_0x4
lhz r25, -0x0358(r1)
lhz r25, PSA._358(r1)
cmpw cr1, r9, r25
lbz r25, 0x0000(r21)
cmplwi r25, 0x00
@ -390,8 +390,8 @@ major_0x18e54 ; OUTSIDE REFERER
mullw r7, r7, r6
add r7, r7, r27
add r7, r7, r3
lhz r27, -0x0360(r1)
lhz r28, -0x035e(r1)
lhz r27, PSA._360(r1)
lhz r28, PSA._35e(r1)
mullw r27, r5, r27
mullw r28, r6, r28
add r7, r7, r27
@ -499,7 +499,7 @@ funny_thing_0xc
mflr r12
funny_thing_0x10
lhz r25, -0x0358(r1)
lhz r25, PSA._358(r1)
cmpw r9, r25
bge funny_thing_0x28
li r25, 0x20

View File

@ -216,8 +216,8 @@ MPGetKernelState_0x208
b MPGetKernelState_0x208
MPGetKernelState_0x238
addi r19, r1, -0x450
lwz r31, -0x0448(r1)
addi r19, r1, PSA.FreeList
lwz r31, PSA.FreeList + LLL.Next(r1)
MPGetKernelState_0x240
cmpw r31, r19
@ -264,7 +264,7 @@ MPGetKernelState_0x270
bl LoadStateRestoreFunc
mflr r9
stw r9, 0x0000(r17)
lwz r8, -0x0900(r1)
lwz r8, PSA.NoIdeaR23(r1)
stw r8, 0x0008(r17)
li r8, 0x00
stw r8, 0x0004(r17)

View File

@ -421,7 +421,7 @@ MPCall_9_0xf0
stw r4, 0x0018(r17)
MPCall_9_0xfc
addi r16, r1, -0xa44
addi r16, r1, PSA.DelayQueue
addi r17, r31, 0x08
stw r16, 0x0000(r17)
InsertAsPrev r17, r16, scratch=r18
@ -683,7 +683,7 @@ KCThrowException_0x70
stw r16, 0x0064(r31)
mr r8, r31
bl SchTaskUnrdy
addi r16, r1, -0xa34
addi r16, r1, PSA.DbugQueue
addi r17, r31, 0x08
stw r16, 0x0000(r17)
InsertAsPrev r17, r16, scratch=r18
@ -757,7 +757,7 @@ MPCall_58_0x88
stw r18, 0x00a4(r30)
li r19, 0x600
lwz r17, 0x0008(r31)
addi r18, r1, -0xa34
addi r18, r1, PSA.DbugQueue
andc r29, r29, r19
cmpw cr1, r17, r18
stw r29, 0x0064(r31)
@ -792,7 +792,7 @@ MPCall_58_0x114
mr r28, r8
bc BO_IF, Task.kFlag14, MPCall_58_0x13c
bc BO_IF, Task.kFlag20, MPCall_58_0x13c
lwz r8, -0x08e8(r1)
lwz r8, PSA._8e8(r1)
; r8 = id
bl LookupID
@ -883,7 +883,7 @@ MPCall_59 ; OUTSIDE REFERER
mr r31, r8
MPCall_59_0x30
stw r3, -0x08e8(r1)
stw r3, PSA._8e8(r1)
; r1 = kdp
b ReleaseAndReturnZeroFromMPCall

View File

@ -207,7 +207,7 @@ panic_common
_log '½ ' ; thats an omega, btw
li r17, 0x00 ; r17 = charcount
stw r17, -0x08fc(r1)
stw r17, PSA._8fc(r1)
@input_busywait
bl getchar
@ -235,7 +235,7 @@ panic_common
; If
cmpwi cr2, r17, 95
addi r18, r1, -0x960 ; prepare to copy the line!
addi r18, r1, PSA.ThudBuffer ; prepare to copy the line!
blt cr2, @short_line
_log '^b'
b @input_busywait
@ -260,7 +260,7 @@ panic_common
; Now a line is expected to be committed:
addi r15, r1, -0x960
addi r15, r1, PSA.ThudBuffer
; r15 = start
bl next_cmd_word

View File

@ -4,7 +4,7 @@ Local_Panic set *
InitTMRQs ; OUTSIDE REFERER
addi r9, r1, -0xa84
addi r9, r1, PSA.TimerQueue
lis r8, 0x544d
ori r8, r8, 0x5251
stw r8, 0x0004(r9)
@ -34,7 +34,7 @@ InitTMRQs ; OUTSIDE REFERER
mr. r31, r8
beq Local_Panic
stw r31, -0x0434(r1)
stw r31, PSA.OtherTimerQueuePtr(r1)
li r9, 0x07
stb r9, 0x0014(r31)
li r9, 0x01
@ -55,7 +55,7 @@ InitTMRQs_0x7c
mr. r31, r8
beq Local_Panic
stw r31, -0x0364(r1)
stw r31, PSA._364(r1)
li r9, 0x08
stb r9, 0x0014(r31)
li r9, 0x01
@ -182,7 +182,7 @@ TimerDispatch_0x30 ; OUTSIDE REFERER
b TimerFire4_0x10
timer_earlier_than_sometime
lwz r30, -0x0a7c(r1)
lwz r30, PSA.TimerQueue + LLL.Next(r1)
lwz r16, 0x0038(r30)
lwz r17, 0x003c(r30)
@ -621,7 +621,7 @@ TimerFire7 ; OUTSIDE REFERER
; Dead code -- probably removed from TimerTable
lwz r18, -0x0438(r1)
lwz r18, PSA.DecClockRateHzCopy(r1)
lwz r19, 0x0f88(r1)
subf. r19, r18, r19
ble TimerFire8_0x1c
@ -640,7 +640,7 @@ major_0x134d8_0x18
addze r16, r16
mttbu r16
mttb r17
lwz r18, -0x0438(r1)
lwz r18, PSA.DecClockRateHzCopy(r1)
srwi r18, r18, 11
@ -665,7 +665,7 @@ TimerFire8_0x1c ; OUTSIDE REFERER
; Dead code -- probably removed from TimerTable
lwz r19, -0x036c(r1)
lwz r19, PSA._36c(r1)
mfxer r20
cmpwi cr1, r19, 0x00
srawi r8, r19, 31
@ -696,7 +696,7 @@ major_0x13544_0x44
blt major_0x13544_0x44
major_0x13544_0x64
lwz r18, -0x0368(r1)
lwz r18, PSA._368(r1)
addc r17, r17, r18
addze r16, r16
stw r16, 0x0038(r30)

View File

@ -1407,13 +1407,13 @@ VMAllocateMemory ; OUTSIDE REFERER
bne VMReturnMinus1
mr r4, r9
slwi r6, r6, 12
lwz r9, -0x0408(r1)
lwz r9, PSA._408(r1)
crclr cr3_eq
cmpwi cr6, r6, 0x00
cmplw cr7, r9, r5
bne cr6, VMAllocateMemory_0x6c
blt cr7, VMAllocateMemory_0x6c
lwz r9, -0x040c(r1)
lwz r9, PSA._40c(r1)
subf r4, r5, r9
slwi r4, r4, 2
lwz r15, KDP.FlatPageListPtr(r1)
@ -1486,12 +1486,12 @@ VMAllocateMemory_0xf4
ori r15, r15, 0xc00
stw r15, 0x0004(r14)
bne cr3, VMAllocateMemory_0x164
lwz r8, -0x0408(r1)
lwz r8, PSA._408(r1)
subf r8, r5, r8
stw r8, -0x0408(r1)
lwz r8, -0x040c(r1)
stw r8, PSA._408(r1)
lwz r8, PSA._40c(r1)
subf r8, r5, r8
stw r8, -0x040c(r1)
stw r8, PSA._40c(r1)
b VMAllocateMemory_0x1a4
VMAllocateMemory_0x164
@ -1539,7 +1539,7 @@ VMAllocateMemory_0x1a4
addi r16, r16, 0x01
mr r15, r4
slwi r16, r16, 12
lwz r8, -0x041c(r1)
lwz r8, PSA.blueProcessPtr(r1)
lwz r8, 0x0014(r8)
stw r8, 0x006c(r31)
stw r15, 0x0024(r31)