189 __e32_io_completion_barrier(); |
189 __e32_io_completion_barrier(); |
190 a.iBootFlag2 = 2; |
190 a.iBootFlag2 = 2; |
191 __e32_io_completion_barrier(); |
191 __e32_io_completion_barrier(); |
192 a.iBPTimestamp = X86::Timestamp(); |
192 a.iBPTimestamp = X86::Timestamp(); |
193 __e32_io_completion_barrier(); |
193 __e32_io_completion_barrier(); |
194 while (a.iBootFlag2==2) |
194 a.iBootFlag2 = 3; |
|
195 __e32_io_completion_barrier(); |
|
196 while (a.iBootFlag2==3) |
195 {} |
197 {} |
196 __e32_io_completion_barrier(); |
198 __e32_io_completion_barrier(); |
197 NKern::EnableAllInterrupts(); |
199 NKern::EnableAllInterrupts(); |
198 |
200 |
199 return KErrNone; |
201 return KErrNone; |
200 } |
202 } |
201 |
203 |
202 void InitAPTimestamp(SNThreadCreateInfo&) |
204 void InitTimestamp(TSubScheduler* aSS, SNThreadCreateInfo& aInfo) |
203 { |
205 { |
|
206 NThread* t = (NThread*)aSS->iCurrentThread; |
|
207 t->iActiveState = 1; |
|
208 if (aSS->iCpuNum == 0) |
|
209 { |
|
210 aSS->iLastTimestamp.i64 = 0; |
|
211 t->iLastActivationTime.i64 = 0; |
|
212 return; |
|
213 } |
204 volatile SApInitInfo& a = *(volatile SApInitInfo*)KApBootPage; |
214 volatile SApInitInfo& a = *(volatile SApInitInfo*)KApBootPage; |
205 NKern::DisableAllInterrupts(); |
215 NKern::DisableAllInterrupts(); |
206 a.iBootFlag2 = 1; |
216 a.iBootFlag2 = 1; |
207 __e32_io_completion_barrier(); |
217 __e32_io_completion_barrier(); |
208 while (a.iBootFlag2==1) |
218 while (a.iBootFlag2==1) |
209 {} |
219 {} |
210 __e32_io_completion_barrier(); |
220 __e32_io_completion_barrier(); |
211 a.iAPTimestamp = X86::Timestamp(); |
221 a.iAPTimestamp = X86::Timestamp(); |
212 __e32_io_completion_barrier(); |
222 __e32_io_completion_barrier(); |
|
223 while (a.iBootFlag2!=3) |
|
224 {} |
|
225 __e32_io_completion_barrier(); |
213 TUint64 bpt = a.iBPTimestamp; |
226 TUint64 bpt = a.iBPTimestamp; |
214 TUint64 apt = a.iAPTimestamp; |
227 TUint64 apt = a.iAPTimestamp; |
215 TUint64 delta = bpt - apt; |
228 TUint64 delta = bpt - apt; |
216 TSubScheduler& ss = SubScheduler(); |
229 aSS->iSSX.iTimestampOffset.i64 = delta; |
217 ss.iLastTimestamp64 += delta; |
230 TUint64 now = NKern::Timestamp(); |
218 *(TUint64*)&ss.i_TimestampOffset = delta; |
|
219 __KTRACE_OPT(KBOOT,DEBUGPRINT("APT=0x%lx BPT=0x%lx Delta=0x%lx", apt, bpt, delta)); |
231 __KTRACE_OPT(KBOOT,DEBUGPRINT("APT=0x%lx BPT=0x%lx Delta=0x%lx", apt, bpt, delta)); |
220 __e32_io_completion_barrier(); |
232 __e32_io_completion_barrier(); |
221 a.iBootFlag2 = 3; |
233 a.iBootFlag2 = 4; |
222 NKern::EnableAllInterrupts(); |
234 NKern::EnableAllInterrupts(); |
|
235 t->iLastActivationTime.i64 = now; |
|
236 aSS->iLastTimestamp.i64 = now; |
223 } |
237 } |
224 |
238 |
225 |
239 |
226 |
240 |