Fix a mistake with the coherence group structure

There is a global linked list of all coherence groups. Coherence groups
and CPUs have a one-to-many relationship.
This commit is contained in:
Elliot Nunn 2018-02-18 00:43:03 +08:00
parent 73c3eece94
commit f0696e5ceb
7 changed files with 22 additions and 44 deletions

View File

@ -288,7 +288,7 @@ kSignature equ 'CPU '
ID ds.l 1 ; 00 ID ds.l 1 ; 00
Signature ds.l 1 ; 04 Signature ds.l 1 ; 04
CgrpList ds.l 4 ; 08:18 LLL ds.l 4 ; 08:18 ; member of CGRP
Eff ds.l 1 ; 18 ; contains 0x0000000f Eff ds.l 1 ; 18 ; contains 0x0000000f
IdleTaskPtr ds.l 1 ; 1c IdleTaskPtr ds.l 1 ; 1c
@ -395,8 +395,8 @@ kSignature equ 'CGRP'
; Fields ; Fields
;_______________________ ;_______________________
LLL ds.l 4 ; 00:10 ; element in CpuStructs list of cgrps CPUList ds.l 4 ; 00:10 ; CPUs on this "motherboard"
GRPSList ds.l 4 ; 10:20 ; my own list of GRPSes (what are they?) LLL ds.l 4 ; 10:20 ; member of global CGRP list
CpuCount ds.l 1 ; 20 CpuCount ds.l 1 ; 20
ScheduledCpuCount ds.l 1 ; 24 ScheduledCpuCount ds.l 1 ; 24
ds.l 1 ; 28 ds.l 1 ; 28

View File

@ -113,7 +113,7 @@ FreePool ds.l 4 ; -ab0 ; LLL with signature 'POOL'
ds.l 1 ; -aa0 ds.l 1 ; -aa0
ds.l 1 ; -a9c ds.l 1 ; -a9c
IndexPtr ds.l 1 ; -a98 ; index of opaque IDs IndexPtr ds.l 1 ; -a98 ; index of opaque IDs
FirstGRPS ds.l 4 ; -a94:-a84 CoherenceGrpList ds.l 4 ; -a94:-a84 ; signature 'GRPS'
TimerQueue ds.l 16 ; -a84:-a44 ; there are more of these in the pool TimerQueue ds.l 16 ; -a84:-a44 ; there are more of these in the pool
DelayQueue ds.l 4 ; -a44:-a34 DelayQueue ds.l 4 ; -a44:-a34
DbugQueue ds.l 4 ; -a34:-a24 DbugQueue ds.l 4 ; -a34:-a24
@ -921,27 +921,6 @@ Size equ *
; Special opaque NanoKernel stuff! ; Special opaque NanoKernel stuff!
GRPSStruct record 0,INCR
kSignature equ 'GRPS'
LLL ds.l 4 ; 00:10
endr
; These seem to go in a notification queue? ; These seem to go in a notification queue?

View File

@ -488,7 +488,7 @@ NKCreateAddressSpaceSub
; Use the motherboard coherence group if none is provided in r8 ; Use the motherboard coherence group if none is provided in r8
bne- @cgrp_provided bne- @cgrp_provided
mfsprg r15, 0 mfsprg r15, 0
lwz r28, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r15) lwz r28, EWA.CPUBase + CPU.LLL + LLL.Freeform(r15)
b @got_cgrp b @got_cgrp
@ -498,7 +498,7 @@ NKCreateAddressSpaceSub
cmpwi r9, CoherenceGroup.kIDClass cmpwi r9, CoherenceGroup.kIDClass
mr r28, r8 mr r28, r8
bne- @fail_notcgrp bne- @fail_notcgrp
lwz r28, CoherenceGroup.GRPSList + LLL.Next(r28) lwz r28, CoherenceGroup.LLL + LLL.Next(r28)
@got_cgrp @got_cgrp

View File

@ -789,12 +789,11 @@ SetProcessorFlags
; Create a GRPS struct in KDP. Make it into an ; Init a global linked list of coherence groups.
; infinite linked list for adoption by coherence group. ; Leave ptr in r30.
; So leave ptr in r30.
addi r30, r1, PSA.FirstGRPS addi r30, r1, PSA.CoherenceGrpList
InitList r30, GRPSStruct.kSignature, scratch=r17 InitList r30, 'GRPS', scratch=r17
@ -809,14 +808,14 @@ SetProcessorFlags
beq- Init_Panic beq- Init_Panic
; Adopt the above-created list of GRPS structs (only one so far) ; Append to the global CGRP list
addi r17, r31, CoherenceGroup.GRPSList addi r17, r31, CoherenceGroup.LLL
stw r30, LLL.Freeform(r17) stw r30, LLL.Freeform(r17)
InsertAsPrev r17, r30, scratch=r18 InsertAsPrev r17, r30, scratch=r18
; Make me into an infinite linked list for adoption by CPU struct. ; Init a list of the CPUs in this CGRP
addi r29, r31, CoherenceGroup.LLL addi r29, r31, CoherenceGroup.CPUList
InitList r29, CoherenceGroup.kSignature, scratch=r17 InitList r29, CoherenceGroup.kSignature, scratch=r17
@ -824,7 +823,7 @@ SetProcessorFlags
mr r8, r31 mr r8, r31
li r9, CoherenceGroup.kIDClass li r9, CoherenceGroup.kIDClass
bl MakeID bl MakeID
stw r8, CoherenceGroup.LLL + LLL.Freeform(r31) stw r8, CoherenceGroup.CPUList + LLL.Freeform(r31)
; Congratulate ourselves ; Congratulate ourselves
@ -868,8 +867,8 @@ SetProcessorFlags
stw r8, CPU.Signature(r31) stw r8, CPU.Signature(r31)
; Adopt the above-created coherence group list ; Append to the motherboard CGRP
addi r17, r31, CPU.CgrpList addi r17, r31, CPU.LLL
stw r29, LLL.Freeform(r17) stw r29, LLL.Freeform(r17)
InsertAsPrev r17, r29, scratch=r18 InsertAsPrev r17, r29, scratch=r18

View File

@ -2407,7 +2407,7 @@ IntExternalYellow ; OUTSIDE REFERER
; How many CPUs? ; How many CPUs?
lwz r9, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r8) lwz r9, EWA.CPUBase + CPU.LLL + LLL.Freeform(r8)
lwz r9, CoherenceGroup.CpuCount(r9) lwz r9, CoherenceGroup.CpuCount(r9)
cmpwi r9, 2 cmpwi r9, 2

View File

@ -879,7 +879,7 @@ KCRegisterCpuPlugin_0x114
KCGetCpuCount ; OUTSIDE REFERER KCGetCpuCount ; OUTSIDE REFERER
mfsprg r15, 0 mfsprg r15, 0
lwz r14, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r15) lwz r14, EWA.CPUBase + CPU.LLL + LLL.Freeform(r15)
mr. r8, r3 mr. r8, r3
lwz r3, CoherenceGroup.CpuCount(r14) lwz r3, CoherenceGroup.CpuCount(r14)
@ -1459,7 +1459,7 @@ KCCreateCpuStruct ; OUTSIDE REFERER
mr. r8, r3 mr. r8, r3
bne- KCCreateCpuStruct_0x14 bne- KCCreateCpuStruct_0x14
mfsprg r15, 0 mfsprg r15, 0
lwz r30, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r15) lwz r30, EWA.CPUBase + CPU.LLL + LLL.Freeform(r15)
b KCCreateCpuStruct_0x24 b KCCreateCpuStruct_0x24
KCCreateCpuStruct_0x14 KCCreateCpuStruct_0x14

View File

@ -21,7 +21,7 @@ Local_CommonMPCallReturnPath
MPCall_102 ; OUTSIDE REFERER MPCall_102 ; OUTSIDE REFERER
mfsprg r9, 0 mfsprg r9, 0
lwz r8, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r9) lwz r8, EWA.CPUBase + CPU.LLL + LLL.Freeform(r9)
lwz r9, CoherenceGroup.ScheduledCpuCount(r8) lwz r9, CoherenceGroup.ScheduledCpuCount(r8)
cmpwi r9, 1 cmpwi r9, 1
bgt+ Local_ReturnInsufficientResourcesErrFromMPCall bgt+ Local_ReturnInsufficientResourcesErrFromMPCall
@ -36,7 +36,7 @@ MPCall_102 ; OUTSIDE REFERER
MPCall_103 ; OUTSIDE REFERER MPCall_103 ; OUTSIDE REFERER
mfsprg r9, 0 mfsprg r9, 0
lwz r8, EWA.CPUBase + CPU.CgrpList + LLL.Freeform(r9) lwz r8, EWA.CPUBase + CPU.LLL + LLL.Freeform(r9)
lwz r9, CoherenceGroup.ScheduledCpuCount(r8) lwz r9, CoherenceGroup.ScheduledCpuCount(r8)
cmpwi r9, 1 cmpwi r9, 1
bgt+ Local_ReturnInsufficientResourcesErrFromMPCall bgt+ Local_ReturnInsufficientResourcesErrFromMPCall