TempleOS does master-slave multicore instead of SMP. Core0 is the master. The master core's applications explicitly assign computational jobs to other cores and the TempleOS scheduler does not move tasks between cores. There are multicore safe locks for file access and heap allocations, however, so TempleOS is symmetrical in some sense. See ::/Demo/MultiCore/LoadTest.HC. Only tasks on Core0 can have windows, but other cores can help render them. Each core has an executive Seth Task which is the father of all tasks on that core. Adam is the Seth Task on Core0. You give a job to a Seth Task with JobQue() and get the result with JobResGet(). You spawn a task on any core with Spawn(). Note: You must use the LOCK asm prefix when changing shared structures in a multicore environment. The LBts(), LBtr() and LBtc() insts have LOCK prefixes. The compiler has a lock{} feature but it doesn't work well. See ::/Demo/MultiCore/Lock.HC. See ::/Demo/Graphics/Transform.HC. See ::/Kernel/MultiProc.HC. CCPU Class The Gs segment reg points to current CCPU. Gs Funct only used during Core0StartMP JobQue Funct Queue multicore jobs, handled by Seth tasks. JobResGet Funct See ::/Demo/MultiCore/Lock.HC JobResScan Funct Check rqst complete, return with or without. MPHalt Funct Halt all other cores. MPInt Funct Generate interrupt for specified core. MPIntAll Funct Generate interrupt for all but own core. MPNMInt Funct Generate nonmaskable interrupt. Spawn Funct Create task on core running at address. cpu_structs GlbVar _extern SYS_PROGRESSES mp_cnt GlbVar CProgress sys_progresses[PROGRESS_BARS_NUM]; //All progress bars.
MultiCore