kernel/eka/nkernsmp/arm/nccpu.cpp
changeset 90 947f0dc9f7a8
parent 0 a41df078684a
child 177 a232af6b0b1f
--- a/kernel/eka/nkernsmp/arm/nccpu.cpp	Tue Feb 02 01:24:03 2010 +0200
+++ b/kernel/eka/nkernsmp/arm/nccpu.cpp	Fri Apr 16 16:24:37 2010 +0300
@@ -33,8 +33,15 @@
 	volatile T_UintPtr	iBootFlags4;
 	volatile TUint64	iBPTimestamp;
 	volatile TUint64	iAPTimestamp;
+
+	TUint32				i_SAPBootPage_Spare[624];
+
+	UPerCpuUncached		iPerCpu[KMaxCpus];
 	};
 
+__ASSERT_COMPILE(sizeof(SAPBootPage)==4096);
+
+
 extern "C" void _ApEntry();
 extern "C" void KickCpu(volatile T_UintPtr* aPtr, T_UintPtr aRegsPhys);
 extern void DumpFullRegSet(SFullArmRegSet& a);
@@ -100,41 +107,30 @@
 	__KTRACE_OPT(KBOOT,DEBUGPRINT("SCU: iCtrl=%08x iConfig=%08x iCpuStat=%08x", SCU.iCtrl, SCU.iConfig, SCU.iCpuStatus));
 	if (n==0)
 		return KErrTimedOut;
-	NKern::DisableAllInterrupts();
-	arm_dsb();
-	while (bootPage.iBootFlags2==0)
-		{}
-	arm_dsb();
-	bootPage.iBootFlags2 = 2;
-	arm_dsb();
-	bootPage.iBPTimestamp = NKern::Timestamp();
-	arm_dsb();
-	while (bootPage.iBootFlags2==2)
-		{}
-	arm_dsb();
-	NKern::EnableAllInterrupts();
+
+#if defined(__NKERN_TIMESTAMP_USE_LOCAL_TIMER__)
+#error Use of local timer for NKern::Timestamp() no longer supported
+#endif
+
 	return KErrNone;
 	}
 
-void InitAPTimestamp(SNThreadCreateInfo& aInfo)
+void InitTimestamp(TSubScheduler* aSS, SNThreadCreateInfo& aInfo)
 	{
-	volatile SArmAPBootInfo& a = *(volatile SArmAPBootInfo*)aInfo.iParameterBlock;
-	volatile SAPBootPage& bootPage = *(volatile SAPBootPage*)a.iAPBootLin;
-	NKern::DisableAllInterrupts();
-	bootPage.iBootFlags2 = 1;
-	arm_dsb();
-	while (bootPage.iBootFlags2==1)
-		{}
-	arm_dsb();
-	bootPage.iAPTimestamp = NKern::Timestamp();
-	arm_dsb();
-	TUint64 bpt = bootPage.iBPTimestamp;
-	TUint64 apt = bootPage.iAPTimestamp;
-	TUint64 delta = bpt - apt;
-	SubScheduler().iLastTimestamp64 += delta;
-	__KTRACE_OPT(KBOOT,DEBUGPRINT("APT=0x%lx BPT=0x%lx Delta=0x%lx", apt, bpt, delta));
-	arm_dsb();
-	bootPage.iBootFlags2 = 3;
-	NKern::EnableAllInterrupts();
+	NThread* t = (NThread*)aSS->iCurrentThread;
+	t->iActiveState = 1;
+	if (aSS->iCpuNum == 0)
+		{
+		aSS->iLastTimestamp.i64 = 0;
+		t->iLastActivationTime.i64 = 0;
+		return;
+		}
+	TUint64 ts = 0;
+#if defined(__NKERN_TIMESTAMP_USE_LOCAL_TIMER__)
+#error Use of local timer for NKern::Timestamp() no longer supported
+#endif
+	ts = NKern::Timestamp();
+	aSS->iLastTimestamp.i64 = ts;
+	t->iLastActivationTime.i64 = ts;
 	}