TempleOSCDV4.03.ISO
This commit is contained in:
1 parent
1541d7328d
commit
0f1a4a5d65
115 files changed
+5618
-4863
No files matched your search
+22
-40
@@ -119,6 +119,7 @@ CCPU *CPUStructInit(I64 num,CCPU *c,CTask *seth_task)
|
||||
c->addr=c;
|
||||
c->num=num;
|
||||
c->idle_factor=0.01;
|
||||
QueInit(&c->next_dying);
|
||||
if (Bt(&sys_run_level,RLf_BOOT_HEAP)) {
|
||||
c->idle_task=Spawn(0,NULL,"Idle Task",,Fs,,0);
|
||||
LBts(&c->idle_task->task_flags,TASKf_IDLE);
|
||||
@@ -167,24 +168,6 @@ U0 MPHalt()
|
||||
BusyWait(10000);
|
||||
}
|
||||
|
||||
U0 MPWake(I64 target_cpu)
|
||||
{//Send wake-up interupt to core.
|
||||
if (0<=target_cpu<mp_cnt) {
|
||||
PUSHFD
|
||||
CLI
|
||||
if (Bt(&cpu_structs[target_cpu].cpu_flags,CPUf_SETH_SLEEP))
|
||||
cpu_structs[target_cpu].seth_task->wake_jiffy=0;
|
||||
if (!target_cpu)
|
||||
LBtr(&adam_task->task_flags,TASKf_AWAITING_MSG);
|
||||
MPInt(I_WAKE,target_cpu);
|
||||
if (Bt(&cpu_structs[target_cpu].cpu_flags,CPUf_SETH_SLEEP))//back to sleep?
|
||||
cpu_structs[target_cpu].seth_task->wake_jiffy=0;
|
||||
if (!target_cpu)
|
||||
LBtr(&adam_task->task_flags,TASKf_AWAITING_MSG);
|
||||
POPFD
|
||||
}
|
||||
}
|
||||
|
||||
U0 MPAPICInit()
|
||||
{//Called by adam during start-up
|
||||
//and other cores during initialization
|
||||
@@ -210,22 +193,20 @@ U0 MPAPICInit()
|
||||
|
||||
U0 CoreAPSethTask()
|
||||
{
|
||||
CSrvCtrl *my_ctrl=&Fs->srv_ctrl;
|
||||
CSrvCmd *tempc,*tempc1=&my_ctrl->next_waiting;
|
||||
STI
|
||||
CSrvCtrl *ctrl=&Fs->srv_ctrl;
|
||||
while (TRUE) {
|
||||
TaskFinishOffDying;
|
||||
if (!LBts(&my_ctrl->flags,SVCRf_LOCKED)) {
|
||||
tempc=tempc1->next;
|
||||
if (tempc==tempc1 || !SrvCmdRun(GetRFlags,tempc)) {
|
||||
LBtr(&my_ctrl->flags,SVCRf_LOCKED) ;
|
||||
if (my_ctrl->next_waiting==my_ctrl) {
|
||||
Bts(&Gs->cpu_flags,CPUf_SETH_SLEEP);
|
||||
Sleep(20);
|
||||
Btr(&Gs->cpu_flags,CPUf_SETH_SLEEP);
|
||||
}
|
||||
}
|
||||
}
|
||||
STI
|
||||
do {
|
||||
TaskKillDying;
|
||||
do PAUSE
|
||||
while (LBts(&ctrl->flags,SVCRf_LOCKED));
|
||||
} while (ctrl->next_waiting!=ctrl && SrvCmdRunOne(GetRFlags,ctrl));
|
||||
CLI
|
||||
LBts(&Fs->task_flags,TASKf_AWAITING_MSG);
|
||||
LBtr(&ctrl->flags,SVCRf_LOCKED);
|
||||
LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
Yield;
|
||||
LBtr(&Fs->task_flags,TASKf_IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +218,7 @@ CSrvCmd *JobQue(I64 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
//See $LK,"::/Demo/MultiCore/Lock.CPP"$
|
||||
CSrvCtrl *ctrl;
|
||||
CSrvCmd *tempc;
|
||||
CTask *seth;
|
||||
if (!(0<=target_cpu<mp_cnt))
|
||||
throw('MultCore');
|
||||
tempc=ACAlloc(sizeof(CSrvCmd));
|
||||
@@ -249,15 +231,17 @@ CSrvCmd *JobQue(I64 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
tempc->flags=flags;
|
||||
tempc->aux1=aux1;
|
||||
tempc->aux2=aux2;
|
||||
tempc->ctrl=ctrl=&cpu_structs[target_cpu].seth_task->srv_ctrl;
|
||||
seth=cpu_structs[target_cpu].seth_task;
|
||||
tempc->ctrl=ctrl=&seth->srv_ctrl;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&ctrl->flags,SVCRf_LOCKED))
|
||||
Yield;
|
||||
if (ctrl->next_waiting==ctrl && LBtr(&seth->task_flags,TASKf_AWAITING_MSG))
|
||||
MPInt(I_WAKE,target_cpu);
|
||||
QueIns(tempc,ctrl->last_waiting);
|
||||
LBtr(&ctrl->flags,SVCRf_LOCKED);
|
||||
POPFD
|
||||
MPWake(target_cpu);
|
||||
return tempc;
|
||||
}
|
||||
|
||||
@@ -360,11 +344,9 @@ U0 Core0StartMP()
|
||||
}
|
||||
|
||||
//Make sure they're all up-and-running
|
||||
for (i=1;i<my_mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
while (!Bt(&c->cpu_flags,CPUf_SETH_SLEEP))
|
||||
PAUSE
|
||||
}
|
||||
for (i=1;i<my_mp_cnt;i++)
|
||||
while (!Bt(&cpu_structs[i].seth_task->task_flags,TASKf_AWAITING_MSG))
|
||||
PAUSE;
|
||||
|
||||
POPFD
|
||||
mp_cnt=my_mp_cnt; //Finalize cnt
|
||||
|
||||
Reference in new issue
Block a user