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
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
IdleTaskPtr ds.l 1 ; 1c
@ -395,8 +395,8 @@ kSignature equ 'CGRP'
; Fields
;_______________________
LLL ds.l 4 ; 00:10 ; element in CpuStructs list of cgrps
GRPSList ds.l 4 ; 10:20 ; my own list of GRPSes (what are they?)
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
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 ; -a9c
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
DelayQueue ds.l 4 ; -a44:-a34
DbugQueue ds.l 4 ; -a34:-a24
@ -921,27 +921,6 @@ Size equ *
; 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?

View File

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

View File

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

View File

@ -2407,7 +2407,7 @@ IntExternalYellow ; OUTSIDE REFERER
; 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)
cmpwi r9, 2

View File

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

View File

@ -21,7 +21,7 @@ Local_CommonMPCallReturnPath
MPCall_102 ; OUTSIDE REFERER
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)
cmpwi r9, 1
bgt+ Local_ReturnInsufficientResourcesErrFromMPCall
@ -36,7 +36,7 @@ MPCall_102 ; OUTSIDE REFERER
MPCall_103 ; OUTSIDE REFERER
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)
cmpwi r9, 1
bgt+ Local_ReturnInsufficientResourcesErrFromMPCall